Class: Grackle::Client::Request
- Inherits:
-
Object
- Object
- Grackle::Client::Request
- Defined in:
- lib/grackle/client.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
-
#client ⇒ Object
Returns the value of attribute client.
-
#method ⇒ Object
Returns the value of attribute method.
-
#path ⇒ Object
Returns the value of attribute path.
-
#ssl ⇒ Object
Returns the value of attribute ssl.
Instance Method Summary collapse
- #<<(path) ⇒ Object
- #host ⇒ Object
-
#initialize(client, api = :rest, ssl = true) ⇒ Request
constructor
A new instance of Request.
- #path? ⇒ Boolean
- #scheme ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(client, api = :rest, ssl = true) ⇒ Request
Returns a new instance of Request.
50 51 52 53 54 55 56 |
# File 'lib/grackle/client.rb', line 50 def initialize(client,api=:rest,ssl=true) self.client = client self.api = api self.ssl = ssl self.method = :get self.path = '' end |
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
48 49 50 |
# File 'lib/grackle/client.rb', line 48 def api @api end |
#client ⇒ Object
Returns the value of attribute client.
48 49 50 |
# File 'lib/grackle/client.rb', line 48 def client @client end |
#method ⇒ Object
Returns the value of attribute method.
48 49 50 |
# File 'lib/grackle/client.rb', line 48 def method @method end |
#path ⇒ Object
Returns the value of attribute path.
48 49 50 |
# File 'lib/grackle/client.rb', line 48 def path @path end |
#ssl ⇒ Object
Returns the value of attribute ssl.
48 49 50 |
# File 'lib/grackle/client.rb', line 48 def ssl @ssl end |
Instance Method Details
#<<(path) ⇒ Object
58 59 60 |
# File 'lib/grackle/client.rb', line 58 def <<(path) self.path << path end |
#host ⇒ Object
70 71 72 |
# File 'lib/grackle/client.rb', line 70 def host client.api_hosts[api] end |
#path? ⇒ Boolean
62 63 64 |
# File 'lib/grackle/client.rb', line 62 def path? path.length > 0 end |
#scheme ⇒ Object
74 75 76 |
# File 'lib/grackle/client.rb', line 74 def scheme ssl ? 'https' :'http' end |
#url ⇒ Object
66 67 68 |
# File 'lib/grackle/client.rb', line 66 def url "#{scheme}://#{host}#{path}" end |