Class: Io::Flow::V0::Clients::Webhooks
- Inherits:
-
Object
- Object
- Io::Flow::V0::Clients::Webhooks
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Method Summary collapse
-
#delete_channel_and_webhooks_by_channel_and_id(channel, id) ⇒ Object
Delete a channel webhook with the specified id.
-
#delete_webhooks_by_organization_and_id(organization, id) ⇒ Object
Delete a webhook with the specified id.
-
#get_channel_and_webhooks_by_channel(channel, incoming = {}) ⇒ Object
Returns webhooks for a channel.
-
#get_channel_and_webhooks_by_channel_and_id(channel, id) ⇒ Object
Returns information about a specific channel webhook.
-
#get_webhooks_by_organization(organization, incoming = {}) ⇒ Object
Returns webhooks for an organization.
-
#get_webhooks_by_organization_and_id(organization, id) ⇒ Object
Returns information about a specific webhook.
-
#initialize(client) ⇒ Webhooks
constructor
A new instance of Webhooks.
-
#post_channel_and_webhooks_by_channel(channel, webhook_form) ⇒ Object
Create a new webhook for a channel.
-
#post_webhooks_by_organization(organization, webhook_form) ⇒ Object
Create a new webhook.
-
#put_channel_and_webhooks_by_channel_and_id(channel, id, webhook_form) ⇒ Object
Update an existing channel webhook.
-
#put_webhooks_by_organization_and_id(organization, id, webhook_form) ⇒ Object
Update an existing webhook.
Constructor Details
#initialize(client) ⇒ Webhooks
Returns a new instance of Webhooks.
5188 5189 5190 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5188 def initialize(client) @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client) end |
Instance Method Details
#delete_channel_and_webhooks_by_channel_and_id(channel, id) ⇒ Object
Delete a channel webhook with the specified id
5232 5233 5234 5235 5236 5237 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5232 def delete_channel_and_webhooks_by_channel_and_id(channel, id) HttpClient::Preconditions.assert_class('channel', channel, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/channel/#{CGI.escape(channel)}/webhooks/#{CGI.escape(id)}").delete nil end |
#delete_webhooks_by_organization_and_id(organization, id) ⇒ Object
Delete a webhook with the specified id
5279 5280 5281 5282 5283 5284 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5279 def delete_webhooks_by_organization_and_id(organization, id) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/#{CGI.escape(organization)}/webhooks/#{CGI.escape(id)}").delete nil end |
#get_channel_and_webhooks_by_channel(channel, incoming = {}) ⇒ Object
Returns webhooks for a channel
5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5193 def get_channel_and_webhooks_by_channel(channel, incoming={}) HttpClient::Preconditions.assert_class('channel', channel, 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) }), :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("/channel/#{CGI.escape(channel)}/webhooks").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::Webhook.new(x) } end |
#get_channel_and_webhooks_by_channel_and_id(channel, id) ⇒ Object
Returns information about a specific channel webhook
5215 5216 5217 5218 5219 5220 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5215 def get_channel_and_webhooks_by_channel_and_id(channel, id) HttpClient::Preconditions.assert_class('channel', channel, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/channel/#{CGI.escape(channel)}/webhooks/#{CGI.escape(id)}").get ::Io::Flow::V0::Models::Webhook.new(r) end |
#get_webhooks_by_organization(organization, incoming = {}) ⇒ Object
Returns webhooks for an organization
5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5240 def get_webhooks_by_organization(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) }), :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)}/webhooks").with_query(query).get r.map { |x| ::Io::Flow::V0::Models::Webhook.new(x) } end |
#get_webhooks_by_organization_and_id(organization, id) ⇒ Object
Returns information about a specific webhook
5262 5263 5264 5265 5266 5267 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5262 def get_webhooks_by_organization_and_id(organization, id) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) r = @client.request("/#{CGI.escape(organization)}/webhooks/#{CGI.escape(id)}").get ::Io::Flow::V0::Models::Webhook.new(r) end |
#post_channel_and_webhooks_by_channel(channel, webhook_form) ⇒ Object
Create a new webhook for a channel
5207 5208 5209 5210 5211 5212 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5207 def post_channel_and_webhooks_by_channel(channel, webhook_form) HttpClient::Preconditions.assert_class('channel', channel, String) (x = webhook_form; x.is_a?(::Io::Flow::V0::Models::WebhookForm) ? x : ::Io::Flow::V0::Models::WebhookForm.new(x)) r = @client.request("/channel/#{CGI.escape(channel)}/webhooks").with_json(webhook_form.to_json).post ::Io::Flow::V0::Models::Webhook.new(r) end |
#post_webhooks_by_organization(organization, webhook_form) ⇒ Object
Create a new webhook
5254 5255 5256 5257 5258 5259 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5254 def post_webhooks_by_organization(organization, webhook_form) HttpClient::Preconditions.assert_class('organization', organization, String) (x = webhook_form; x.is_a?(::Io::Flow::V0::Models::WebhookForm) ? x : ::Io::Flow::V0::Models::WebhookForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/webhooks").with_json(webhook_form.to_json).post ::Io::Flow::V0::Models::Webhook.new(r) end |
#put_channel_and_webhooks_by_channel_and_id(channel, id, webhook_form) ⇒ Object
Update an existing channel webhook
5223 5224 5225 5226 5227 5228 5229 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5223 def put_channel_and_webhooks_by_channel_and_id(channel, id, webhook_form) HttpClient::Preconditions.assert_class('channel', channel, String) HttpClient::Preconditions.assert_class('id', id, String) (x = webhook_form; x.is_a?(::Io::Flow::V0::Models::WebhookForm) ? x : ::Io::Flow::V0::Models::WebhookForm.new(x)) r = @client.request("/channel/#{CGI.escape(channel)}/webhooks/#{CGI.escape(id)}").with_json(webhook_form.to_json).put ::Io::Flow::V0::Models::Webhook.new(r) end |
#put_webhooks_by_organization_and_id(organization, id, webhook_form) ⇒ Object
Update an existing webhook
5270 5271 5272 5273 5274 5275 5276 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5270 def put_webhooks_by_organization_and_id(organization, id, webhook_form) HttpClient::Preconditions.assert_class('organization', organization, String) HttpClient::Preconditions.assert_class('id', id, String) (x = webhook_form; x.is_a?(::Io::Flow::V0::Models::WebhookForm) ? x : ::Io::Flow::V0::Models::WebhookForm.new(x)) r = @client.request("/#{CGI.escape(organization)}/webhooks/#{CGI.escape(id)}").with_json(webhook_form.to_json).put ::Io::Flow::V0::Models::Webhook.new(r) end |