Class: ShellCardManagementApIs::DayTimeRestriction
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ShellCardManagementApIs::DayTimeRestriction
- Defined in:
- lib/shell_card_management_ap_is/models/day_time_restriction.rb
Overview
Details of the day/time restrictions such as weekdays and time range in which transactions should be allowed on the card.
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) ⇒ DayTimeRestriction
constructor
A new instance of DayTimeRestriction.
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) ⇒ DayTimeRestriction
Returns a new instance of DayTimeRestriction.
92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/shell_card_management_ap_is/models/day_time_restriction.rb', line 92 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
31 32 33 |
# File 'lib/shell_card_management_ap_is/models/day_time_restriction.rb', line 31 def friday @friday end |
#monday ⇒ TrueClass | FalseClass
True if card could be used on a Monday, else false
15 16 17 |
# File 'lib/shell_card_management_ap_is/models/day_time_restriction.rb', line 15 def monday @monday end |
#saturday ⇒ TrueClass | FalseClass
True if card could be used on a Saturday, else false
35 36 37 |
# File 'lib/shell_card_management_ap_is/models/day_time_restriction.rb', line 35 def saturday @saturday end |
#sunday ⇒ TrueClass | FalseClass
True if card could be used on a Sunday, else false.
39 40 41 |
# File 'lib/shell_card_management_ap_is/models/day_time_restriction.rb', line 39 def sunday @sunday end |
#thursday ⇒ TrueClass | FalseClass
True if card could be used on a Thursday, else false
27 28 29 |
# File 'lib/shell_card_management_ap_is/models/day_time_restriction.rb', line 27 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.
47 48 49 |
# File 'lib/shell_card_management_ap_is/models/day_time_restriction.rb', line 47 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.
55 56 57 |
# File 'lib/shell_card_management_ap_is/models/day_time_restriction.rb', line 55 def time_to @time_to end |
#tuesday ⇒ TrueClass | FalseClass
True if card could be used on a Tuesday, else false.
19 20 21 |
# File 'lib/shell_card_management_ap_is/models/day_time_restriction.rb', line 19 def tuesday @tuesday end |
#wednesday ⇒ TrueClass | FalseClass
True if card could be used on a Wednesday, else false.
23 24 25 |
# File 'lib/shell_card_management_ap_is/models/day_time_restriction.rb', line 23 def wednesday @wednesday 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 |
# File 'lib/shell_card_management_ap_is/models/day_time_restriction.rb', line 107 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. DayTimeRestriction.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.
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/shell_card_management_ap_is/models/day_time_restriction.rb', line 58 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
88 89 90 |
# File 'lib/shell_card_management_ap_is/models/day_time_restriction.rb', line 88 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/shell_card_management_ap_is/models/day_time_restriction.rb', line 73 def self.optionals %w[ monday tuesday wednesday thursday friday saturday sunday time_from time_to ] end |