Class: Asdawqw::MaxStayModel
- Defined in:
- lib/asdawqw/models/max_stay_model.rb
Overview
MaxStayModel Model.
Instance Attribute Summary collapse
-
#begin_date ⇒ Date
Beginning date of date range for which max stay is applied.
-
#end_date ⇒ Date
End date of date range for which max stay is applied.
-
#max_stay ⇒ Integer
Number of days that will be applied for max stay.
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.
Instance Method Summary collapse
-
#initialize(begin_date = nil, end_date = nil, max_stay = nil) ⇒ MaxStayModel
constructor
A new instance of MaxStayModel.
Methods inherited from BaseModel
Constructor Details
#initialize(begin_date = nil, end_date = nil, max_stay = nil) ⇒ MaxStayModel
Returns a new instance of MaxStayModel.
32 33 34 35 36 37 38 |
# File 'lib/asdawqw/models/max_stay_model.rb', line 32 def initialize(begin_date = nil, end_date = nil, max_stay = nil) @begin_date = begin_date @end_date = end_date @max_stay = max_stay end |
Instance Attribute Details
#begin_date ⇒ Date
Beginning date of date range for which max stay is applied. Date should be in format “yyyy-MM-dd”
12 13 14 |
# File 'lib/asdawqw/models/max_stay_model.rb', line 12 def begin_date @begin_date end |
#end_date ⇒ Date
End date of date range for which max stay is applied. Date should be in format “yyyy-MM-dd”
17 18 19 |
# File 'lib/asdawqw/models/max_stay_model.rb', line 17 def end_date @end_date end |
#max_stay ⇒ Integer
Number of days that will be applied for max stay
21 22 23 |
# File 'lib/asdawqw/models/max_stay_model.rb', line 21 def max_stay @max_stay end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/asdawqw/models/max_stay_model.rb', line 41 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. begin_date = hash['beginDate'] end_date = hash['endDate'] max_stay = hash['maxStay'] # Create object from extracted values. MaxStayModel.new(begin_date, end_date, max_stay) end |
.names ⇒ Object
A mapping from model property names to API property names.
24 25 26 27 28 29 30 |
# File 'lib/asdawqw/models/max_stay_model.rb', line 24 def self.names @_hash = {} if @_hash.nil? @_hash['begin_date'] = 'beginDate' @_hash['end_date'] = 'endDate' @_hash['max_stay'] = 'maxStay' @_hash end |