Module: MagicBell::ApiOperations

Included in:
Client, User
Defined in:
lib/magicbell/api_operations.rb

Instance Method Summary collapse

Instance Method Details

#get(url, options = {}) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/magicbell/api_operations.rb', line 5

def get(url, options = {})
  defaults = { headers: default_headers }
  response = HTTParty.get(url, options.merge(defaults))
  raise_http_error_unless_2xx_response(response)

  response
end

#post(url, options = {}) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/magicbell/api_operations.rb', line 13

def post(url, options = {})
  defaults = { headers: default_headers }
  response = HTTParty.post(url, options.merge(defaults))
  raise_http_error_unless_2xx_response(response)

  response
end

#put(url, options = {}) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/magicbell/api_operations.rb', line 21

def put(url, options = {})
  defaults = { headers: default_headers }
  response = HTTParty.put(url, options.merge(defaults))
  raise_http_error_unless_2xx_response(response)

  response
end