Class: CommApi::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/commapi/client.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.data(http_method, url, body = {}) ⇒ Object



21
22
23
# File 'lib/commapi/client.rb', line 21

def self.data(http_method, url, body = {})
  self.new.data(http_method, url, body)
end

Instance Method Details

#data(http_method, url, body = {}) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/commapi/client.rb', line 12

def data(http_method, url, body = {})
  case http_method
  when :get
    get(api_url_for(url), headers: api_headers)
  when :post
    post(api_url_for(url), body: body, headers: api_headers)
  end
end