Class: Instamojo::API

Inherits:
Object
  • Object
show all
Defined in:
lib/API/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_id = nil, options = {}) {|_self| ... } ⇒ API

Returns a new instance of API.

Yields:

  • (_self)

Yield Parameters:



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/API/api.rb', line 5

def initialize(app_id = nil, options = {})
  options = app_id if app_id.is_a? Hash

  @app_id = app_id

  options.each do |key, value|
    instance_variable_set("@#{key}", value)
  end

  yield self if block_given?
end

Instance Attribute Details

#app_idObject

Returns the value of attribute app_id.



3
4
5
# File 'lib/API/api.rb', line 3

def app_id
  @app_id
end

Instance Method Details

#clientObject



17
18
19
# File 'lib/API/api.rb', line 17

def client
  Instamojo::Client.new(self)
end

#to_sObject



21
22
23
# File 'lib/API/api.rb', line 21

def to_s
  sprintf("Instamojo API(key: %s)", @app_id)
end