Class: NicoQuery::Api::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/nicoquery/api/base.rb

Direct Known Subclasses

GetThumbInfo, MylistRSS, TagSearchRss, VideoArray

Instance Method Summary collapse

Instance Method Details

#getObject



28
29
30
# File 'lib/nicoquery/api/base.rb', line 28

def get
  RestClient.get uri.to_s
end

#paramsObject



11
12
13
# File 'lib/nicoquery/api/base.rb', line 11

def params
  @params_array.join('&')
end

#pathObject



15
16
17
18
19
20
21
# File 'lib/nicoquery/api/base.rb', line 15

def path
  if @dynamic_segment.present?
    static_segment + '/' + @dynamic_segment
  else
    static_segment
  end
end

#schemeObject



7
8
9
# File 'lib/nicoquery/api/base.rb', line 7

def scheme
  'http'
end

#uriObject



23
24
25
26
# File 'lib/nicoquery/api/base.rb', line 23

def uri
  _uri = scheme + "://" + [ ([host, path].join('/')), params].join('?')
  URI.escape _uri
end