Class: Emma::Setup
Instance Attribute Summary collapse
-
#account_id ⇒ Object
Returns the value of attribute account_id.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#private_key ⇒ Object
Returns the value of attribute private_key.
-
#public_key ⇒ Object
Returns the value of attribute public_key.
Instance Method Summary collapse
-
#client ⇒ Object
establish connection.
-
#initialize(account_id = nil, public_key = nil, private_key = nil, debug = false) ⇒ Setup
constructor
A new instance of Setup.
- #respond_to_missing?(method, include_private = false) ⇒ Boolean
Methods included from Configurable
Constructor Details
#initialize(account_id = nil, public_key = nil, private_key = nil, debug = false) ⇒ Setup
Returns a new instance of Setup.
17 18 19 20 21 22 |
# File 'lib/emma.rb', line 17 def initialize(account_id = nil, public_key = nil, private_key = nil, debug = false) @account_id = account_id || ENV['EMMA_ACCOUNT_ID'] @public_key = public_key || ENV['EMMA_PUBLIC_KEY'] @private_key = private_key || ENV['EMMA_PRIVATE_KEY'] @debug = debug end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object (private)
35 36 37 38 |
# File 'lib/emma.rb', line 35 def method_missing(method_name, *args) return super unless client.respond_to?(method_name) client.send(method_name, *args) end |
Instance Attribute Details
#account_id ⇒ Object
Returns the value of attribute account_id.
15 16 17 |
# File 'lib/emma.rb', line 15 def account_id @account_id end |
#debug ⇒ Object
Returns the value of attribute debug.
15 16 17 |
# File 'lib/emma.rb', line 15 def debug @debug end |
#private_key ⇒ Object
Returns the value of attribute private_key.
15 16 17 |
# File 'lib/emma.rb', line 15 def private_key @private_key end |
#public_key ⇒ Object
Returns the value of attribute public_key.
15 16 17 |
# File 'lib/emma.rb', line 15 def public_key @public_key end |
Instance Method Details
#client ⇒ Object
establish connection
25 26 27 28 |
# File 'lib/emma.rb', line 25 def client @client = Emma::Client.new() unless defined?(@client) && @client.hash == .hash @client end |
#respond_to_missing?(method, include_private = false) ⇒ Boolean
30 31 32 |
# File 'lib/emma.rb', line 30 def respond_to_missing?(method, include_private = false) client.respond_to?(client, include_private) end |