Class: Io::Flow::V0::Models::CenterForm

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 = {}) ⇒ CenterForm

Returns a new instance of CenterForm.



18672
18673
18674
18675
18676
18677
18678
18679
18680
18681
18682
18683
18684
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18672

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

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



18670
18671
18672
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18670

def address
  @address
end

#capabilitiesObject (readonly)

Returns the value of attribute capabilities.



18670
18671
18672
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18670

def capabilities
  @capabilities
end

#keyObject (readonly)

Returns the value of attribute key.



18670
18671
18672
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18670

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



18670
18671
18672
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18670

def name
  @name
end

#packagingObject (readonly)

Returns the value of attribute packaging.



18670
18671
18672
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18670

def packaging
  @packaging
end

#partner_center_formObject (readonly)

Returns the value of attribute partner_center_form.



18670
18671
18672
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18670

def partner_center_form
  @partner_center_form
end

#scheduleObject (readonly)

Returns the value of attribute schedule.



18670
18671
18672
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18670

def schedule
  @schedule
end

#servicesObject (readonly)

Returns the value of attribute services.



18670
18671
18672
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18670

def services
  @services
end

#timezoneObject (readonly)

Returns the value of attribute timezone.



18670
18671
18672
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18670

def timezone
  @timezone
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



18690
18691
18692
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18690

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

#to_hashObject



18694
18695
18696
18697
18698
18699
18700
18701
18702
18703
18704
18705
18706
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18694

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_jsonObject



18686
18687
18688
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18686

def to_json
  JSON.dump(to_hash)
end