class Io::Flow::V0::Models::WebhookRequest
Attributes
body[R]
completed_at[R]
duration_ms[R]
error[R]
headers[R]
id[R]
method[R]
response[R]
started_at[R]
status[R]
Public Class Methods
new(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 72859 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :headers, :method, :body, :status], 'WebhookRequest') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @headers = HttpClient::Preconditions.assert_class('headers', opts.delete(:headers), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Header) ? x : ::Io::Flow::V0::Models::Header.new(x)) } @method = (x = opts.delete(:method); x.is_a?(::Io::Flow::V0::Models::Method) ? x : ::Io::Flow::V0::Models::Method.apply(x)) @body = HttpClient::Preconditions.assert_class('body', opts.delete(:body), String) @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::WebhookStatus) ? x : ::Io::Flow::V0::Models::WebhookStatus.apply(x)) @started_at = (x = opts.delete(:started_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('started_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) @completed_at = (x = opts.delete(:completed_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('completed_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) @duration_ms = (x = opts.delete(:duration_ms); x.nil? ? nil : HttpClient::Preconditions.assert_class('duration_ms', x, Integer)) @response = (x = opts.delete(:response); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::WebhookResponse) ? x : ::Io::Flow::V0::Models::WebhookResponse.new(x))) @error = (x = opts.delete(:error); x.nil? ? nil : HttpClient::Preconditions.assert_class('error', x, String)) end
Public Instance Methods
copy(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 72878 def copy(incoming={}) WebhookRequest.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 72882 def to_hash { :id => id, :headers => headers.map { |o| o.to_hash }, :method => method.value, :body => body, :status => status.value, :started_at => started_at, :completed_at => completed_at, :duration_ms => duration_ms, :response => response.nil? ? nil : response.to_hash, :error => error } end
to_json()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 72874 def to_json JSON.dump(to_hash) end