Class: Pushit::Request
- Inherits:
-
Object
- Object
- Pushit::Request
- Defined in:
- lib/pushit/request.rb
Instance Method Summary collapse
-
#initialize(type, url) ⇒ Request
constructor
A new instance of Request.
- #post(body) ⇒ Object
Constructor Details
#initialize(type, url) ⇒ Request
Returns a new instance of Request.
5 6 7 8 9 10 |
# File 'lib/pushit/request.rb', line 5 def initialize(type, url) @type = type @url = url @head = {} @head['Content-Type'] = 'application/json' end |
Instance Method Details
#post(body) ⇒ Object
12 13 14 15 16 |
# File 'lib/pushit/request.rb', line 12 def post(body) response = Net::HTTP.post_form(@url, body) handle_response(response.code.to_i, response.body) end |