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.



4938
4939
4940
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4938

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



4943
4944
4945
4946
4947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4943

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



4950
4951
4952
4953
4954
4955
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4950

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