Sha256: 23fdb7484222753dbf9738a51391a27d56c2a6180ce7d75aa19240a1d684e678

Contents?: true

Size: 564 Bytes

Versions: 6

Compression:

Stored size: 564 Bytes

Contents

require 'nicoapi/core/http_client'


module NicoAPI
  module 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
      http_client = NicoAPI::HttpClient.instance
      http_client.set_params uri.to_s
      http_client.get
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nicoapi-core-0.0.4.2 lib/nicoapi/core/base.rb
nicoapi-core-0.0.3.2 lib/nicoapi/core/base.rb
nicoapi-core-0.0.3.1 lib/nicoapi/core/base.rb
nicoapi-core-0.0.3 lib/nicoapi/core/base.rb
nicoapi-core-0.0.2 lib/nicoapi/core/base.rb
nicoapi-core-0.0.1 lib/nicoapi/core/base.rb