Class: Grackle::Client::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/grackle/client.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, api = :rest, ssl = true) ⇒ Request

Returns a new instance of Request.



51
52
53
54
55
56
57
# File 'lib/grackle/client.rb', line 51

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

#apiObject

Returns the value of attribute api.



49
50
51
# File 'lib/grackle/client.rb', line 49

def api
  @api
end

#clientObject

Returns the value of attribute client.



49
50
51
# File 'lib/grackle/client.rb', line 49

def client
  @client
end

#methodObject

Returns the value of attribute method.



49
50
51
# File 'lib/grackle/client.rb', line 49

def method
  @method
end

#pathObject

Returns the value of attribute path.



49
50
51
# File 'lib/grackle/client.rb', line 49

def path
  @path
end

#sslObject

Returns the value of attribute ssl.



49
50
51
# File 'lib/grackle/client.rb', line 49

def ssl
  @ssl
end

Instance Method Details

#<<(path) ⇒ Object



59
60
61
# File 'lib/grackle/client.rb', line 59

def <<(path)
  self.path << path
end

#hostObject



71
72
73
# File 'lib/grackle/client.rb', line 71

def host
  client.api_hosts[api]
end

#path?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/grackle/client.rb', line 63

def path?
  path.length > 0
end

#schemeObject



75
76
77
# File 'lib/grackle/client.rb', line 75

def scheme
  ssl ? 'https' :'http'
end

#urlObject



67
68
69
# File 'lib/grackle/client.rb', line 67

def url
  "#{scheme}://#{host}#{path}"
end