Class: Tangolicious::Request

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/tangolicious/request.rb

Instance Method Summary collapse

Methods included from Util

#call_recursively

Instance Method Details

#get(endpoint) ⇒ Object



10
11
12
13
14
# File 'lib/tangolicious/request.rb', line 10

def get(endpoint)
  response = parsed_response(HTTParty.get("#{Tangolicious.api_base}#{endpoint}",
                                          basic_auth: basic_auth))
  check_errors(response)
end

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



16
17
18
19
20
21
22
# File 'lib/tangolicious/request.rb', line 16

def post(endpoint, params = {})
  response = parsed_response(HTTParty.post("#{Tangolicious.api_base}#{endpoint}",
                                           basic_auth: basic_auth,
                                           body: camelize_keys(default_params.merge(params)).to_json,
                                           headers: headers))
  check_errors(response)
end