Class: WalmartApIs::AccessPoint

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

Overview

AccessPoint 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(access_point_id:, name:, address:, type: SKIP, operating_hours: SKIP, timezone: SKIP, additional_properties: nil) ⇒ AccessPoint

Returns a new instance of AccessPoint.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/walmart_ap_is/models/access_point.rb', line 63

def initialize(access_point_id:, name:, address:, type: SKIP,
               operating_hours: SKIP, timezone: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @access_point_id = access_point_id
  @name = name
  @type = type unless type == SKIP
  @address = address
  @operating_hours = operating_hours unless operating_hours == SKIP
  @timezone = timezone unless timezone == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#access_point_idString

TODO: Write general description for this method

Returns:

  • (String)


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

def access_point_id
  @access_point_id
end

#addressAddress1

TODO: Write general description for this method

Returns:



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

def address
  @address
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def name
  @name
end

#operating_hoursObject

Per-day operating hours. Compressed shape; full DayOfWeekTimeMap fidelity tracked in a follow-up PR.

Returns:

  • (Object)


31
32
33
# File 'lib/walmart_ap_is/models/access_point.rb', line 31

def operating_hours
  @operating_hours
end

#timezoneString

IANA timezone name (e.g. America/Los_Angeles).

Returns:

  • (String)


35
36
37
# File 'lib/walmart_ap_is/models/access_point.rb', line 35

def timezone
  @timezone
end

#typeType11

TODO: Write general description for this method

Returns:



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

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/walmart_ap_is/models/access_point.rb', line 79

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  access_point_id = hash.key?('accessPointId') ? hash['accessPointId'] : nil
  name = hash.key?('name') ? hash['name'] : nil
  address = Address1.from_hash(hash['address']) if hash['address']
  type = hash.key?('type') ? hash['type'] : SKIP
  operating_hours =
    hash.key?('operatingHours') ? hash['operatingHours'] : SKIP
  timezone = hash.key?('timezone') ? hash['timezone'] : SKIP

  # 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.
  AccessPoint.new(access_point_id: access_point_id,
                  name: name,
                  address: address,
                  type: type,
                  operating_hours: operating_hours,
                  timezone: timezone,
                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
47
# File 'lib/walmart_ap_is/models/access_point.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['access_point_id'] = 'accessPointId'
  @_hash['name'] = 'name'
  @_hash['type'] = 'type'
  @_hash['address'] = 'address'
  @_hash['operating_hours'] = 'operatingHours'
  @_hash['timezone'] = 'timezone'
  @_hash
end

.nullablesObject

An array for nullable fields



59
60
61
# File 'lib/walmart_ap_is/models/access_point.rb', line 59

def self.nullables
  []
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
56
# File 'lib/walmart_ap_is/models/access_point.rb', line 50

def self.optionals
  %w[
    type
    operating_hours
    timezone
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



117
118
119
120
121
122
123
# File 'lib/walmart_ap_is/models/access_point.rb', line 117

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} access_point_id: #{@access_point_id.inspect}, name: #{@name.inspect}, type:"\
  " #{@type.inspect}, address: #{@address.inspect}, operating_hours:"\
  " #{@operating_hours.inspect}, timezone: #{@timezone.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



109
110
111
112
113
114
# File 'lib/walmart_ap_is/models/access_point.rb', line 109

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} access_point_id: #{@access_point_id}, name: #{@name}, type: #{@type},"\
  " address: #{@address}, operating_hours: #{@operating_hours}, timezone: #{@timezone},"\
  " additional_properties: #{@additional_properties}>"
end