Class: Async::Slack::Wrapper

Inherits:
REST::Wrapper::JSON
  • Object
show all
Defined in:
lib/async/slack/representation.rb

Defined Under Namespace

Classes: Parser

Instance Method Summary collapse

Instance Method Details

#prepare_request(payload, headers) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/async/slack/representation.rb', line 30

def prepare_request(payload, headers)
  super(nil, headers)
  
  if payload
    headers['content-type'] = Async::REST::Wrapper::URLEncoded::APPLICATION_FORM_URLENCODED
    
    ::Protocol::HTTP::Body::Buffered.new([
      ::Protocol::HTTP::URL.encode(payload)
    ])
  end
end

#wrap_response(response) ⇒ Object



54
55
56
57
58
# File 'lib/async/slack/representation.rb', line 54

def wrap_response(response)
  if body = response.body
    response.body = Parser.new(body)
  end
end