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



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

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



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

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



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

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

  response
end