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.



4754
4755
4756
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4754

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



4759
4760
4761
4762
4763
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4759

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



4766
4767
4768
4769
4770
4771
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4766

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