Class: HttpAdapter
- Inherits:
-
Object
- Object
- HttpAdapter
- Defined in:
- lib/wcc/contentful/simple_client/http_adapter.rb
Instance Method Summary collapse
- #call(url, query, headers = {}, proxy = {}) ⇒ Object
- #post(url, body, headers = {}, proxy = {}) ⇒ Object
Instance Method Details
#call(url, query, headers = {}, proxy = {}) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/wcc/contentful/simple_client/http_adapter.rb', line 7 def call(url, query, headers = {}, proxy = {}) if proxy[:host] HTTP[headers].via(proxy[:host], proxy[:port], proxy[:username], proxy[:password]) .get(url, params: query) else HTTP[headers].get(url, params: query) end end |
#post(url, body, headers = {}, proxy = {}) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/wcc/contentful/simple_client/http_adapter.rb', line 16 def post(url, body, headers = {}, proxy = {}) if proxy[:host] HTTP[headers].via(proxy[:host], proxy[:port], proxy[:username], proxy[:password]) .post(url, json: body) else HTTP[headers].post(url, json: body) end end |