Class: SmartlistPushApi::Http::HttpClient

Inherits:
Object
  • Object
show all
Defined in:
lib/smartlist_push_api/http/http_client.rb

Instance Method Summary collapse

Constructor Details

#initializeHttpClient

Returns a new instance of HttpClient.



5
6
7
8
9
10
# File 'lib/smartlist_push_api/http/http_client.rb', line 5

def initialize()
  @default_headers = {
      'x-access-token' => SmartlistPushApi.access_token,
      'Accept' => 'application/json'
  }
end

Instance Method Details

#delete_request(url) ⇒ Object



24
25
26
# File 'lib/smartlist_push_api/http/http_client.rb', line 24

def delete_request(url)
  HTTParty.delete("#{SmartlistPushApi.base_uri}#{url}", {headers: @default_headers})
end

#get_request(url) ⇒ Object



20
21
22
# File 'lib/smartlist_push_api/http/http_client.rb', line 20

def get_request(url)
  HTTParty.get("#{SmartlistPushApi.base_uri}#{url}", {headers: @default_headers})
end

#patch_request(url, data) ⇒ Object



16
17
18
# File 'lib/smartlist_push_api/http/http_client.rb', line 16

def patch_request(url, data)
  HTTParty.patch("#{SmartlistPushApi.base_uri}#{url}", {body: data, headers: @default_headers})
end

#post_request(url, data) ⇒ Object



12
13
14
# File 'lib/smartlist_push_api/http/http_client.rb', line 12

def post_request(url, data)
  HTTParty.post("#{SmartlistPushApi.base_uri}#{url}", {body: data, headers: @default_headers})
end