Module: Mogreet::Request
- Defined in:
- lib/mogreet/request.rb
Instance Method Summary collapse
- #default_api_args ⇒ Object
- #get_request(path, query_params = {}) ⇒ Object
- #post_request(path, query_params = {}) ⇒ Object
Instance Method Details
#default_api_args ⇒ Object
15 16 17 |
# File 'lib/mogreet/request.rb', line 15 def default_api_args {:client_id => @client_id, :token => @token, :format => 'json'} end |
#get_request(path, query_params = {}) ⇒ Object
3 4 5 6 7 |
# File 'lib/mogreet/request.rb', line 3 def get_request(path, query_params = {}) params = default_api_args.merge(query_params) @http_response = RestClient.get("https://api.mogreet.com#{path}", {:params => params}) Response.new(JSON.parse(@http_response.body)).response end |
#post_request(path, query_params = {}) ⇒ Object
9 10 11 12 13 |
# File 'lib/mogreet/request.rb', line 9 def post_request(path, query_params = {}) params = default_api_args.merge(query_params) @http_response = RestClient.post("https://api.mogreet.com#{path}", params) Response.new(JSON.parse(@http_response.body)).response end |