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.



14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14881

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))
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



14879
14880
14881
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14879

def address
  @address
end

#keyObject (readonly)

Returns the value of attribute key.



14879
14880
14881
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14879

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



14879
14880
14881
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14879

def name
  @name
end

#packagingObject (readonly)

Returns the value of attribute packaging.



14879
14880
14881
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14879

def packaging
  @packaging
end

#scheduleObject (readonly)

Returns the value of attribute schedule.



14879
14880
14881
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14879

def schedule
  @schedule
end

#servicesObject (readonly)

Returns the value of attribute services.



14879
14880
14881
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14879

def services
  @services
end

#timezoneObject (readonly)

Returns the value of attribute timezone.



14879
14880
14881
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14879

def timezone
  @timezone
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



14897
14898
14899
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14897

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

#to_hashObject



14901
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14901

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
  }
end

#to_jsonObject



14893
14894
14895
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14893

def to_json
  JSON.dump(to_hash)
end