Class: IGeTui::BaseTemplate
- Inherits:
-
Object
- Object
- IGeTui::BaseTemplate
- Defined in:
- lib/igetui/template/base_template.rb
Direct Known Subclasses
LinkTemplate, NotificationTemplate, NotyPopLoadTemplate, TransmissionTemplate
Instance Attribute Summary collapse
-
#push_info ⇒ Object
Returns the value of attribute push_info.
-
#transmission_content ⇒ Object
Returns the value of attribute transmission_content.
-
#transmission_type ⇒ Object
Returns the value of attribute transmission_type.
Instance Method Summary collapse
- #get_action_chain ⇒ Object
- #get_client_data(pusher) ⇒ Object
- #get_push_info ⇒ Object
- #get_push_type ⇒ Object
- #get_transparent(pusher) ⇒ Object
-
#initialize ⇒ BaseTemplate
constructor
A new instance of BaseTemplate.
-
#set_push_info(action_loc_key, badge, message, sound, options = {}) ⇒ Object
NOTE: iOS Pusher need the top four fields of ‘push_info’ are required.
Constructor Details
#initialize ⇒ BaseTemplate
Returns a new instance of BaseTemplate.
5 6 7 8 |
# File 'lib/igetui/template/base_template.rb', line 5 def initialize @transmission_type = 0 @transmission_content = '' end |
Instance Attribute Details
#push_info ⇒ Object
Returns the value of attribute push_info.
3 4 5 |
# File 'lib/igetui/template/base_template.rb', line 3 def push_info @push_info end |
#transmission_content ⇒ Object
Returns the value of attribute transmission_content.
3 4 5 |
# File 'lib/igetui/template/base_template.rb', line 3 def transmission_content @transmission_content end |
#transmission_type ⇒ Object
Returns the value of attribute transmission_type.
3 4 5 |
# File 'lib/igetui/template/base_template.rb', line 3 def transmission_type @transmission_type end |
Instance Method Details
#get_action_chain ⇒ Object
23 24 25 |
# File 'lib/igetui/template/base_template.rb', line 23 def get_action_chain raise NotImplementedError, 'Must be implemented by subtypes.' end |
#get_client_data(pusher) ⇒ Object
31 32 33 34 |
# File 'lib/igetui/template/base_template.rb', line 31 def get_client_data(pusher) string = self.get_transparent(pusher).serialize_to_string Base64.strict_encode64 string end |
#get_push_info ⇒ Object
36 37 38 |
# File 'lib/igetui/template/base_template.rb', line 36 def get_push_info @push_info || init_push_info end |
#get_push_type ⇒ Object
27 28 29 |
# File 'lib/igetui/template/base_template.rb', line 27 def get_push_type raise NotImplementedError, 'Must be implemented by subtypes.' end |
#get_transparent(pusher) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/igetui/template/base_template.rb', line 10 def get_transparent(pusher) transparent = GtReq::Transparent.new transparent.id = '' transparent. = '' transparent.taskId = '' transparent.action = 'pushmessage' transparent.actionChain = get_action_chain transparent.pushInfo = get_push_info transparent.appId = pusher.app_id transparent.appKey = pusher.app_key transparent end |
#set_push_info(action_loc_key, badge, message, sound, options = {}) ⇒ Object
NOTE: iOS Pusher need the top four fields of ‘push_info’ are required. options can be includes [:payload, :loc_key, :loc_args, :launch_image] docs.igetui.com/pages/viewpage.action?pageId=590588
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/igetui/template/base_template.rb', line 44 def set_push_info(action_loc_key, badge, , sound, = {}) init_push_info @push_info.actionLocKey = action_loc_key @push_info.badge = badge.to_s @push_info. = @push_info.sound = sound @push_info.payload = [:payload] @push_info.locKey = [:loc_key] @push_info.locArgs = [:loc_args] @push_info.launchImage = [:launch_image] # validate method need refactoring. # Validate.new.validate(args) end |