Class: Gemical::Connection
- Inherits:
-
Object
- Object
- Gemical::Connection
show all
- Includes:
- Singleton
- Defined in:
- lib/gemical/connection.rb
Defined Under Namespace
Classes: HTTPUnprocessable
Constant Summary
collapse
- HTTPError =
Class.new(StandardError)
- HTTPUnauthorized =
Class.new(HTTPError)
- HTTPServerError =
Class.new(HTTPError)
- HTTPNotFound =
Class.new(HTTPError)
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Singleton
included
Constructor Details
Returns a new instance of Connection.
25
26
27
28
|
# File 'lib/gemical/connection.rb', line 25
def initialize
@base_url = ENV['GEMICAL_URL'] || "http://api.gemical.com"
self.proxy = ENV['http_proxy']
end
|
Instance Attribute Details
#base_url ⇒ Object
Returns the value of attribute base_url.
23
24
25
|
# File 'lib/gemical/connection.rb', line 23
def base_url
@base_url
end
|
Instance Method Details
#delete(path, options = {}) ⇒ Object
46
47
48
|
# File 'lib/gemical/connection.rb', line 46
def delete(path, options = {})
request :delete, path, (options)
end
|
#get(path, options = {}) ⇒ Object
38
39
40
|
# File 'lib/gemical/connection.rb', line 38
def get(path, options = {})
request :get, path, (options)
end
|
#post(path, options = {}) ⇒ Object
42
43
44
|
# File 'lib/gemical/connection.rb', line 42
def post(path, options = {})
request :post, path, options.delete(:params), (options)
end
|
#proxy ⇒ Object
30
31
32
|
# File 'lib/gemical/connection.rb', line 30
def proxy
RestClient.proxy
end
|
#proxy=(url) ⇒ Object
34
35
36
|
# File 'lib/gemical/connection.rb', line 34
def proxy=(url)
RestClient.proxy = url if url
end
|