Class: IGeTui::BaseTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/igetui/template/base_template.rb

Direct Known Subclasses

NotificationTemplate, TransmissionTemplate

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBaseTemplate

Returns a new instance of BaseTemplate.



5
6
7
# File 'lib/igetui/template/base_template.rb', line 5

def initialize
  @push_info = nil
end

Instance Attribute Details

#transmission_contentObject

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_typeObject

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_chainObject



22
# File 'lib/igetui/template/base_template.rb', line 22

def get_action_chain; end

#get_push_infoObject



25
26
27
28
29
30
31
32
33
34
# File 'lib/igetui/template/base_template.rb', line 25

def get_push_info
  unless @push_info
    @push_info = GtReq::PushInfo.new
    @push_info.actionKey = ''
    @push_info.badge = ''
    @push_info.message = ''
    @push_info.sound = ''
  end
  @push_info
end

#get_push_typeObject



23
# File 'lib/igetui/template/base_template.rb', line 23

def get_push_type; end

#get_transparent(pusher) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/igetui/template/base_template.rb', line 9

def get_transparent(pusher)
  transparent = GtReq::Transparent.new
  transparent.id = ''
  transparent.messageId = ''
  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, payload, loc_key, loc_args, launch_image) ⇒ Object

Need TEST:

iOS Pusher need the top three fields of 'push_info' are required.
the others can be blank string.


39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/igetui/template/base_template.rb', line 39

def set_push_info(action_loc_key, badge, message, sound, payload, loc_key, loc_args, launch_image)

  @push_info = GtReq::PushInfo.new
  @push_info.actionLocKey = action_loc_key
  @push_info.badge = badge
  @push_info.message = message
  @push_info.sound = sound if sound
  @push_info.payload = payload if payload
  @push_info.locKey = loc_key if loc_key
  @push_info.locArgs = loc_args if loc_args
  @push_info.launchImage = launch_image if launch_image

  args = {
    loc_key: loc_key,
    loc_args: locArgs,
    message: message,
    action_loc_key: action_loc_key,
    launch_image: launch_image,
    badge: badge,
    sound: sound,
    payload: payload
  }

  Validate.new.validate(args)
  @push_info
end