Class: KondutoTravelInfo
- Inherits:
-
Object
- Object
- KondutoTravelInfo
- Defined in:
- lib/konduto-ruby/konduto_travel_info.rb
Constant Summary collapse
- TRAVEL_CLASS =
[:economy, :business, :first]
Instance Attribute Summary collapse
-
#class ⇒ Object
Returns the value of attribute class.
-
#date ⇒ Object
Returns the value of attribute date.
-
#fare_basis ⇒ Object
Returns the value of attribute fare_basis.
-
#number_of_connections ⇒ Object
Returns the value of attribute number_of_connections.
Instance Method Summary collapse
-
#initialize(*args) ⇒ KondutoTravelInfo
constructor
A new instance of KondutoTravelInfo.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(*args) ⇒ KondutoTravelInfo
Returns a new instance of KondutoTravelInfo.
6 7 8 9 10 11 12 |
# File 'lib/konduto-ruby/konduto_travel_info.rb', line 6 def initialize(*args) unless args[0].nil? args[0].each do |k,v| instance_variable_set("@#{k}", v) unless v.nil? end end end |
Instance Attribute Details
#class ⇒ Object
Returns the value of attribute class.
2 3 4 |
# File 'lib/konduto-ruby/konduto_travel_info.rb', line 2 def class @class end |
#date ⇒ Object
Returns the value of attribute date.
2 3 4 |
# File 'lib/konduto-ruby/konduto_travel_info.rb', line 2 def date @date end |
#fare_basis ⇒ Object
Returns the value of attribute fare_basis.
2 3 4 |
# File 'lib/konduto-ruby/konduto_travel_info.rb', line 2 def fare_basis @fare_basis end |
#number_of_connections ⇒ Object
Returns the value of attribute number_of_connections.
2 3 4 |
# File 'lib/konduto-ruby/konduto_travel_info.rb', line 2 def number_of_connections @number_of_connections end |
Instance Method Details
#to_hash ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/konduto-ruby/konduto_travel_info.rb', line 14 def to_hash hash = { date: self.date, number_of_connections: self.number_of_connections, class: self.class, fare_basis: self.fare_basis } KondutoUtils.remove_nil_keys_from_hash(hash) end |
#to_json ⇒ Object
24 25 26 |
# File 'lib/konduto-ruby/konduto_travel_info.rb', line 24 def to_json self.to_hash.to_json end |