Class: NewStoreApi::ItemLinks

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

Overview

ItemLinks 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(add_ons = nil, mself = nil, add_add_on = SKIP, change_item = SKIP, remove_item = SKIP) ⇒ ItemLinks

Returns a new instance of ItemLinks.



57
58
59
60
61
62
63
64
# File 'lib/new_store_api/models/item_links.rb', line 57

def initialize(add_ons = nil, mself = nil, add_add_on = SKIP,
               change_item = SKIP, remove_item = SKIP)
  @add_add_on = add_add_on unless add_add_on == SKIP
  @add_ons = add_ons
  @change_item = change_item unless change_item == SKIP
  @remove_item = remove_item unless remove_item == SKIP
  @mself = mself
end

Instance Attribute Details

#add_add_onLink

TODO: Write general description for this method

Returns:



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

def add_add_on
  @add_add_on
end

#add_onsLink

TODO: Write general description for this method

Returns:



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

def add_ons
  @add_ons
end

#change_itemLink

TODO: Write general description for this method

Returns:



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

def change_item
  @change_item
end

#mselfLink

TODO: Write general description for this method

Returns:



30
31
32
# File 'lib/new_store_api/models/item_links.rb', line 30

def mself
  @mself
end

#remove_itemLink

TODO: Write general description for this method

Returns:



26
27
28
# File 'lib/new_store_api/models/item_links.rb', line 26

def remove_item
  @remove_item
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/new_store_api/models/item_links.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  add_ons = Link.from_hash(hash['add_ons']) if hash['add_ons']
  mself = Link.from_hash(hash['self']) if hash['self']
  add_add_on = Link.from_hash(hash['add_add_on']) if hash['add_add_on']
  change_item = Link.from_hash(hash['change_item']) if hash['change_item']
  remove_item = Link.from_hash(hash['remove_item']) if hash['remove_item']

  # Create object from extracted values.
  ItemLinks.new(add_ons,
                mself,
                add_add_on,
                change_item,
                remove_item)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['add_add_on'] = 'add_add_on'
  @_hash['add_ons'] = 'add_ons'
  @_hash['change_item'] = 'change_item'
  @_hash['remove_item'] = 'remove_item'
  @_hash['mself'] = 'self'
  @_hash
end

.nullablesObject

An array for nullable fields



53
54
55
# File 'lib/new_store_api/models/item_links.rb', line 53

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
# File 'lib/new_store_api/models/item_links.rb', line 44

def self.optionals
  %w[
    add_add_on
    change_item
    remove_item
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



93
94
95
96
97
98
# File 'lib/new_store_api/models/item_links.rb', line 93

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} add_add_on: #{@add_add_on.inspect}, add_ons: #{@add_ons.inspect},"\
  " change_item: #{@change_item.inspect}, remove_item: #{@remove_item.inspect}, mself:"\
  " #{@mself.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} add_add_on: #{@add_add_on}, add_ons: #{@add_ons}, change_item:"\
  " #{@change_item}, remove_item: #{@remove_item}, mself: #{@mself}>"
end