Module: GrowlCar::Configuration

Included in:
GrowlCar
Defined in:
lib/growl_car/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#password=(value) ⇒ Object (writeonly)

Sets the attribute password

Parameters:

  • value

    the value to set the attribute password to.



3
4
5
# File 'lib/growl_car/configuration.rb', line 3

def password=(value)
  @password = value
end

#username=(value) ⇒ Object (writeonly)

Sets the attribute username

Parameters:

  • value

    the value to set the attribute username to.



3
4
5
# File 'lib/growl_car/configuration.rb', line 3

def username=(value)
  @username = value
end

Class Method Details

.boxcar_urlString

Url for boxcar.io

Returns:

  • (String)


20
21
22
# File 'lib/growl_car/configuration.rb', line 20

def boxcar_url
  "https://boxcar.io/notifications"
end

.keysArray

List of keys used for configuration

Returns:

  • (Array)


10
11
12
13
14
15
# File 'lib/growl_car/configuration.rb', line 10

def keys
  @keys ||= [
    :username,
    :password
  ]
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Convenience method to allow GrowlCar configuration to be set in a block

Yields:

  • (_self)

Yield Parameters:

Raises:



28
29
30
31
32
# File 'lib/growl_car/configuration.rb', line 28

def configure
  yield self
  validate_credentials!
  self
end

#reset!Object

Set all configuration values to nil



35
36
37
38
39
# File 'lib/growl_car/configuration.rb', line 35

def reset!
  GrowlCar::Configuration.keys.each do |key|
    instance_variable_set(:"@#{key}", nil)
  end
end