Class: Rgcm::Message
- Inherits:
-
Object
- Object
- Rgcm::Message
- Defined in:
- lib/rgcm/message.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
-
#initialize(config = Rgcm::Config) ⇒ Message
constructor
A new instance of Message.
- #post(registration_ids, data, options = nil) ⇒ Object
Constructor Details
#initialize(config = Rgcm::Config) ⇒ Message
Returns a new instance of Message.
6 7 8 9 10 11 12 13 14 |
# File 'lib/rgcm/message.rb', line 6 def initialize(config = Rgcm::Config) if config.kind_of?(String) @api_key = config elsif config.kind_of?(Hash) @api_key = config[:api_key] elsif config.kind_of?(Class) @api_key = config.api_key end end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
4 5 6 |
# File 'lib/rgcm/message.rb', line 4 def api_key @api_key end |
Instance Method Details
#post(registration_ids, data, options = nil) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/rgcm/message.rb', line 16 def post(registration_ids, data, =nil) request = RequestBuilder.new(api_key, registration_ids, , data).build response = request.run Rgcm::Response.new(response.body) end |