Class: SabreDevStudio::RequestObject
- Inherits:
-
Hash
- Object
- Hash
- SabreDevStudio::RequestObject
- Defined in:
- lib/sabre_dev_studio/request_object.rb
Overview
Base RequestObject that other API objects can inherit from
Example:
module SabreDevStudio
module Flight
class TravelThemeLookup < SabreDevStudio::RequestObject
end
end
end
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(endpoint, options = {}) ⇒ RequestObject
constructor
A new instance of RequestObject.
- #method_missing(meth, *args, &block) ⇒ Object
- #respond_to?(meth) ⇒ Boolean
Constructor Details
#initialize(endpoint, options = {}) ⇒ RequestObject
Returns a new instance of RequestObject.
18 19 20 |
# File 'lib/sabre_dev_studio/request_object.rb', line 18 def initialize(endpoint, = {}) @response = SabreDevStudio::Base.get(endpoint, :query => ) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/sabre_dev_studio/request_object.rb', line 22 def method_missing(meth, *args, &block) if hashie.respond_to?(meth) hashie.send(meth) else super end end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
16 17 18 |
# File 'lib/sabre_dev_studio/request_object.rb', line 16 def response @response end |
Instance Method Details
#respond_to?(meth) ⇒ Boolean
30 31 32 33 34 35 36 |
# File 'lib/sabre_dev_studio/request_object.rb', line 30 def respond_to?(meth) if hashie.respond_to?(meth) true else super end end |