Class: Cangaroo::Webhook::Client
- Inherits:
-
Object
- Object
- Cangaroo::Webhook::Client
- Includes:
- HTTParty
- Defined in:
- lib/cangaroo/webhook/client.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(connection, path) ⇒ Client
constructor
A new instance of Client.
- #post(payload, request_id, parameters) ⇒ Object
Constructor Details
#initialize(connection, path) ⇒ Client
Returns a new instance of Client.
10 11 12 13 |
# File 'lib/cangaroo/webhook/client.rb', line 10 def initialize(connection, path) @connection = connection @path = path end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
8 9 10 |
# File 'lib/cangaroo/webhook/client.rb', line 8 def connection @connection end |
#path ⇒ Object
Returns the value of attribute path.
8 9 10 |
# File 'lib/cangaroo/webhook/client.rb', line 8 def path @path end |
Instance Method Details
#post(payload, request_id, parameters) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/cangaroo/webhook/client.rb', line 15 def post(payload, request_id, parameters) request_body = body(payload, request_id, parameters).to_json req = self.class.post(url, headers: headers, body: request_body) if req.response.code == '200' req.parsed_response else fail Cangaroo::Webhook::Error, req.parsed_response['summary'] end end |