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.



49680
49681
49682
49683
49684
49685
49686
49687
49688
49689
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49680

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

#bodyObject (readonly)

Returns the value of attribute body.



49678
49679
49680
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49678

def body
  @body
end

#body_urlObject (readonly)

Returns the value of attribute body_url.



49678
49679
49680
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49678

def body_url
  @body_url
end

#headersObject (readonly)

Returns the value of attribute headers.



49678
49679
49680
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49678

def headers
  @headers
end

#idObject (readonly)

Returns the value of attribute id.



49678
49679
49680
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49678

def id
  @id
end

#requestObject (readonly)

Returns the value of attribute request.



49678
49679
49680
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49678

def request
  @request
end

#statusObject (readonly)

Returns the value of attribute status.



49678
49679
49680
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49678

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



49695
49696
49697
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49695

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

#to_hashObject



49699
49700
49701
49702
49703
49704
49705
49706
49707
49708
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49699

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_jsonObject



49691
49692
49693
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49691

def to_json
  JSON.dump(to_hash)
end