Class: NewStoreApi::ChangeItemRequestBody

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

Overview

ChangeItemRequestBody Model.

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(extended_attributes = SKIP, fulfillment = SKIP, source_id = SKIP) ⇒ ChangeItemRequestBody

Returns a new instance of ChangeItemRequestBody.



47
48
49
50
51
52
# File 'lib/new_store_api/models/change_item_request_body.rb', line 47

def initialize(extended_attributes = SKIP, fulfillment = SKIP,
               source_id = SKIP)
  @extended_attributes = extended_attributes unless extended_attributes == SKIP
  @fulfillment = fulfillment unless fulfillment == SKIP
  @source_id = source_id unless source_id == SKIP
end

Instance Attribute Details

#extended_attributesArray[ExtAttrResource]

TODO: Write general description for this method

Returns:



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

def extended_attributes
  @extended_attributes
end

#fulfillmentFulfillmentEnum

Fulfillment type

Returns:



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

def fulfillment
  @fulfillment
end

#source_idString

Source identifier

Returns:

  • (String)


22
23
24
# File 'lib/new_store_api/models/change_item_request_body.rb', line 22

def source_id
  @source_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/new_store_api/models/change_item_request_body.rb', line 55

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # Parameter is an array, so we need to iterate through it
  extended_attributes = nil
  unless hash['extended_attributes'].nil?
    extended_attributes = []
    hash['extended_attributes'].each do |structure|
      extended_attributes << (ExtAttrResource.from_hash(structure) if structure)
    end
  end

  extended_attributes = SKIP unless hash.key?('extended_attributes')
  fulfillment = hash.key?('fulfillment') ? hash['fulfillment'] : SKIP
  source_id = hash.key?('source_id') ? hash['source_id'] : SKIP

  # Create object from extracted values.
  ChangeItemRequestBody.new(extended_attributes,
                            fulfillment,
                            source_id)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
31
# File 'lib/new_store_api/models/change_item_request_body.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['extended_attributes'] = 'extended_attributes'
  @_hash['fulfillment'] = 'fulfillment'
  @_hash['source_id'] = 'source_id'
  @_hash
end

.nullablesObject

An array for nullable fields



43
44
45
# File 'lib/new_store_api/models/change_item_request_body.rb', line 43

def self.nullables
  []
end

.optionalsObject

An array for optional fields



34
35
36
37
38
39
40
# File 'lib/new_store_api/models/change_item_request_body.rb', line 34

def self.optionals
  %w[
    extended_attributes
    fulfillment
    source_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



86
87
88
89
90
# File 'lib/new_store_api/models/change_item_request_body.rb', line 86

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

#to_sObject

Provides a human-readable string representation of the object.



79
80
81
82
83
# File 'lib/new_store_api/models/change_item_request_body.rb', line 79

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} extended_attributes: #{@extended_attributes}, fulfillment: #{@fulfillment},"\
  " source_id: #{@source_id}>"
end