Class: Giftwrap
- Inherits:
-
Object
- Object
- Giftwrap
- Defined in:
- lib/giftwrap.rb,
lib/giftwrap/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Instance Method Summary collapse
- #get(path, params = {}) ⇒ Object
-
#initialize(endpoint, *args, &block) ⇒ Giftwrap
constructor
A new instance of Giftwrap.
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 |