Class: HolidaysRest::Country
- Inherits:
-
Data
- Object
- Data
- HolidaysRest::Country
- Defined in:
- lib/holidays_rest/models.rb
Instance Attribute Summary collapse
-
#alpha2 ⇒ Object
readonly
Returns the value of attribute alpha2.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#subdivisions ⇒ Object
readonly
Returns the value of attribute subdivisions.
Class Method Summary collapse
Instance Attribute Details
#alpha2 ⇒ Object (readonly)
Returns the value of attribute alpha2
37 38 39 |
# File 'lib/holidays_rest/models.rb', line 37 def alpha2 @alpha2 end |
#name ⇒ Object (readonly)
Returns the value of attribute name
37 38 39 |
# File 'lib/holidays_rest/models.rb', line 37 def name @name end |
#subdivisions ⇒ Object (readonly)
Returns the value of attribute subdivisions
37 38 39 |
# File 'lib/holidays_rest/models.rb', line 37 def subdivisions @subdivisions end |
Class Method Details
.from_hash(h) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/holidays_rest/models.rb', line 38 def self.from_hash(h) new( name: h.fetch("name", ""), alpha2: h.fetch("alpha2", ""), subdivisions: Array(h["subdivisions"]).map { Subdivision.from_hash(_1) } ) end |