Class: ShellSmartPayApi::OpeningHour

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_smart_pay_api/models/opening_hour.rb

Overview

OpeningHour 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(closing_from_hours = SKIP, closing_from_minutes = SKIP, closing_to_hours = SKIP, closing_to_minutes = SKIP, from_day = SKIP, opening_from_hours = SKIP, opening_from_minutes = SKIP, opening_to_hours = SKIP, opening_to_minutes = SKIP, to_day = SKIP) ⇒ OpeningHour

Returns a new instance of OpeningHour.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/shell_smart_pay_api/models/opening_hour.rb', line 89

def initialize(closing_from_hours = SKIP, closing_from_minutes = SKIP,
               closing_to_hours = SKIP, closing_to_minutes = SKIP,
               from_day = SKIP, opening_from_hours = SKIP,
               opening_from_minutes = SKIP, opening_to_hours = SKIP,
               opening_to_minutes = SKIP, to_day = SKIP)
  @closing_from_hours = closing_from_hours unless closing_from_hours == SKIP
  @closing_from_minutes = closing_from_minutes unless closing_from_minutes == SKIP
  @closing_to_hours = closing_to_hours unless closing_to_hours == SKIP
  @closing_to_minutes = closing_to_minutes unless closing_to_minutes == SKIP
  @from_day = from_day unless from_day == SKIP
  @opening_from_hours = opening_from_hours unless opening_from_hours == SKIP
  @opening_from_minutes = opening_from_minutes unless opening_from_minutes == SKIP
  @opening_to_hours = opening_to_hours unless opening_to_hours == SKIP
  @opening_to_minutes = opening_to_minutes unless opening_to_minutes == SKIP
  @to_day = to_day unless to_day == SKIP
end

Instance Attribute Details

#closing_from_hoursString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/shell_smart_pay_api/models/opening_hour.rb', line 14

def closing_from_hours
  @closing_from_hours
end

#closing_from_minutesString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/shell_smart_pay_api/models/opening_hour.rb', line 18

def closing_from_minutes
  @closing_from_minutes
end

#closing_to_hoursString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/shell_smart_pay_api/models/opening_hour.rb', line 22

def closing_to_hours
  @closing_to_hours
end

#closing_to_minutesString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/shell_smart_pay_api/models/opening_hour.rb', line 26

def closing_to_minutes
  @closing_to_minutes
end

#from_dayString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/shell_smart_pay_api/models/opening_hour.rb', line 30

def from_day
  @from_day
end

#opening_from_hoursString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/shell_smart_pay_api/models/opening_hour.rb', line 34

def opening_from_hours
  @opening_from_hours
end

#opening_from_minutesString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/shell_smart_pay_api/models/opening_hour.rb', line 38

def opening_from_minutes
  @opening_from_minutes
end

#opening_to_hoursString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/shell_smart_pay_api/models/opening_hour.rb', line 42

def opening_to_hours
  @opening_to_hours
end

#opening_to_minutesString

TODO: Write general description for this method

Returns:

  • (String)


46
47
48
# File 'lib/shell_smart_pay_api/models/opening_hour.rb', line 46

def opening_to_minutes
  @opening_to_minutes
end

#to_dayString

TODO: Write general description for this method

Returns:

  • (String)


50
51
52
# File 'lib/shell_smart_pay_api/models/opening_hour.rb', line 50

