Class: NewStoreApi::ExternalIdentifiers1

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/new_store_api/models/external_identifiers1.rb

Overview

External product identifiers for this return item.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(external_item_id = SKIP, serial_number = SKIP) ⇒ ExternalIdentifiers1

Returns a new instance of ExternalIdentifiers1.



41
42
43
44
# File 'lib/new_store_api/models/external_identifiers1.rb', line 41

def initialize(external_item_id = SKIP, serial_number = SKIP)
  @external_item_id = external_item_id unless external_item_id == SKIP
  @serial_number = serial_number unless serial_number == SKIP
end

Instance Attribute Details

#external_item_idString

External id of the product.

Returns:

  • (String)


14
15
16
# File 'lib/new_store_api/models/external_identifiers1.rb', line 14

def external_item_id
  @external_item_id
end

#serial_numberString

Serial number of the product.

Returns:

  • (String)


18
19
20
# File 'lib/new_store_api/models/external_identifiers1.rb', line 18

def serial_number
  @serial_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/new_store_api/models/external_identifiers1.rb', line 47

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  external_item_id =
    hash.key?('external_item_id') ? hash['external_item_id'] : SKIP
  serial_number = hash.key?('serial_number') ? hash['serial_number'] : SKIP

  # Create object from extracted values.
  ExternalIdentifiers1.new(external_item_id,
                           serial_number)
end

.namesObject

A mapping from model property names to API property names.



21
22
23
24
25
26
# File 'lib/new_store_api/models/external_identifiers1.rb', line 21

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['external_item_id'] = 'external_item_id'
  @_hash['serial_number'] = 'serial_number'
  @_hash
end

.nullablesObject

An array for nullable fields



37
38
39
# File 'lib/new_store_api/models/external_identifiers1.rb', line 37

def self.nullables
  []
end

.optionalsObject

An array for optional fields



29
30
31
32
33
34
# File 'lib/new_store_api/models/external_identifiers1.rb', line 29

def self.optionals
  %w[
    external_item_id
    serial_number
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



62
63
64
65
66
67
68
# File 'lib/new_store_api/models/external_identifiers1.rb', line 62

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



77
78
79
80
81
# File 'lib/new_store_api/models/external_identifiers1.rb', line 77

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} external_item_id: #{@external_item_id.inspect}, serial_number:"\
  " #{@serial_number.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



71
72
73
74
# File 'lib/new_store_api/models/external_identifiers1.rb', line 71

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} external_item_id: #{@external_item_id}, serial_number: #{@serial_number}>"
end