Class: Io::Flow::V0::Models::WebhookDelivery
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::WebhookDelivery
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
A webhook delivery represents an event that matched a webhook’s event types. Each delivery will be attempted one or more times subject to the settings of your webhook.
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#latest ⇒ Object
readonly
Returns the value of attribute latest.
-
#next_attempt_at ⇒ Object
readonly
Returns the value of attribute next_attempt_at.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#webhook ⇒ Object
readonly
Returns the value of attribute webhook.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ WebhookDelivery
constructor
A new instance of WebhookDelivery.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ WebhookDelivery
Returns a new instance of WebhookDelivery.
33497 33498 33499 33500 33501 33502 33503 33504 33505 33506 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33497 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :webhook, :status, :created_at], 'WebhookDelivery') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @webhook = (x = opts.delete(:webhook); x.is_a?(::Io::Flow::V0::Models::WebhookReference) ? x : ::Io::Flow::V0::Models::WebhookReference.new(x)) @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::WebhookStatus) ? x : ::Io::Flow::V0::Models::WebhookStatus.apply(x)) @created_at = HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:created_at)), DateTime) @latest = (x = opts.delete(:latest); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::WebhookRequest) ? x : ::Io::Flow::V0::Models::WebhookRequest.new(x))) @next_attempt_at = (x = opts.delete(:next_attempt_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('next_attempt_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
33495 33496 33497 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33495 def created_at @created_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
33495 33496 33497 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33495 def id @id end |
#latest ⇒ Object (readonly)
Returns the value of attribute latest.
33495 33496 33497 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33495 def latest @latest end |
#next_attempt_at ⇒ Object (readonly)
Returns the value of attribute next_attempt_at.
33495 33496 33497 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33495 def next_attempt_at @next_attempt_at end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
33495 33496 33497 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33495 def status @status end |
#webhook ⇒ Object (readonly)
Returns the value of attribute webhook.
33495 33496 33497 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33495 def webhook @webhook end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
33512 33513 33514 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33512 def copy(incoming={}) WebhookDelivery.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
33516 33517 33518 33519 33520 33521 33522 33523 33524 33525 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33516 def to_hash { :id => id, :webhook => webhook.to_hash, :status => status.value, :created_at => created_at, :latest => latest.nil? ? nil : latest.to_hash, :next_attempt_at => next_attempt_at } end |
#to_json ⇒ Object
33508 33509 33510 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33508 def to_json JSON.dump(to_hash) end |