Class: Rapidash::Client
Class Attribute Summary collapse
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
included, #resource, #resource!
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
7
8
9
|
# File 'lib/rapidash/client.rb', line 7
def initialize
raise ConfigurationError.new "Missing Method, define using `method` on your client"
end
|
Class Attribute Details
.patch ⇒ Object
Returns the value of attribute patch.
12
13
14
|
# File 'lib/rapidash/client.rb', line 12
def patch
@patch
end
|
.raise_error ⇒ Object
Returns the value of attribute raise_error.
12
13
14
|
# File 'lib/rapidash/client.rb', line 12
def raise_error
@raise_error
end
|
Instance Attribute Details
#extension ⇒ Object
Returns the value of attribute extension.
5
6
7
|
# File 'lib/rapidash/client.rb', line 5
def extension
@extension
end
|
Class Method Details
.extension(extension = nil) ⇒ Object
28
29
30
|
# File 'lib/rapidash/client.rb', line 28
def extension(extension = nil)
@extension ||= extension
end
|
.method(method) ⇒ Object
14
15
16
17
18
19
20
21
22
|
# File 'lib/rapidash/client.rb', line 14
def method(method)
case method
when :http then include HTTPClient
when :oauth then include OAuthClient
when :test then include TestClient
else
raise ConfigurationError.new "Invalid API Authentication Method"
end
end
|
.raise_errors ⇒ Object
36
37
38
|
# File 'lib/rapidash/client.rb', line 36
def raise_errors
@raise_error = true
end
|
.site(site = nil) ⇒ Object
32
33
34
|
# File 'lib/rapidash/client.rb', line 32
def site(site = nil)
@site ||= site
end
|
.use_patch ⇒ Object
24
25
26
|
# File 'lib/rapidash/client.rb', line 24
def use_patch
@patch = true
end
|
Instance Method Details
#delete(url, options = {}) ⇒ Object
79
80
81
|
# File 'lib/rapidash/client.rb', line 79
def delete(url, options = {})
request(:delete, url, options)
end
|
#get(url, options = {}) ⇒ Object
63
64
65
|
# File 'lib/rapidash/client.rb', line 63
def get(url, options = {})
request(:get, url, options)
end
|
#normalize_url(url) ⇒ Object
53
54
55
56
57
58
59
60
61
|
# File 'lib/rapidash/client.rb', line 53
def normalize_url(url)
if extension
"#{url}.#{extension}"
elsif self.class.respond_to?(:extension) && self.class.extension
"#{url}.#{self.class.extension}"
else
url
end
end
|
#patch(url, options = {}) ⇒ Object
75
76
77
|
# File 'lib/rapidash/client.rb', line 75
def patch(url, options = {})
request(:patch, url, options)
end
|
#post(url, options = {}) ⇒ Object
67
68
69
|
# File 'lib/rapidash/client.rb', line 67
def post(url, options = {})
request(:post, url, options)
end
|
#put(url, options = {}) ⇒ Object
71
72
73
|
# File 'lib/rapidash/client.rb', line 71
def put(url, options = {})
request(:put, url, options)
end
|
#site ⇒ Object
43
44
45
46
|
# File 'lib/rapidash/client.rb', line 43
def site
return @site if @site
self.class.respond_to?(:site) && self.class.site
end
|
#site=(value) ⇒ Object
48
49
50
51
|
# File 'lib/rapidash/client.rb', line 48
def site=(value)
@site = value
@connection = nil
end
|