Skip to content

Commit

Permalink
Remove pry from development dependancies. Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewshafer committed Apr 10, 2013
1 parent b13f9c2 commit a51fe23
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
1 change: 0 additions & 1 deletion growl_car.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec", "~> 2.13.0"
spec.add_development_dependency "pry", "~> 0.9.12"
spec.add_development_dependency "webmock", "~> 1.11.0"
spec.add_development_dependency "simplecov", "~> 0.7.1"
spec.add_development_dependency "coveralls", "~> 0.6.4"
Expand Down
4 changes: 4 additions & 0 deletions lib/growl_car/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ class Client
include GrowlCar::Request
include GrowlCar::GrowlNotification

# Initialize a new GrowlCar::Client
#
# @param options [Hash]
# @return [GrowlCar::Client]
def initialize(options={})
GrowlCar::Configuration.keys.each do |key|
instance_variable_set(:"@#{key}", options[key])
Expand Down
11 changes: 11 additions & 0 deletions lib/growl_car/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,35 @@ module Configuration
attr_writer :username, :password

class << self

# List of keys used for configuration
#
# @return [Array]
def keys
@keys ||= [
:username,
:password
]
end

# Url for boxcar.io
#
# @return [String]
def boxcar_url
"https://boxcar.io/notifications"
end
end

# Convenience method to allow GrowlCar configuration to be set in a block
#
# @raise [GrowlCar::Error::ConfigurationError] if credentials are not in the form of a string
def configure
yield self
validate_credentials!
self
end

# Set all configuration values to nil
def reset!
GrowlCar::Configuration.keys.each do |key|
instance_variable_set(:"@#{key}", nil)
Expand Down
7 changes: 7 additions & 0 deletions lib/growl_car/growl_notification.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
module GrowlCar
module GrowlNotification

# Sends a notification to the boxcar.io growl provider
#
# @param from [String] name of the sender of the message
# @param message [String] message to be sent to boxcar
# @raise [GrowlCar::Error::UnauthorizedError] if username or password is incorrect
# @raise [GrowlCar::Error::HttpError] if http response is not 200 or 401
# @return [Boolean] on successful notification
def send_growl_notification(from, message)
boxcar_post_fields = {
"notification[from_screen_name]" => from,
Expand Down
1 change: 1 addition & 0 deletions lib/growl_car/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module GrowlCar
module Request

# Initialize HTTPClient for requests
def initialize
@http = HTTPClient.new
end
Expand Down

0 comments on commit a51fe23

Please sign in to comment.