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

Returns a new instance of WebhookSettings.



5165
5166
5167
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5165

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



5170
5171
5172
5173
5174
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5170

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



5177
5178
5179
5180
5181
5182
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5177

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