Class: Io::Flow::V0::Models::WebhookRequest
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::WebhookRequest
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#completed_at ⇒ Object
readonly
Returns the value of attribute completed_at.
-
#duration_ms ⇒ Object
readonly
Returns the value of attribute duration_ms.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#started_at ⇒ Object
readonly
Returns the value of attribute started_at.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ WebhookRequest
constructor
A new instance of WebhookRequest.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ WebhookRequest
Returns a new instance of WebhookRequest.
29155 29156 29157 29158 29159 29160 29161 29162 29163 29164 29165 29166 29167 29168 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29155 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 |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
29153 29154 29155 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29153 def body @body end |
#completed_at ⇒ Object (readonly)
Returns the value of attribute completed_at.
29153 29154 29155 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29153 def completed_at @completed_at end |
#duration_ms ⇒ Object (readonly)
Returns the value of attribute duration_ms.
29153 29154 29155 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29153 def duration_ms @duration_ms end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
29153 29154 29155 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29153 def error @error end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
29153 29154 29155 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29153 def headers @headers end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
29153 29154 29155 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29153 def id @id end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
29153 29154 29155 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29153 def method @method end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
29153 29154 29155 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29153 def response @response end |
#started_at ⇒ Object (readonly)
Returns the value of attribute started_at.
29153 29154 29155 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29153 def started_at @started_at end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
29153 29154 29155 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29153 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
29174 29175 29176 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29174 def copy(incoming={}) WebhookRequest.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
29178 29179 29180 29181 29182 29183 29184 29185 29186 29187 29188 29189 29190 29191 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29178 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 ⇒ Object
29170 29171 29172 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29170 def to_json JSON.dump(to_hash) end |