Class: WCC::Contentful::SimpleClient::TyphoeusAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/wcc/contentful/simple_client/typhoeus_adapter.rb

Defined Under Namespace

Classes: Response

Instance Method Summary collapse

Instance Method Details

#get(url, params = {}, headers = {}) {|req| ... } ⇒ Object

Yields:

  • (req)


7
8
9
10
11
12
13
14
15
16
17
# File 'lib/wcc/contentful/simple_client/typhoeus_adapter.rb', line 7

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

Raises:

  • (NotImplementedError)


19
20
21
22
23
24
25
26
27
28
29
# File 'lib/wcc/contentful/simple_client/typhoeus_adapter.rb', line 19

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