def to_day
  @to_day
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/shell_smart_pay_api/models/opening_hour.rb', line 107

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  closing_from_hours =
    hash.key?('Closing_From_Hours') ? hash['Closing_From_Hours'] : SKIP
  closing_from_minutes =
    hash.key?('Closing_From_Minutes') ? hash['Closing_From_Minutes'] : SKIP
  closing_to_hours =
    hash.key?('Closing_To_Hours') ? hash['Closing_To_Hours'] : SKIP
  closing_to_minutes =
    hash.key?('Closing_To_Minutes') ? hash['Closing_To_Minutes'] : SKIP
  from_day = hash.key?('From_Day') ? hash['From_Day'] : SKIP
  opening_from_hours =
    hash.key?('Opening_From_Hours') ? hash['Opening_From_Hours'] : SKIP
  opening_from_minutes =
    hash.key?('Opening_From_Minutes') ? hash['Opening_From_Minutes'] : SKIP
  opening_to_hours =
    hash.key?('Opening_To_Hours') ? hash['Opening_To_Hours'] : SKIP
  opening_to_minutes =
    hash.key?('Opening_To_Minutes') ? hash['Opening_To_Minutes'] : SKIP
  to_day = hash.key?('To_Day') ? hash['To_Day'] : SKIP

  # Create object from extracted values.
  OpeningHour.new(closing_from_hours,
                  closing_from_minutes,
                  closing_to_hours,
                  closing_to_minutes,
                  from_day,
                  opening_from_hours,
                  opening_from_minutes,
                  opening_to_hours,
                  opening_to_minutes,
                  to_day)
end

.namesObject

A mapping from model property names to API property names.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/shell_smart_pay_api/models/opening_hour.rb', line 53

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['closing_from_hours'] = 'Closing_From_Hours'
  @_hash['closing_from_minutes'] = 'Closing_From_Minutes'
  @_hash['closing_to_hours'] = 'Closing_To_Hours'
  @_hash['closing_to_minutes'] = 'Closing_To_Minutes'
  @_hash['from_day'] = 'From_Day'
  @_hash['opening_from_hours'] = 'Opening_From_Hours'
  @_hash['opening_from_minutes'] = 'Opening_From_Minutes'
  @_hash['opening_to_hours'] = 'Opening_To_Hours'
  @_hash['opening_to_minutes'] = 'Opening_To_Minutes'
  @_hash['to_day'] = 'To_Day'
  @_hash
end

.nullablesObject

An array for nullable fields



85
86
87
# File 'lib/shell_smart_pay_api/models/opening_hour.rb', line 85

def self.nullables
  []
end

.optionalsObject

An array for optional fields



69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/shell_smart_pay_api/models/opening_hour.rb', line 69

def self.optionals
  %w[
    closing_from_hours
    closing_from_minutes
    closing_to_hours
    closing_to_minutes
    from_day
    opening_from_hours
    opening_from_minutes
    opening_to_hours
    opening_to_minutes
    to_day
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



154
155
156
157
158
159
160
161
162
# File 'lib/shell_smart_pay_api/models/opening_hour.rb', line 154

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} closing_from_hours: #{@closing_from_hours.inspect}, closing_from_minutes:"\
  " #{@closing_from_minutes.inspect}, closing_to_hours: #{@closing_to_hours.inspect},"\
  " closing_to_minutes: #{@closing_to_minutes.inspect}, from_day: #{@from_day.inspect},"\
  " opening_from_hours: #{@opening_from_hours.inspect}, opening_from_minutes:"\
  " #{@opening_from_minutes.inspect}, opening_to_hours: #{@opening_to_hours.inspect},"\
  " opening_to_minutes: #{@opening_to_minutes.inspect}, to_day: #{@to_day.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



144
145
146
147
148
149
150
151
# File 'lib/shell_smart_pay_api/models/opening_hour.rb', line 144

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} closing_from_hours: #{@closing_from_hours}, closing_from_minutes:"\
  " #{@closing_from_minutes}, closing_to_hours: #{@closing_to_hours}, closing_to_minutes:"\
  " #{@closing_to_minutes}, from_day: #{@from_day}, opening_from_hours:"\
  " #{@opening_from_hours}, opening_from_minutes: #{@opening_from_minutes}, opening_to_hours:"\
  " #{@opening_to_hours}, opening_to_minutes: #{@opening_to_minutes}, to_day: #{@to_day}>"
end