Class: BloomRemit2::Client
- Inherits:
-
Object
- Object
- BloomRemit2::Client
- Defined in:
- lib/bloom_remit2/client.rb
Class Method Summary collapse
- .delete(path, headers = default_get_headers, staging: false) ⇒ Object
- .get(path, headers = default_get_headers, query: {}, staging: false) ⇒ Object
- .post(path, body = {}, staging = false, headers = default_post_headers) ⇒ Object
- .put(path, body = [], headers = default_put_headers, staging: false) ⇒ Object
Class Method Details
.delete(path, headers = default_get_headers, staging: false) ⇒ Object
24 25 26 27 28 |
# File 'lib/bloom_remit2/client.rb', line 24 def delete(path, headers = default_get_headers, staging: false) the_url = url(path) the_url = staging_url(path) if staging HTTParty.delete(the_url, { headers: headers }) end |
.get(path, headers = default_get_headers, query: {}, staging: false) ⇒ Object
6 7 8 9 10 |
# File 'lib/bloom_remit2/client.rb', line 6 def get(path, headers = default_get_headers, query: {}, staging: false) the_url = url(path) the_url = staging_url(path) if staging HTTParty.get(the_url, { query: query, headers: headers }) end |
.post(path, body = {}, staging = false, headers = default_post_headers) ⇒ Object
12 13 14 15 16 |
# File 'lib/bloom_remit2/client.rb', line 12 def post(path, body = {}, staging = false, headers = default_post_headers) the_url = url(path) the_url = staging_url(path) if staging HTTParty.post(the_url, { body: body.to_json, headers: headers }) end |
.put(path, body = [], headers = default_put_headers, staging: false) ⇒ Object
18 19 20 21 22 |
# File 'lib/bloom_remit2/client.rb', line 18 def put(path, body = [], headers = default_put_headers, staging: false) the_url = url(path) the_url = staging_url(path) if staging HTTParty.put(the_url, { body: URI.encode_www_form(body), headers: headers }) end |