Module: MagicBell::ApiOperations
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, = {}) defaults = { headers: default_headers } response = HTTParty.get(url, .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, = {}) defaults = { headers: default_headers } response = HTTParty.post(url, .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, = {}) defaults = { headers: default_headers } response = HTTParty.put(url, .merge(defaults)) raise_http_error_unless_2xx_response(response) response end |