Module: Rebrandly::Client

Defined in:
lib/rebrandly_client.rb

Constant Summary collapse

API_VERSION =
'v1'.freeze
BASE_URL =
"https://api.rebrandly.com/#{API_VERSION}".freeze

Class Method Summary collapse

Class Method Details

.delete(end_point, options = {}) ⇒ Object



23
24
25
26
27
# File 'lib/rebrandly_client.rb', line 23

def delete(end_point, options = {})
  wrap_request(end_point, options) do |url, http_options, _formatted_options|
    HTTParty.delete(url, http_options)
  end
end

.get(end_point, options = {}) ⇒ Object



11
12
13
14
15
# File 'lib/rebrandly_client.rb', line 11

def get(end_point, options = {})
  wrap_request(end_point, options) do |url, http_options, formatted_options|
    HTTParty.get(url, http_options.merge(query: formatted_options))
  end
end

.post(end_point, options = {}) ⇒ Object



17
18
19
20
21
# File 'lib/rebrandly_client.rb', line 17

def post(end_point, options = {})
  wrap_request(end_point, options) do |url, http_options, formatted_options|
    HTTParty.post(url, http_options.merge(body: formatted_options.to_json))
  end
end