Class: Rest::Get

Inherits:
Object show all
Defined in:
lib/sh_util.rb

Instance Method Summary collapse

Constructor Details

#initialize(url, params = {}) ⇒ Get

Returns a new instance of Get.



26
27
28
29
30
# File 'lib/sh_util.rb', line 26

def initialize(url, params={})
  @url = url.dup
  @query = ''
  @query = build_query params
end

Instance Method Details

#[](params = {}) ⇒ Object



32
33
34
35
# File 'lib/sh_util.rb', line 32

def [](params={})
  query = build_query params
  open(@url + query).read
end