Sha256: 8afe109349579f4f30de70333561b80626ec5ba7af33dc119e08c1d688741c00
Contents?: true
Size: 830 Bytes
Versions: 3
Compression:
Stored size: 830 Bytes
Contents
require 'rest_client' require 'active_support/all' module NicoQuery module Api class Base attr_reader :forbidden def scheme 'http' end def params @params_array.join('&') end def path if @dynamic_segment.present? static_segment + '/' + @dynamic_segment else static_segment end end def uri _uri = scheme + "://" + [ ([host, path].join('/')), params].join('?') URI.escape _uri end def get RestClient.get uri.to_s do |response, request, result, &block| case response.code when 200 @forbidden = false response when 403 @forbidden = true response end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nicoquery-0.1.6.1 | lib/nicoquery/api/base.rb |
nicoquery-0.1.6 | lib/nicoquery/api/base.rb |
nicoquery-0.1.5 | lib/nicoquery/api/base.rb |