Class: NicoQuery::Api::Base
- Inherits:
-
Object
- Object
- NicoQuery::Api::Base
show all
- Defined in:
- lib/nicoquery/api/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#forbidden ⇒ Object
Returns the value of attribute forbidden.
8
9
10
|
# File 'lib/nicoquery/api/base.rb', line 8
def forbidden
@forbidden
end
|
Instance Method Details
31
32
33
34
35
36
37
38
39
|
# File 'lib/nicoquery/api/base.rb', line 31
def get
res = nil
RestClient.get uri.to_s do |response|
res = response
end
{ body: res.to_s, headers: res., status_code: res.code }
end
|
14
15
16
|
# File 'lib/nicoquery/api/base.rb', line 14
def params
@params_array.join('&')
end
|
18
19
20
21
22
23
24
|
# File 'lib/nicoquery/api/base.rb', line 18
def path
if @dynamic_segment.present?
static_segment + '/' + @dynamic_segment
else
static_segment
end
end
|
10
11
12
|
# File 'lib/nicoquery/api/base.rb', line 10
def scheme
'http'
end
|
26
27
28
29
|
# File 'lib/nicoquery/api/base.rb', line 26
def uri
_uri = scheme + "://" + [ ([host, path].join('/')), params].join('?')
URI.escape _uri
end
|