Sha256: 5bd385da530e6dc81be7a3674133a72d3272212922284a6c72a933877367fcca

Contents?: true

Size: 536 Bytes

Versions: 5

Compression:

Stored size: 536 Bytes

Contents

require 'rest_client'


module NicoQuery
  module Api
    class Base
      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
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nicoquery-0.0.2.4 lib/nicoquery/api/base.rb
nicoquery-0.0.2.3 lib/nicoquery/api/base.rb
nicoquery-0.0.2.2 lib/nicoquery/api/base.rb
nicoquery-0.0.2.1 lib/nicoquery/api/base.rb
nicoquery-0.0.2 lib/nicoquery/api/base.rb