Class: WalmartApIs::Scopes

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/walmart_ap_is/models/scopes.rb

Overview

Scopes 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(reports:, item:, price:, lagtime:, feeds:, returns:, orders:, inventory:, content:, additional_properties: nil) ⇒ Scopes

Returns a new instance of Scopes.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/walmart_ap_is/models/scopes.rb', line 73

def initialize(reports:, item:, price:, lagtime:, feeds:, returns:, orders:,
               inventory:, content:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @reports = reports
  @item = item
  @price = price
  @lagtime = lagtime
  @feeds = feeds
  @returns = returns
  @orders = orders
  @inventory = inventory
  @content = content
  @additional_properties = additional_properties
end

Instance Attribute Details

#contentString

TODO: Write general description for this method

Returns:

  • (String)


46
47
48
# File 'lib/walmart_ap_is/models/scopes.rb', line 46

def content
  @content
end

#feedsString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/walmart_ap_is/models/scopes.rb', line 30

def feeds
  @feeds
end

#inventoryString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/walmart_ap_is/models/scopes.rb', line 42

def inventory
  @inventory
end

#itemString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/walmart_ap_is/models/scopes.rb', line 18

def item
  @item
end

#lagtimeString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/walmart_ap_is/models/scopes.rb', line 26

def lagtime
  @lagtime
end

#ordersString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/walmart_ap_is/models/scopes.rb', line 38

def orders
  @orders
end

#priceString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/walmart_ap_is/models/scopes.rb', line 22

def price
  @price
end

#reportsString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/walmart_ap_is/models/scopes.rb', line 14

def reports
  @reports
end

#returnsString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/walmart_ap_is/models/scopes.rb', line 34

def returns
  @returns
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/walmart_ap_is/models/scopes.rb', line 91

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  reports = hash.key?('reports') ? hash['reports'] : nil
  item = hash.key?('item') ? hash['item'] : nil
  price = hash.key?('price') ? hash['price'] : nil
  lagtime = hash.key?('lagtime') ? hash['lagtime'] : nil
  feeds = hash.key?('feeds') ? hash['feeds'] : nil
  returns = hash.key?('returns') ? hash['returns'] : nil
  orders = hash.key?('orders') ? hash['orders'] : nil
  inventory = hash.key?('inventory') ? hash['inventory'] : nil
  content = hash.key?('content') ? hash['content'] : nil

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  Scopes.new(reports: reports,
             item: item,
             price: price,
             lagtime: lagtime,
             feeds: feeds,
             returns: returns,
             orders: orders,
             inventory: inventory,
             content: content,
             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/walmart_ap_is/models/scopes.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['reports'] = 'reports'
  @_hash['item'] = 'item'
  @_hash['price'] = 'price'
  @_hash['lagtime'] = 'lagtime'
  @_hash['feeds'] = 'feeds'
  @_hash['returns'] = 'returns'
  @_hash['orders'] = 'orders'
  @_hash['inventory'] = 'inventory'
  @_hash['content'] = 'content'
  @_hash
end

.nullablesObject

An array for nullable fields



69
70
71
# File 'lib/walmart_ap_is/models/scopes.rb', line 69

def self.nullables
  []
end

.optionalsObject

An array for optional fields



64
65
66
# File 'lib/walmart_ap_is/models/scopes.rb', line 64

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



134
135
136
137
138
139
140
# File 'lib/walmart_ap_is/models/scopes.rb', line 134

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} reports: #{@reports.inspect}, item: #{@item.inspect}, price:"\
  " #{@price.inspect}, lagtime: #{@lagtime.inspect}, feeds: #{@feeds.inspect}, returns:"\
  " #{@returns.inspect}, orders: #{@orders.inspect}, inventory: #{@inventory.inspect},"\
  " content: #{@content.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



126
127
128
129
130
131
# File 'lib/walmart_ap_is/models/scopes.rb', line 126

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} reports: #{@reports}, item: #{@item}, price: #{@price}, lagtime:"\
  " #{@lagtime}, feeds: #{@feeds}, returns: #{@returns}, orders: #{@orders}, inventory:"\
  " #{@inventory}, content: #{@content}, additional_properties: #{@additional_properties}>"
end