Class: LucidIntercom::PostRequest
- Inherits:
-
Object
- Object
- LucidIntercom::PostRequest
- Defined in:
- lib/lucid_intercom/post_request.rb
Instance Method Summary collapse
- #call(path, data) ⇒ Response
-
#initialize(http: Container[:http]) ⇒ PostRequest
constructor
A new instance of PostRequest.
Constructor Details
#initialize(http: Container[:http]) ⇒ PostRequest
Returns a new instance of PostRequest.
10 11 12 |
# File 'lib/lucid_intercom/post_request.rb', line 10 def initialize(http: Container[:http]) @http = http end |
Instance Method Details
#call(path, data) ⇒ Response
20 21 22 23 24 25 26 27 28 |
# File 'lib/lucid_intercom/post_request.rb', line 20 def call(path, data) res = @http.headers( 'Authorization' => "Bearer #{LucidIntercom.config.access_token}", 'Accept' => 'application/json', 'Content-Type' => 'application/json' ).post("https://api.intercom.io/#{path}", json: data) Response.new(res.code, res.headers.to_h, res.to_s) end |