Class: Calculated::Service

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/calculated/service.rb

Instance Method Summary collapse

Constructor Details

#initialize(server, api_version, api_key) ⇒ Service

set the httparty defaults [this obviously makes 1 service] limitation me feels



7
8
9
10
# File 'lib/calculated/service.rb', line 7

def initialize(server, api_version, api_key)
  self.class.base_uri "http://#{server}/api/#{api_version}"
  self.class.headers 'Accept' => 'application/json', "X-CCApiKey" => api_key
end

Instance Method Details

#get(path, params = {}) ⇒ Object



12
13
14
# File 'lib/calculated/service.rb', line 12

def get(path, params = {})
  perform_request(:get, path, params)
end

#post(path, params = {}) ⇒ Object



16
17
18
# File 'lib/calculated/service.rb', line 16

def post(path, params = {})
  perform_request(:post, path, params)
end