Class: NewStoreApi::Channel1
- Defined in:
- lib/new_store_api/models/channel1.rb
Overview
Describes the origin of the order.
Instance Attribute Summary collapse
-
#associate_id ⇒ String
ID of the store associate who processed this order, when an associate was involved.
-
#name ⇒ String
Caller-provided source label used to distinguish store order clients, for example
self_checkoutorassociate_app. -
#store_id ⇒ String
ID of the store where this order was placed.
-
#type ⇒ ChannelTypeEnum
ID of the store where this order was placed.
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(name = nil, store_id = nil, type = nil, associate_id = SKIP) ⇒ Channel1
constructor
A new instance of Channel1.
-
#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(name = nil, store_id = nil, type = nil, associate_id = SKIP) ⇒ Channel1
Returns a new instance of Channel1.
56 57 58 59 60 61 |
# File 'lib/new_store_api/models/channel1.rb', line 56 def initialize(name = nil, store_id = nil, type = nil, associate_id = SKIP) @associate_id = associate_id unless associate_id == SKIP @name = name @store_id = store_id @type = type end |
Instance Attribute Details
#associate_id ⇒ String
ID of the store associate who processed this order, when an associate was involved.
15 16 17 |
# File 'lib/new_store_api/models/channel1.rb', line 15 def associate_id @associate_id end |
#name ⇒ String
Caller-provided source label used to distinguish store order clients, for
example self_checkout or associate_app.
20 21 22 |
# File 'lib/new_store_api/models/channel1.rb', line 20 def name @name end |
#store_id ⇒ String
ID of the store where this order was placed. Used to resolve the store's address for IN_STORE_HANDOVER fulfillment.
25 26 27 |
# File 'lib/new_store_api/models/channel1.rb', line 25 def store_id @store_id end |
#type ⇒ ChannelTypeEnum
ID of the store where this order was placed. Used to resolve the store's address for IN_STORE_HANDOVER fulfillment.
30 31 32 |
# File 'lib/new_store_api/models/channel1.rb', line 30 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/new_store_api/models/channel1.rb', line 64 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : nil store_id = hash.key?('store_id') ? hash['store_id'] : nil type = hash.key?('type') ? hash['type'] : nil associate_id = hash.key?('associate_id') ? hash['associate_id'] : SKIP # Create object from extracted values. Channel1.new(name, store_id, type, associate_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 |
# File 'lib/new_store_api/models/channel1.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['associate_id'] = 'associate_id' @_hash['name'] = 'name' @_hash['store_id'] = 'store_id' @_hash['type'] = 'type' @_hash end |
.nullables ⇒ Object
An array for nullable fields
50 51 52 53 54 |
# File 'lib/new_store_api/models/channel1.rb', line 50 def self.nullables %w[ associate_id ] end |
.optionals ⇒ Object
An array for optional fields
43 44 45 46 47 |
# File 'lib/new_store_api/models/channel1.rb', line 43 def self.optionals %w[ associate_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
88 89 90 91 92 |
# File 'lib/new_store_api/models/channel1.rb', line 88 def inspect class_name = self.class.name.split('::').last "<#{class_name} associate_id: #{@associate_id.inspect}, name: #{@name.inspect}, store_id:"\ " #{@store_id.inspect}, type: #{@type.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
81 82 83 84 85 |
# File 'lib/new_store_api/models/channel1.rb', line 81 def to_s class_name = self.class.name.split('::').last "<#{class_name} associate_id: #{@associate_id}, name: #{@name}, store_id: #{@store_id},"\ " type: #{@type}>" end |