Class: Io::Flow::V0::Models::WebhookResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ WebhookResponse

Returns a new instance of WebhookResponse.



22852
22853
22854
22855
22856
22857
22858
22859
22860
22861
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22852

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.



22850
22851
22852
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22850

def body
  @body
end

#body_url ⇒ Object (readonly)

Returns the value of attribute body_url.



22850
22851
22852
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22850

def body_url
  @body_url
end

#headers ⇒ Object (readonly)

Returns the value of attribute headers.



22850
22851
22852
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22850

def headers
  @headers
end

#id ⇒ Object (readonly)

Returns the value of attribute id.



22850
22851
22852
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22850

def id
  @id
end

#request ⇒ Object (readonly)

Returns the value of attribute request.



22850
22851
22852
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22850

def request
  @request
end

#status ⇒ Object (readonly)

Returns the value of attribute status.



22850
22851
22852
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22850

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



22867
22868
22869
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22867

def copy(incoming={})
  WebhookResponse.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hash ⇒ Object



22871
22872
22873
22874
22875
22876
22877
22878
22879
22880
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22871

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



22863
22864
22865
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22863

def to_json
  JSON.dump(to_hash)
end