Class: GrateHandle::GoGridClient

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

Instance Method Summary collapse

Constructor Details

#initialize(apikey = 'YOUR API KEY', secret = 'YOUR SHARED SECRET', format = 'json', version = '1.2') ⇒ GoGridClient

Returns a new instance of GoGridClient.



8
9
10
11
12
13
14
15
16
17
# File 'lib/gogrid_client.rb', line 8

def initialize(apikey  = 'YOUR API KEY',
               secret  = 'YOUR SHARED SECRET',
               format  = 'json',
               version = '1.2')
  @server = 'https://api.gogrid.com/api'
  @secret = secret
  @default_params = { 'format' => format,
                      'v' => version,
                      'api_key' => apikey }
end

Instance Method Details

#credentials(apikey, secret) ⇒ Object



19
20
21
22
# File 'lib/gogrid_client.rb', line 19

def credentials(apikey, secret)
  @default_params['api_key'] = apikey
  @secret = secret
end

#send_api_request(method, params = {}) ⇒ Object



24
25
26
# File 'lib/gogrid_client.rb', line 24

def send_api_request(method, params={})
  open(request_url(method, params)).read
end