Class: Io::Flow::V0::Models::WebhookSettings

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

Overview

Sets organization level settings to determine things like how many retries on delivery, how long we wait, etc. By default, we will attempt delivery up to 6 times, using exponential backoff with a see of 1 minute (60k ms) - which means that we will retry over the course of approximately an hour before giving up.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ WebhookSettings

Returns a new instance of WebhookSettings.



34987
34988
34989
34990
34991
34992
34993
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34987

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @secret = (x = opts.delete(:secret); x.nil? ? nil : HttpClient::Preconditions.assert_class('secret', x, String))
  @retry_max_attempts = HttpClient::Preconditions.assert_class('retry_max_attempts', (x = opts.delete(:retry_max_attempts); x.nil? ? 6 : x), Integer)
  @retry_sleep_ms = HttpClient::Preconditions.assert_class('retry_sleep_ms', (x = opts.delete(:retry_sleep_ms); x.nil? ? 60000 : x), Integer)
  @sleep_ms = HttpClient::Preconditions.assert_class('sleep_ms', (x = opts.delete(:sleep_ms); x.nil? ? 0 : x), Integer)
end

Instance Attribute Details

#retry_max_attemptsObject (readonly)

Returns the value of attribute retry_max_attempts.



34985
34986
34987
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34985

def retry_max_attempts
  @retry_max_attempts
end

#retry_sleep_msObject (readonly)

Returns the value of attribute retry_sleep_ms.



34985
34986
34987
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34985

def retry_sleep_ms
  @retry_sleep_ms
end

#secretObject (readonly)

Returns the value of attribute secret.



34985
34986
34987
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34985

def secret
  @secret
end

#sleep_msObject (readonly)

Returns the value of attribute sleep_ms.



34985
34986
34987
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34985

def sleep_ms
  @sleep_ms
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



34999
35000
35001
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34999

def copy(incoming={})
  WebhookSettings.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



35003
35004
35005
35006
35007
35008
35009
35010
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35003

def to_hash
  {
    :secret => secret,
    :retry_max_attempts => retry_max_attempts,
    :retry_sleep_ms => retry_sleep_ms,
    :sleep_ms => sleep_ms
  }
end

#to_jsonObject



34995
34996
34997
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34995

def to_json
  JSON.dump(to_hash)
end