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)


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

Raises:

  • (NotImplementedError)


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