Class: ShellCardManagementApIs::DayTimeRestrictions
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ShellCardManagementApIs::DayTimeRestrictions
- Defined in:
- lib/shell_card_management_ap_is/models/day_time_restrictions.rb
Overview
DayTimeRestrictions Model.
Instance Attribute Summary collapse
-
#friday ⇒ TrueClass | FalseClass
True if card could be used on a Friday, else false.
-
#monday ⇒ TrueClass | FalseClass
True if card could be used on a Monday, else false.
-
#saturday ⇒ TrueClass | FalseClass
True if card could be used on a Saturday, else false.
-
#sunday ⇒ TrueClass | FalseClass
True if card could be used on a Sunday, else false.
-
#thursday ⇒ TrueClass | FalseClass
True if card could be used on a Thursday, else false.
-
#time_from ⇒ String
Card could be used from this time in a day.
-
#time_to ⇒ String
Card could be used up to this time in a day.
-
#tuesday ⇒ TrueClass | FalseClass
True if card could be used on a Tuesday, else false.
-
#wednesday ⇒ TrueClass | FalseClass
True if card could be used on a Wednesday, else false.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(monday = SKIP, tuesday = SKIP, wednesday = SKIP, thursday = SKIP, friday = SKIP, saturday = SKIP, sunday = SKIP, time_from = SKIP, time_to = SKIP) ⇒ DayTimeRestrictions
constructor
A new instance of DayTimeRestrictions.
Methods inherited from BaseModel
Constructor Details
#initialize(monday = SKIP, tuesday = SKIP, wednesday = SKIP, thursday = SKIP, friday = SKIP, saturday = SKIP, sunday = SKIP, time_from = SKIP, time_to = SKIP) ⇒ DayTimeRestrictions
Returns a new instance of DayTimeRestrictions.
91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/shell_card_management_ap_is/models/day_time_restrictions.rb', line 91 def initialize(monday = SKIP, tuesday = SKIP, wednesday = SKIP, thursday = SKIP, friday = SKIP, saturday = SKIP, sunday = SKIP, time_from = SKIP, time_to = SKIP) @monday = monday unless monday == SKIP @tuesday = tuesday unless tuesday == SKIP @wednesday = wednesday unless wednesday == SKIP @thursday = thursday unless thursday == SKIP @friday = friday unless friday == SKIP @saturday = saturday unless saturday == SKIP @sunday = sunday unless sunday == SKIP @time_from = time_from unless time_from == SKIP @time_to = time_to unless time_to == SKIP end |
Instance Attribute Details
#friday ⇒ TrueClass | FalseClass
True if card could be used on a Friday, else false
30 31 32 |
# File 'lib/shell_card_management_ap_is/models/day_time_restrictions.rb', line 30 def friday @friday end |
#monday ⇒ TrueClass | FalseClass
True if card could be used on a Monday, else false
14 15 16 |
# File 'lib/shell_card_management_ap_is/models/day_time_restrictions.rb', line 14 def monday @monday end |
#saturday ⇒ TrueClass | FalseClass
True if card could be used on a Saturday, else false
34 35 36 |
# File 'lib/shell_card_management_ap_is/models/day_time_restrictions.rb', line 34 def saturday @saturday end |
#sunday ⇒ TrueClass | FalseClass
True if card could be used on a Sunday, else false.
38 39 40 |
# File 'lib/shell_card_management_ap_is/models/day_time_restrictions.rb', line 38 def sunday @sunday end |
#thursday ⇒ TrueClass | FalseClass
True if card could be used on a Thursday, else false
26 27 28 |
# File 'lib/shell_card_management_ap_is/models/day_time_restrictions.rb', line 26 def thursday @thursday end |
#time_from ⇒ String
Card could be used from this time in a day. Format: HH:mm (24-hour format) Note:
-
Clients to convert this to appropriate DateTime or TimeSpan type.
“00:00” is the lowest time value and “23:59” is the highest time value.
46 47 48 |
# File 'lib/shell_card_management_ap_is/models/day_time_restrictions.rb', line 46 def time_from @time_from end |
#time_to ⇒ String
Card could be used up to this time in a day. Format: HH:mm (24-hour format) Note:
-
Clients to convert this to appropriate DateTime or TimeSpan type.
“00:00” is the lowest time value and “23:59” is the highest time value.
54 55 56 |
# File 'lib/shell_card_management_ap_is/models/day_time_restrictions.rb', line 54 def time_to @time_to end |
#tuesday ⇒ TrueClass | FalseClass
True if card could be used on a Tuesday, else false.
18 19 20 |
# File 'lib/shell_card_management_ap_is/models/day_time_restrictions.rb', line 18 def tuesday @tuesday end |
#wednesday ⇒ TrueClass | FalseClass
True if card could be used on a Wednesday, else false.
22 23 24 |
# File 'lib/shell_card_management_ap_is/models/day_time_restrictions.rb', line 22 def wednesday @wednesday end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/shell_card_management_ap_is/models/day_time_restrictions.rb', line 106 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. monday = hash.key?('Monday') ? hash['Monday'] : SKIP tuesday = hash.key?('Tuesday') ? hash['Tuesday'] : SKIP wednesday = hash.key?('Wednesday') ? hash['Wednesday'] : SKIP thursday = hash.key?('Thursday') ? hash['Thursday'] : SKIP friday = hash.key?('Friday') ? hash['Friday'] : SKIP saturday = hash.key?('Saturday') ? hash['Saturday'] : SKIP sunday = hash.key?('Sunday') ? hash['Sunday'] : SKIP time_from = hash.key?('TimeFrom') ? hash['TimeFrom'] : SKIP time_to = hash.key?('TimeTo') ? hash['TimeTo'] : SKIP # Create object from extracted values. DayTimeRestrictions.new(monday, tuesday, wednesday, thursday, friday, saturday, sunday, time_from, time_to) end |
.names ⇒ Object
A mapping from model property names to API property names.
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/shell_card_management_ap_is/models/day_time_restrictions.rb', line 57 def self.names @_hash = {} if @_hash.nil? @_hash['monday'] = 'Monday' @_hash['tuesday'] = 'Tuesday' @_hash['wednesday'] = 'Wednesday' @_hash['thursday'] = 'Thursday' @_hash['friday'] = 'Friday' @_hash['saturday'] = 'Saturday' @_hash['sunday'] = 'Sunday' @_hash['time_from'] = 'TimeFrom' @_hash['time_to'] = 'TimeTo' @_hash end |
.nullables ⇒ Object
An array for nullable fields
87 88 89 |
# File 'lib/shell_card_management_ap_is/models/day_time_restrictions.rb', line 87 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/shell_card_management_ap_is/models/day_time_restrictions.rb', line 72 def self.optionals %w[ monday tuesday wednesday thursday friday saturday sunday time_from time_to ] end |