Class: Rgcm::RequestBuilder
- Inherits:
-
Object
- Object
- Rgcm::RequestBuilder
- Defined in:
- lib/rgcm/request_builder.rb
Constant Summary collapse
- URI =
'https://android.googleapis.com/gcm/send'.freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#registration_ids ⇒ Object
readonly
Returns the value of attribute registration_ids.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(api_key, registration_ids, options, data) ⇒ RequestBuilder
constructor
A new instance of RequestBuilder.
Constructor Details
#initialize(api_key, registration_ids, options, data) ⇒ RequestBuilder
Returns a new instance of RequestBuilder.
8 9 10 11 12 13 |
# File 'lib/rgcm/request_builder.rb', line 8 def initialize(api_key, registration_ids, , data) @api_key = api_key @registration_ids = registration_ids.kind_of?(Array) ? registration_ids : [registration_ids] = @data = data end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
6 7 8 |
# File 'lib/rgcm/request_builder.rb', line 6 def api_key @api_key end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/rgcm/request_builder.rb', line 6 def data @data end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/rgcm/request_builder.rb', line 6 def end |
#registration_ids ⇒ Object (readonly)
Returns the value of attribute registration_ids.
6 7 8 |
# File 'lib/rgcm/request_builder.rb', line 6 def registration_ids @registration_ids end |
Instance Method Details
#build ⇒ Object
15 16 17 |
# File 'lib/rgcm/request_builder.rb', line 15 def build Typhoeus::Request.new(URI, headers: headers, method: :post, body: body.to_json, followlocation: true) end |