Class: NewStoreApi::CreateCartRequestBody
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::CreateCartRequestBody
- Defined in:
- lib/new_store_api/models/create_cart_request_body.rb
Overview
CreateCartRequestBody Model.
Instance Attribute Summary collapse
-
#associate_id ⇒ String
Associate ID.
-
#catalog ⇒ String
Catalog name.
-
#channel_id ⇒ String
Channel ID (e.g. the store ID).
-
#channel_type ⇒ String
readonly
Channel type.
-
#currency ⇒ String
Currency.
-
#customer_id ⇒ String
Customer ID.
-
#device_id ⇒ String
Device ID.
-
#locale ⇒ String
Catalog locale.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(associate_id = nil, catalog = nil, channel_id = nil, currency = nil, locale = nil, customer_id = SKIP, device_id = SKIP) ⇒ CreateCartRequestBody
constructor
A new instance of CreateCartRequestBody.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(associate_id = nil, catalog = nil, channel_id = nil, currency = nil, locale = nil, customer_id = SKIP, device_id = SKIP) ⇒ CreateCartRequestBody
Returns a new instance of CreateCartRequestBody.
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/new_store_api/models/create_cart_request_body.rb', line 71 def initialize(associate_id = nil, catalog = nil, channel_id = nil, currency = nil, locale = nil, customer_id = SKIP, device_id = SKIP) @associate_id = associate_id @catalog = catalog @channel_id = channel_id @channel_type = 'STORE' @currency = currency @customer_id = customer_id unless customer_id == SKIP @device_id = device_id unless device_id == SKIP @locale = locale end |
Instance Attribute Details
#associate_id ⇒ String
Associate ID
14 15 16 |
# File 'lib/new_store_api/models/create_cart_request_body.rb', line 14 def associate_id @associate_id end |
#catalog ⇒ String
Catalog name
18 19 20 |
# File 'lib/new_store_api/models/create_cart_request_body.rb', line 18 def catalog @catalog end |
#channel_id ⇒ String
Channel ID (e.g. the store ID)
22 23 24 |
# File 'lib/new_store_api/models/create_cart_request_body.rb', line 22 def channel_id @channel_id end |
#channel_type ⇒ String (readonly)
Channel type
26 27 28 |
# File 'lib/new_store_api/models/create_cart_request_body.rb', line 26 def channel_type @channel_type end |
#currency ⇒ String
Currency
30 31 32 |
# File 'lib/new_store_api/models/create_cart_request_body.rb', line 30 def currency @currency end |
#customer_id ⇒ String
Customer ID
34 35 36 |
# File 'lib/new_store_api/models/create_cart_request_body.rb', line 34 def customer_id @customer_id end |
#device_id ⇒ String
Device ID
38 39 40 |
# File 'lib/new_store_api/models/create_cart_request_body.rb', line 38 def device_id @device_id end |
#locale ⇒ String
Catalog locale
42 43 44 |
# File 'lib/new_store_api/models/create_cart_request_body.rb', line 42 def locale @locale end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/new_store_api/models/create_cart_request_body.rb', line 85 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. associate_id = hash.key?('associate_id') ? hash['associate_id'] : nil catalog = hash.key?('catalog') ? hash['catalog'] : nil channel_id = hash.key?('channel_id') ? hash['channel_id'] : nil currency = hash.key?('currency') ? hash['currency'] : nil locale = hash.key?('locale') ? hash['locale'] : nil customer_id = hash.key?('customer_id') ? hash['customer_id'] : SKIP device_id = hash.key?('device_id') ? hash['device_id'] : SKIP # Create object from extracted values. CreateCartRequestBody.new(associate_id, catalog, channel_id, currency, locale, customer_id, device_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/new_store_api/models/create_cart_request_body.rb', line 45 def self.names @_hash = {} if @_hash.nil? @_hash['associate_id'] = 'associate_id' @_hash['catalog'] = 'catalog' @_hash['channel_id'] = 'channel_id' @_hash['channel_type'] = 'channel_type' @_hash['currency'] = 'currency' @_hash['customer_id'] = 'customer_id' @_hash['device_id'] = 'device_id' @_hash['locale'] = 'locale' @_hash end |
.nullables ⇒ Object
An array for nullable fields
67 68 69 |
# File 'lib/new_store_api/models/create_cart_request_body.rb', line 67 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
59 60 61 62 63 64 |
# File 'lib/new_store_api/models/create_cart_request_body.rb', line 59 def self.optionals %w[ customer_id device_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
116 117 118 119 120 121 122 |
# File 'lib/new_store_api/models/create_cart_request_body.rb', line 116 def inspect class_name = self.class.name.split('::').last "<#{class_name} associate_id: #{@associate_id.inspect}, catalog: #{@catalog.inspect},"\ " channel_id: #{@channel_id.inspect}, channel_type: #{@channel_type.inspect}, currency:"\ " #{@currency.inspect}, customer_id: #{@customer_id.inspect}, device_id:"\ " #{@device_id.inspect}, locale: #{@locale.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
108 109 110 111 112 113 |
# File 'lib/new_store_api/models/create_cart_request_body.rb', line 108 def to_s class_name = self.class.name.split('::').last "<#{class_name} associate_id: #{@associate_id}, catalog: #{@catalog}, channel_id:"\ " #{@channel_id}, channel_type: #{@channel_type}, currency: #{@currency}, customer_id:"\ " #{@customer_id}, device_id: #{@device_id}, locale: #{@locale}>" end |