Class: Io::Flow::V0::Clients::WebhookDeliveries
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::WebhookDeliveries
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
-
#get(organization, incoming = {}) ⇒ Object
Returns deliveries for an organization’s webhook.
-
#get_by_id(organization, id) ⇒ Object
Returns information about a specific webhook delivery.
-
#initialize(client) ⇒ WebhookDeliveries
constructor
A new instance of WebhookDeliveries.
-
#post_requests_by_id(organization, id, hash) ⇒ Object
Redeliver a webhook request.
Constructor Details
#initialize(client) ⇒ WebhookDeliveries
Returns a new instance of WebhookDeliveries.
3730 3731 3732 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3730 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#get(organization, incoming = {}) ⇒ Object
Returns deliveries for an organization’s webhook
3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3735 def get(organization, incoming={}) HttpClient::Preconditions.assert_class('organization', organization, String) opts = HttpClient::Helper.symbolize_keys(incoming) query = { :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }), :webhook_id => (x = opts.delete(:webhook_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('webhook_id', x, String)), :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer), :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer), :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "-created_at" : x), String) }.delete_if { |k, v| v.nil? } r = @client.request("/#{CGI.escape(organization)}/webhook/deliveries").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::WebhookDelivery.new(x) } end |
#get_by_id(organization, id) ⇒ Object
Returns information about a specific webhook delivery
3750 3751 3752 3753 3754 3755 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3750 def get_by_id(organization, id) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/#{CGI.escape(organization)}/webhook/deliveries/#{CGI.escape(id)}").get ::Io::Flow::V0::Models::WebhookDelivery.new(r) end |
#post_requests_by_id(organization, id, hash) ⇒ Object
Redeliver a webhook request. This created a new webhook request to requeue delivery
3759 3760 3761 3762 3763 3764 3765 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3759 def post_requests_by_id(organization, id, hash) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) HttpClient::Preconditions.assert_class('hash', hash, Hash) r = @client.request("/#{CGI.escape(organization)}/webhook/deliveries/#{CGI.escape(id)}/requests").with_json(hash.to_json).post ::Io::Flow::V0::Models::WebhookRequest.new(r) end |