class Io::Flow::V0::Models::WebhookDelivery

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.

Attributes

created_at[R]
id[R]
latest[R]
next_attempt_at[R]
status[R]
webhook[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 72769
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

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 72784
def copy(incoming={})
  WebhookDelivery.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 72788
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() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 72780
def to_json
  JSON.dump(to_hash)
end