Class: Rakuten::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/rakuten/api/request.rb

Class Method Summary collapse

Class Method Details

.get(path, opts) ⇒ Object



5
6
7
8
9
10
# File 'lib/rakuten/api/request.rb', line 5

def self.get(path,opts)
  uri = URI.parse("#{path}?#{opts.map {|k,v|"#{k}=#{CGI.escape(v)}"}.join('&')}")
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = uri.instance_of?(URI::HTTPS)
  Rakuten::Response.new(http.start {http.get(uri.request_uri)})
end