Class: Localytics::Push
- Inherits:
-
Object
- Object
- Localytics::Push
- Defined in:
- lib/localytics/push.rb
Class Attribute Summary collapse
-
.app_id ⇒ Object
Returns the value of attribute app_id.
Class Method Summary collapse
-
.push(messages, target_type, app_id, campaing_key = nil, api_key = nil, api_secret = nil, headers = {}) ⇒ Object
Generic method to send push notifications thru Localytics.
-
.push_to_all_customers(messages, app_id, campaing_key = nil, api_key = nil, api_secret = nil) ⇒ Object
For :messages options please check the :push method.
- .push_to_audiences(messages, app_id, campaing_key = nil, api_key = nil, api_secret = nil) ⇒ Object
-
.push_to_customers(messages, app_id, campaing_key = nil, api_key = nil, api_secret = nil) ⇒ Object
For :messages options please check the :push method.
-
.push_to_profiles(messages, app_id, campaing_key = nil, api_key = nil, api_secret = nil) ⇒ Object
For :messages options please check the :push method.
Class Attribute Details
.app_id ⇒ Object
Returns the value of attribute app_id.
7 8 9 |
# File 'lib/localytics/push.rb', line 7 def app_id @app_id end |
Class Method Details
.push(messages, target_type, app_id, campaing_key = nil, api_key = nil, api_secret = nil, headers = {}) ⇒ Object
Generic method to send push notifications thru Localytics. Mandatory parameters:
-
:messages an array containing the push messages to send.
-
:target_type targeted resource. Available values are:
:customer_id :broadcast :profile :audience_id
Optional attributes are:
-
:api_key
-
:api_secret
-
:headers
More information on how messages can be built can be found on docs.localytics.com/#Dev/getting-started-trans-push.html
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/localytics/push.rb', line 25 def self.push(, target_type, app_id, campaing_key = nil, api_key=nil, api_secret=nil, headers={}) Localytics.request( api_base(app_id), :post, '', api_key, api_secret, { messages: , target_type: target_type, campaign_key: campaing_key, request_id: SecureRandom.uuid }, headers ) end |
.push_to_all_customers(messages, app_id, campaing_key = nil, api_key = nil, api_secret = nil) ⇒ Object
For :messages options please check the :push method
48 49 50 |
# File 'lib/localytics/push.rb', line 48 def self.push_to_all_customers(, app_id, campaing_key = nil, api_key=nil, api_secret=nil) push , 'broadcast', campaing_key, app_id, api_key, api_secret end |
.push_to_audiences(messages, app_id, campaing_key = nil, api_key = nil, api_secret = nil) ⇒ Object
57 58 59 |
# File 'lib/localytics/push.rb', line 57 def self.push_to_audiences(, app_id, campaing_key = nil, api_key=nil, api_secret=nil) push , 'audience_id', campaing_key, app_id, api_key, api_secret end |
.push_to_customers(messages, app_id, campaing_key = nil, api_key = nil, api_secret = nil) ⇒ Object
For :messages options please check the :push method
43 44 45 |
# File 'lib/localytics/push.rb', line 43 def self.push_to_customers(, app_id, campaing_key = nil, api_key=nil, api_secret=nil) push , 'customer_id', campaing_key, app_id, api_key, api_secret end |
.push_to_profiles(messages, app_id, campaing_key = nil, api_key = nil, api_secret = nil) ⇒ Object
For :messages options please check the :push method
53 54 55 |
# File 'lib/localytics/push.rb', line 53 def self.push_to_profiles(, app_id, campaing_key = nil, api_key=nil, api_secret=nil) push , 'profile', campaing_key, app_id, api_key, api_secret end |