Class: EasyHubspot::Client

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

Overview

EasyHubspot::Client

Class Method Summary collapse

Class Method Details

.do_delete(path = nil, headers = {}) ⇒ Object



25
26
27
28
29
# File 'lib/easy_hubspot/client.rb', line 25

def do_delete(path = nil, headers = {})
  response = HTTParty.delete("#{EasyHubspot.configuration.base_url}#{path}", headers: headers,
                                                                             format: :plain)
  parse_response(response).nil? ? { status: 'success' } : parse_response(response)
end

.do_get(path = nil, headers = {}) ⇒ Object



7
8
9
10
11
# File 'lib/easy_hubspot/client.rb', line 7

def do_get(path = nil, headers = {})
  response = HTTParty.get("#{EasyHubspot.configuration.base_url}#{path}", headers: headers,
                                                                          format: :plain)
  parse_response(response)
end

.do_patch(path = nil, body = {}, headers = {}) ⇒ Object



19
20
21
22
23
# File 'lib/easy_hubspot/client.rb', line 19

def do_patch(path = nil, body = {}, headers = {})
  response = HTTParty.patch("#{EasyHubspot.configuration.base_url}#{path}", body: body, headers: headers,
                                                                            format: :plain)
  parse_response(response)
end

.do_post(path = nil, body = {}, headers = {}) ⇒ Object



13
14
15
16
17
# File 'lib/easy_hubspot/client.rb', line 13

def do_post(path = nil, body = {}, headers = {})
  response = HTTParty.post("#{EasyHubspot.configuration.base_url}#{path}", body: body, headers: headers,
                                                                           format: :plain)
  parse_response(response)
end