module EventsJp::Connection

Public Instance Methods

get(endpoint, opt = {}) click to toggle source
# File lib/events_jp/connection.rb, line 8
def get(endpoint, opt = {})
  url = opt.empty? ? endpoint : "#{endpoint}?#{build_query(opt)}"
  open(url).read
end

Private Instance Methods

build_query(options = {}) click to toggle source
# File lib/events_jp/connection.rb, line 15
def build_query(options = {})
  options.to_a.map{|o| "#{o[0]}=#{CGI.escape(o[1].to_s)}" }.join('&')
end