Class: TAPI::V3::Flights::Search
- Inherits:
-
GenericSearch
- Object
- GenericSearch
- TAPI::V3::Flights::Search
- Defined in:
- lib/tapi/v3/flights/search.rb
Constant Summary collapse
- AIRPORTCODEEXPR =
/^[\w]{3}$/
Instance Attribute Summary collapse
-
#adults ⇒ Object
Returns the value of attribute adults.
-
#children ⇒ Object
Returns the value of attribute children.
-
#comfort ⇒ Object
Returns the value of attribute comfort.
-
#destination ⇒ Object
Returns the value of attribute destination.
-
#infants ⇒ Object
Returns the value of attribute infants.
-
#leaves_on ⇒ Object
Returns the value of attribute leaves_on.
-
#one_way ⇒ Object
Returns the value of attribute one_way.
-
#origin ⇒ Object
Returns the value of attribute origin.
-
#returns_on ⇒ Object
Returns the value of attribute returns_on.
Attributes inherited from GenericSearch
#client, #client_urls, #errors, #start_time, #started_at
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Search
constructor
A new instance of Search.
- #item_path ⇒ Object
- #parameters ⇒ Object
Methods inherited from GenericSearch
#add_error, #api_key, #api_url, #get, #has_errors?, #id, #id=, #load_client, #method_missing, #post_url, #reload, #restart!, #start!, #valid?
Methods included from TAPI::Validations
#add_error, #has_errors?, #inherited_validations, #validate, #validates_date_format_of, #validates_numericality_of, #validates_presence_of, #validations
Methods included from Utils
append_query, coerce_date, parse_date, symbolize_keys
Methods included from Configurable
Constructor Details
#initialize(options = {}) ⇒ Search
Returns a new instance of Search.
92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/tapi/v3/flights/search.rb', line 92 def initialize( = {}) @errors = {} self.origin = [:origin] self.destination = [:destination] self.leaves_on = [:leaves_on] self.returns_on = [:returns_on] self.one_way = [:one_way] self.adults = [:adults] || 1 self.children = [:children] || 0 self.infants = [:infants] || 0 self.comfort = ([:comfort] || "E").upcase end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class TAPI::V3::GenericSearch
Instance Attribute Details
#adults ⇒ Object
Returns the value of attribute adults.
10 11 12 |
# File 'lib/tapi/v3/flights/search.rb', line 10 def adults @adults end |
#children ⇒ Object
Returns the value of attribute children.
10 11 12 |
# File 'lib/tapi/v3/flights/search.rb', line 10 def children @children end |
#comfort ⇒ Object
Returns the value of attribute comfort.
9 10 11 |
# File 'lib/tapi/v3/flights/search.rb', line 9 def comfort @comfort end |
#destination ⇒ Object
Returns the value of attribute destination.
9 10 11 |
# File 'lib/tapi/v3/flights/search.rb', line 9 def destination @destination end |
#infants ⇒ Object
Returns the value of attribute infants.
10 11 12 |
# File 'lib/tapi/v3/flights/search.rb', line 10 def infants @infants end |
#leaves_on ⇒ Object
Returns the value of attribute leaves_on.
10 11 12 |
# File 'lib/tapi/v3/flights/search.rb', line 10 def leaves_on @leaves_on end |
#one_way ⇒ Object
Returns the value of attribute one_way.
10 11 12 |
# File 'lib/tapi/v3/flights/search.rb', line 10 def one_way @one_way end |
#origin ⇒ Object
Returns the value of attribute origin.
9 10 11 |
# File 'lib/tapi/v3/flights/search.rb', line 9 def origin @origin end |
#returns_on ⇒ Object
Returns the value of attribute returns_on.
10 11 12 |
# File 'lib/tapi/v3/flights/search.rb', line 10 def returns_on @returns_on end |
Instance Method Details
#item_path ⇒ Object
88 89 90 |
# File 'lib/tapi/v3/flights/search.rb', line 88 def item_path 'flights' end |
#parameters ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/tapi/v3/flights/search.rb', line 105 def parameters { :key => config[:key], :format => 'json', :origin => origin, :destination => destination, :leaves_on => leaves_on.to_s, :returns_on => returns_on.to_s, :one_way => one_way, :adults => adults, :children => children, :infants => infants, :comfort => comfort } end |