Class: OneSignal::Request
- Inherits:
-
Object
- Object
- OneSignal::Request
- Defined in:
- lib/onesignal/request.rb
Instance Method Summary collapse
- #delete(path, params = {}) ⇒ Object
- #get(path, params = {}) ⇒ Object
-
#initialize(client) ⇒ Request
constructor
A new instance of Request.
- #post(path, params) ⇒ Object
- #put(path, params) ⇒ Object
Constructor Details
#initialize(client) ⇒ Request
Returns a new instance of Request.
5 6 7 |
# File 'lib/onesignal/request.rb', line 5 def initialize(client) @client = client end |
Instance Method Details
#delete(path, params = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/onesignal/request.rb', line 31 def delete(path, params = {}) uri = uri(path) if @client.app_id params[:app_id] = @client.app_id end uri.query = URI.encode_www_form(params) request(uri, Net::HTTP::Delete, params) end |
#get(path, params = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/onesignal/request.rb', line 9 def get(path, params = {}) uri = uri(path) if @client.app_id params[:app_id] = @client.app_id end uri.query = URI.encode_www_form(params) request(uri, Net::HTTP::Get) end |
#post(path, params) ⇒ Object
21 22 23 24 |
# File 'lib/onesignal/request.rb', line 21 def post(path, params) uri = uri(path) request(uri, Net::HTTP::Post, params) end |
#put(path, params) ⇒ Object
26 27 28 29 |
# File 'lib/onesignal/request.rb', line 26 def put(path, params) uri = uri(path) request(uri, Net::HTTP::Put, params) end |