Class: RestClientPlus::Requests

Inherits:
Object
  • Object
show all
Defined in:
lib/rest_client_plus.rb

Class Method Summary collapse

Class Method Details

.get_json_from_url(input_url) ⇒ Object



18
19
20
21
22
# File 'lib/rest_client_plus.rb', line 18

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



6
7
8
9
10
# File 'lib/rest_client_plus.rb', line 6

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



12
13
14
15
16
# File 'lib/rest_client_plus.rb', line 12

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