Class: Pushwoosh::Request

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/pushwoosh/request.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, options = {}) ⇒ Request

Returns a new instance of Request.



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/pushwoosh/request.rb', line 14

def initialize(url, options = {})
  validations!(url, options)

  @options = options
  @notification_options = options.fetch(:notification_options)
  @url = url
  @base_request = {
    request: {
      application: options[:application],
      auth: options[:auth]
    }
  }
end

Class Method Details

.make_post!(*args) ⇒ Object



10
11
12
# File 'lib/pushwoosh/request.rb', line 10

def self.make_post!(*args)
  new(*args).make_post!
end

Instance Method Details

#make_post!Object



28
29
30
31
# File 'lib/pushwoosh/request.rb', line 28

def make_post!
  response = self.class.post(url, body: build_request.to_json).parsed_response
  Response.new(response)
end