Class: Instamojo::API
- Inherits:
-
Object
- Object
- Instamojo::API
- Defined in:
- lib/base.rb,
lib/API/api.rb
Constant Summary collapse
- WHITELISTED_API_PARAMS =
[:api_key, :auth_token, :endpoint]
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(api_key = nil, auth_token = nil, endpoint = nil, options = {}, &block) ⇒ API
constructor
A new instance of API.
- #to_s ⇒ Object
Constructor Details
#initialize(api_key = nil, auth_token = nil, endpoint = nil, options = {}, &block) ⇒ API
Returns a new instance of API.
15 16 17 18 19 20 21 |
# File 'lib/API/api.rb', line 15 def initialize(api_key = nil, auth_token = nil, endpoint = nil, = {}, &block) = find_params(api_key, auth_token, endpoint, , block) .select { |k, _| WHITELISTED_API_PARAMS.include? k.to_sym }.each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
13 14 15 |
# File 'lib/API/api.rb', line 13 def client @client end |
Instance Method Details
#to_s ⇒ Object
27 28 29 |
# File 'lib/API/api.rb', line 27 def to_s @endpoint ? sprintf("Instamojo API(key: %s, endpoint: %s)", @api_key, @endpoint): sprintf("Instamojo API(key: %s)", @api_key) end |