Class: Io::Flow::V0::Clients::WebhookSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ WebhookSettings



5026
5027
5028
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5026

def initialize(client)
  @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client)
end

Instance Method Details

#get(organization) ⇒ Object

Returns the webhook settings for an organization



5031
5032
5033
5034
5035
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5031

def get(organization)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  r = @client.request("/#{CGI.escape(organization)}/webhook/settings").get
  ::Io::Flow::V0::Models::WebhookSettings.new(r)
end

#put(organization, webhook_settings) ⇒ Object

Updates the webhook settings for an organization



5038
5039
5040
5041
5042
5043
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5038

def put(organization, webhook_settings)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  (x = webhook_settings; x.is_a?(::Io::Flow::V0::Models::WebhookSettings) ? x : ::Io::Flow::V0::Models::WebhookSettings.new(x))
  r = @client.request("/#{CGI.escape(organization)}/webhook/settings").with_json(webhook_settings.to_json).put
  ::Io::Flow::V0::Models::WebhookSettings.new(r)
end