Class: Pushit::Request

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

Instance Method Summary collapse

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