Module: Addressable::Rest
- Defined in:
- lib/addressable/rest.rb,
lib/addressable/rest/version.rb
Constant Summary collapse
- VERSION =
"0.0.3"
Instance Method Summary collapse
Instance Method Details
#get(options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/addressable/rest.rb', line 9 def get( = {}) url = dup.normalize response = Net::HTTP.start(url.host, url.port) do |request| request.get(url.request_uri) end = {} [:symbolize_keys] = true if [:symbolize_keys] MultiJson.decode(response.body, ) end |
#post(data, options = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/addressable/rest.rb', line 20 def post(data, = {}) url = dup.normalize response = Net::HTTP.start(url.host, url.port) do |request| request.post(url.request_uri, data.to_query) end = {} [:symbolize_keys] = true if [:symbolize_keys] MultiJson.decode(response.body, ) end |