Class: Io::Flow::V0::Models::WebhookResponse
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::WebhookResponse
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#body_url ⇒ Object
readonly
Returns the value of attribute body_url.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ WebhookResponse
constructor
A new instance of WebhookResponse.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ WebhookResponse
Returns a new instance of WebhookResponse.
54088 54089 54090 54091 54092 54093 54094 54095 54096 54097 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54088 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :request, :headers, :body, :status], 'WebhookResponse') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @request = (x = opts.delete(:request); x.is_a?(::Io::Flow::V0::Models::WebhookRequestReference) ? x : ::Io::Flow::V0::Models::WebhookRequestReference.new(x)) @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)) } @body = HttpClient::Preconditions.assert_class('body', opts.delete(:body), String) @body_url = (x = opts.delete(:body_url); x.nil? ? nil : HttpClient::Preconditions.assert_class('body_url', x, String)) @status = HttpClient::Preconditions.assert_class('status', opts.delete(:status), Integer) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
54086 54087 54088 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54086 def body @body end |
#body_url ⇒ Object (readonly)
Returns the value of attribute body_url.
54086 54087 54088 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54086 def body_url @body_url end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
54086 54087 54088 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54086 def headers @headers end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
54086 54087 54088 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54086 def id @id end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
54086 54087 54088 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54086 def request @request end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
54086 54087 54088 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54086 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
54103 54104 54105 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54103 def copy(incoming={}) WebhookResponse.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
54107 54108 54109 54110 54111 54112 54113 54114 54115 54116 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54107 def to_hash { :id => id, :request => request.to_hash, :headers => headers.map { |o| o.to_hash }, :body => body, :body_url => body_url, :status => status } end |
#to_json ⇒ Object
54099 54100 54101 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54099 def to_json JSON.dump(to_hash) end |