Module: RestClientPlus::Requests
- Defined in:
- lib/requests.rb
Class Method Summary collapse
- .get_json_from_url(input_url) ⇒ Object
- .post_json_to_url(input_url, json_body) ⇒ Object
- .put_json_to_url(input_url, json_body) ⇒ Object
Class Method Details
.get_json_from_url(input_url) ⇒ Object
17 18 19 20 21 |
# File 'lib/requests.rb', line 17 def self.get_json_from_url input_url response = RestClient.get(input_url) response.code.should == 200 JSON.parse response.body end |
.post_json_to_url(input_url, json_body) ⇒ Object
5 6 7 8 9 |
# File 'lib/requests.rb', line 5 def self.post_json_to_url input_url, json_body response = RestClient.post(input_url, json_body, :content_type => 'application/json') response.code.should == 200 JSON.parse response.body end |
.put_json_to_url(input_url, json_body) ⇒ Object
11 12 13 14 15 |
# File 'lib/requests.rb', line 11 def self.put_json_to_url input_url, json_body response = RestClient.put(input_url, json_body, :content_type => 'application/json') response.code.should == 200 JSON.parse response.body end |