Class: Giftwrap

Inherits:
Object
  • Object
show all
Defined in:
lib/giftwrap.rb,
lib/giftwrap/version.rb

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Constructor Details

#initialize(endpoint, *args, &block) ⇒ Giftwrap

Returns a new instance of Giftwrap.



4
5
6
# File 'lib/giftwrap.rb', line 4

def initialize(endpoint, *args, &block)
  @endpoint = endpoint
end

Instance Method Details

#get(path, params = {}) ⇒ Object



8
9
10
11
12
13
# File 'lib/giftwrap.rb', line 8

def get(path, params = {})
  path = "/api/#{path}.json?#{URI.encode_www_form(params)}"
  response = request(path)
  process(JSON.parse(response.body)) if response.code == "200"
rescue Exception => exception
end