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.



15252
15253
15254
15255
15256
15257
15258
15259
15260
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15252

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)
  @status = HttpClient::Preconditions.assert_class('status', opts.delete(:status), Integer)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



15250
15251
15252
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15250

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



15250
15251
15252
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15250

def headers
  @headers
end

#idObject (readonly)

Returns the value of attribute id.



15250
15251
15252
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15250

def id
  @id
end

#requestObject (readonly)

Returns the value of attribute request.



15250
15251
15252
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15250

def request
  @request
end

#statusObject (readonly)

Returns the value of attribute status.



15250
15251
15252
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15250

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



15266
15267
15268
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15266

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

#to_hashObject



15270
15271
15272
15273
15274
15275
15276
15277
15278
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15270

def to_hash
  {
    :id => id,
    :request => request.to_hash,
    :headers => headers.map { |o| o.to_hash },
    :body => body,
    :status => status
  }
end

#to_jsonObject



15262
15263
15264
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15262

def to_json
  JSON.dump(to_hash)
end