module Connpass::Connection

Public Instance Methods

convert_response(json_str) click to toggle source
# File lib/connpass/connection.rb, line 14
def convert_response json_str
  Hashie::Mash.new(JSON.parse(json_str))
end
get(path, options = {}) click to toggle source
# File lib/connpass/connection.rb, line 8
def get path, options = {}
  url = "#{ENDPOINT}#{path}/"
  url = "#{url}?#{build_query(options)}" unless options.empty?
  URI.open(url).read
end

Private Instance Methods

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