Class: Requestor

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

Instance Method Summary collapse

Constructor Details

#initialize(api_key:, host: nil, version: nil, auth: nil) ⇒ Requestor

Returns a new instance of Requestor.



7
8
9
10
11
12
# File 'lib/requestor.rb', line 7

def initialize(api_key:, host: nil, version: nil, auth: nil)
  @api_key = api_key
  @host = host || 'https://mobius.network/api'
  @version = version || 'v1'
  @auth = auth
end

Instance Method Details

#get(resource, action, payload) ⇒ Object



14
15
16
# File 'lib/requestor.rb', line 14

def get(resource, action, payload)
  request('GET', resource, action, payload)
end

#post(resource, action, payload) ⇒ Object



18
19
20
# File 'lib/requestor.rb', line 18

def post(resource, action, payload)
  request('POST', resource, action, payload)
end

#post_json(resource, action, payload) ⇒ Object



22
23
24
# File 'lib/requestor.rb', line 22

def post_json(resource, action, payload)
  request('POST_JSON', resource, action, payload)
end