Class: NicoQuery::Api::Base
- Inherits:
-
Object
- Object
- NicoQuery::Api::Base
show all
- Defined in:
- lib/nicoquery/api/base.rb
Instance Method Summary
collapse
Instance Method Details
29
30
31
32
33
34
35
36
|
# File 'lib/nicoquery/api/base.rb', line 29
def get
RestClient.get uri.to_s do |response, request, result, &block|
case response.code
when 200 || 403
response
end
end
end
|
12
13
14
|
# File 'lib/nicoquery/api/base.rb', line 12
def params
@params_array.join('&')
end
|
16
17
18
19
20
21
22
|
# File 'lib/nicoquery/api/base.rb', line 16
def path
if @dynamic_segment.present?
static_segment + '/' + @dynamic_segment
else
static_segment
end
end
|
8
9
10
|
# File 'lib/nicoquery/api/base.rb', line 8
def scheme
'http'
end
|
24
25
26
27
|
# File 'lib/nicoquery/api/base.rb', line 24
def uri
_uri = scheme + "://" + [ ([host, path].join('/')), params].join('?')
URI.escape _uri
end
|