Class: WCC::Contentful::SimpleClient::TyphoeusAdapter
- Inherits:
-
Object
- Object
- WCC::Contentful::SimpleClient::TyphoeusAdapter
- Defined in:
- lib/wcc/contentful/simple_client/typhoeus_adapter.rb
Defined Under Namespace
Classes: Response
Instance Method Summary collapse
- #get(url, params = {}, headers = {}) {|req| ... } ⇒ Object
- #post(url, body, headers = {}, proxy = {}) ⇒ Object
Instance Method Details
#get(url, params = {}, headers = {}) {|req| ... } ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/wcc/contentful/simple_client/typhoeus_adapter.rb', line 8 def get(url, params = {}, headers = {}) req = OpenStruct.new(params: params, headers: headers) yield req if block_given? Response.new( Typhoeus.get( url, params: req.params, headers: req.headers ) ) end |
#post(url, body, headers = {}, proxy = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/wcc/contentful/simple_client/typhoeus_adapter.rb', line 20 def post(url, body, headers = {}, proxy = {}) raise NotImplementedError, 'Proxying Not Yet Implemented' if proxy[:host] Response.new( Typhoeus.post( url, body: body.to_json, headers: headers ) ) end |