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