Class: RedboothRuby::Request::Info
- Inherits:
-
Object
- Object
- RedboothRuby::Request::Info
- Defined in:
- lib/redbooth-ruby/request/info.rb
Instance Attribute Summary collapse
-
#api_url ⇒ Object
Returns the value of attribute api_url.
-
#base_path ⇒ Object
Returns the value of attribute base_path.
-
#data ⇒ Object
Returns the value of attribute data.
-
#http_method ⇒ Object
Returns the value of attribute http_method.
-
#options ⇒ Object
Returns the value of attribute options.
-
#session ⇒ Object
Returns the value of attribute session.
-
#subdomain ⇒ Object
Returns the value of attribute subdomain.
Instance Method Summary collapse
-
#initialize(http_method, subdomain, api_url, data, options = {}) ⇒ Info
constructor
A new instance of Info.
- #path_with_params(path, params) ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(http_method, subdomain, api_url, data, options = {}) ⇒ Info
Returns a new instance of Info.
6 7 8 9 10 11 12 13 14 |
# File 'lib/redbooth-ruby/request/info.rb', line 6 def initialize(http_method, subdomain, api_url, data, = {}) @http_method = http_method @subdomain = subdomain || DOMAIN_BASE @api_url = api_url @data = data @base_path = RedboothRuby.configuration[:api_base_path] @session = [:session] @options = end |
Instance Attribute Details
#api_url ⇒ Object
Returns the value of attribute api_url.
4 5 6 |
# File 'lib/redbooth-ruby/request/info.rb', line 4 def api_url @api_url end |
#base_path ⇒ Object
Returns the value of attribute base_path.
4 5 6 |
# File 'lib/redbooth-ruby/request/info.rb', line 4 def base_path @base_path end |
#data ⇒ Object
Returns the value of attribute data.
4 5 6 |
# File 'lib/redbooth-ruby/request/info.rb', line 4 def data @data end |
#http_method ⇒ Object
Returns the value of attribute http_method.
4 5 6 |
# File 'lib/redbooth-ruby/request/info.rb', line 4 def http_method @http_method end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/redbooth-ruby/request/info.rb', line 4 def @options end |
#session ⇒ Object
Returns the value of attribute session.
4 5 6 |
# File 'lib/redbooth-ruby/request/info.rb', line 4 def session @session end |
#subdomain ⇒ Object
Returns the value of attribute subdomain.
4 5 6 |
# File 'lib/redbooth-ruby/request/info.rb', line 4 def subdomain @subdomain end |
Instance Method Details
#path_with_params(path, params) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/redbooth-ruby/request/info.rb', line 26 def path_with_params(path, params) unless params.empty? encoded_params = URI.encode_www_form(params) [path, encoded_params].join('?') else path end end |
#url ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/redbooth-ruby/request/info.rb', line 16 def url url = "/#{api_url}" if has_id? url += "/#{data[:id]}" data.delete(:id) end url end |