Class: EasyPing::Config
- Inherits:
-
Object
- Object
- EasyPing::Config
- Defined in:
- lib/easy_ping/config.rb
Constant Summary collapse
- OPTIONS =
[:app_id, :channel, :currency]
Instance Attribute Summary collapse
-
#api_base ⇒ Object
Returns the value of attribute api_base.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
Instance Method Summary collapse
-
#initialize(options) ⇒ Config
constructor
A new instance of Config.
- #to_options ⇒ Object
Constructor Details
#initialize(options) ⇒ Config
Returns a new instance of Config.
7 8 9 10 11 |
# File 'lib/easy_ping/config.rb', line 7 def initialize() .each do |key, val| self.send("#{key}=", val) if self.respond_to?("#{key}=") end end |
Instance Attribute Details
#api_base ⇒ Object
Returns the value of attribute api_base.
5 6 7 |
# File 'lib/easy_ping/config.rb', line 5 def api_base @api_base end |
#api_key ⇒ Object
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/easy_ping/config.rb', line 5 def api_key @api_key end |
Instance Method Details
#to_options ⇒ Object
17 18 19 20 21 22 |
# File 'lib/easy_ping/config.rb', line 17 def = {} values = OPTIONS.map { |key| self.send key } OPTIONS.zip(values) { |k,v| [k.to_s] = v } end |