Class: Easytobookr::Request
- Inherits:
-
Object
- Object
- Easytobookr::Request
- Defined in:
- lib/easytobookr/request.rb
Instance Attribute Summary collapse
-
#function_name ⇒ Object
Returns the value of attribute function_name.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
-
#config ⇒ Object
Convenience method to returns the common config.
-
#initialize(function_name, params = {}) ⇒ Request
constructor
A new instance of Request.
- #response ⇒ Object
- #to_xml ⇒ Object
-
#uri ⇒ Object
Convenience method to returns the endpoint uri.
Constructor Details
#initialize(function_name, params = {}) ⇒ Request
Returns a new instance of Request.
6 7 8 9 |
# File 'lib/easytobookr/request.rb', line 6 def initialize(function_name,params={}) @function_name = function_name @params = params end |
Instance Attribute Details
#function_name ⇒ Object
Returns the value of attribute function_name.
4 5 6 |
# File 'lib/easytobookr/request.rb', line 4 def function_name @function_name end |
#params ⇒ Object
Returns the value of attribute params.
4 5 6 |
# File 'lib/easytobookr/request.rb', line 4 def params @params end |
Instance Method Details
#config ⇒ Object
Convenience method to returns the common config.
36 37 38 |
# File 'lib/easytobookr/request.rb', line 36 def config Easytobookr.config end |
#response ⇒ Object
15 16 17 18 19 |
# File 'lib/easytobookr/request.rb', line 15 def response http = Net::HTTP.new(uri.host,uri.port) response = http.post(uri.path,self.to_xml) Nokogiri.XML(response.body) end |
#to_xml ⇒ Object
11 12 13 |
# File 'lib/easytobookr/request.rb', line 11 def to_xml request_builder.to_xml end |
#uri ⇒ Object
Convenience method to returns the endpoint uri.
41 42 43 |
# File 'lib/easytobookr/request.rb', line 41 def uri config.uri end |