class Io::Flow::V0::Models::CenterForm

Attributes

address[R]
capabilities[R]
key[R]
name[R]
packaging[R]
partner_center_form[R]
schedule[R]
services[R]
timezone[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 34608
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:address, :packaging, :name, :services, :schedule], 'CenterForm')
  @address = (x = opts.delete(:address); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x))
  @packaging = HttpClient::Preconditions.assert_class('packaging', opts.delete(:packaging), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Packaging) ? x : ::Io::Flow::V0::Models::Packaging.new(x)) }
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @services = HttpClient::Preconditions.assert_class('services', opts.delete(:services), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::AvailableService) ? x : ::Io::Flow::V0::Models::AvailableService.new(x)) }
  @schedule = (x = opts.delete(:schedule); x.is_a?(::Io::Flow::V0::Models::Schedule) ? x : ::Io::Flow::V0::Models::Schedule.new(x))
  @timezone = (x = opts.delete(:timezone); x.nil? ? nil : HttpClient::Preconditions.assert_class('timezone', x, String))
  @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
  @capabilities = (x = opts.delete(:capabilities); x.nil? ? nil : HttpClient::Preconditions.assert_class('capabilities', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::CenterCapability) ? x : ::Io::Flow::V0::Models::CenterCapability.apply(x)) })
  @partner_center_form = (x = opts.delete(:partner_center_form); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PartnerCenterForm) ? x : ::Io::Flow::V0::Models::PartnerCenterForm.new(x)))
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 34626
def copy(incoming={})
  CenterForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 34630
def to_hash
  {
    :address => address.to_hash,
    :packaging => packaging.map { |o| o.to_hash },
    :name => name,
    :services => services.map { |o| o.to_hash },
    :schedule => schedule.to_hash,
    :timezone => timezone,
    :key => key,
    :capabilities => capabilities.nil? ? nil : capabilities.map { |o| o.value },
    :partner_center_form => partner_center_form.nil? ? nil : partner_center_form.to_hash
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 34622
def to_json
  JSON.dump(to_hash)
end