Class: ApiModel::HttpRequest
- Inherits:
-
Object
- Object
- ApiModel::HttpRequest
- Includes:
- Initializer
- Defined in:
- lib/api_model/http_request.rb
Instance Attribute Summary collapse
-
#api_call ⇒ Object
Returns the value of attribute api_call.
-
#builder ⇒ Object
Returns the value of attribute builder.
-
#cache_id ⇒ Object
Returns the value of attribute cache_id.
-
#config ⇒ Object
Returns the value of attribute config.
-
#method ⇒ Object
Returns the value of attribute method.
-
#options ⇒ Object
Returns the value of attribute options.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
Methods included from Initializer
Methods included from Assignment
Instance Attribute Details
#api_call ⇒ Object
Returns the value of attribute api_call.
5 6 7 |
# File 'lib/api_model/http_request.rb', line 5 def api_call @api_call end |
#builder ⇒ Object
Returns the value of attribute builder.
5 6 7 |
# File 'lib/api_model/http_request.rb', line 5 def builder @builder end |
#cache_id ⇒ Object
Returns the value of attribute cache_id.
5 6 7 |
# File 'lib/api_model/http_request.rb', line 5 def cache_id @cache_id end |
#config ⇒ Object
Returns the value of attribute config.
5 6 7 |
# File 'lib/api_model/http_request.rb', line 5 def config @config end |
#method ⇒ Object
Returns the value of attribute method.
5 6 7 |
# File 'lib/api_model/http_request.rb', line 5 def method @method end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/api_model/http_request.rb', line 5 def end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/api_model/http_request.rb', line 5 def path @path end |
Instance Method Details
#full_path ⇒ Object
31 32 33 34 |
# File 'lib/api_model/http_request.rb', line 31 def full_path return path if path =~ /^http/ "#{config.host}#{path}" end |
#request_method ⇒ Object
36 37 38 |
# File 'lib/api_model/http_request.rb', line 36 def request_method api_call.request.[:method] end |
#run ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/api_model/http_request.rb', line 15 def run run_callbacks :run do Log.debug "#{method.to_s.upcase} #{full_path} with headers: #{options[:headers]}" self.api_call = Typhoeus.send method, full_path, Response.new self, config end end |