Class: Getui::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/getui/message.rb,
lib/getui/message/transmission.rb

Direct Known Subclasses

Transmission

Defined Under Namespace

Classes: Transmission

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message_type, is_offline: true, offline_expire_time: 7 * 24 * 60 * 60, push_network_type: 0) ⇒ Message

Returns a new instance of Message.



4
5
6
7
8
9
10
11
# File 'lib/getui/message.rb', line 4

def initialize(message_type, is_offline: true, offline_expire_time: 7 * 24 * 60 * 60, push_network_type: 0)
  @transmission_type = 0
  @transmission_content = ""
  @message_type = message_type
  @is_offline = is_offline
  @offline_expire_time = offline_expire_time
  @push_network_type = push_network_type
end

Instance Attribute Details

#is_offlineObject

Returns the value of attribute is_offline.



3
4
5
# File 'lib/getui/message.rb', line 3

def is_offline
  @is_offline
end

#message_typeObject

Returns the value of attribute message_type.



3
4
5
# File 'lib/getui/message.rb', line 3

def message_type
  @message_type
end

#offline_expire_timeObject

Returns the value of attribute offline_expire_time.



3
4
5
# File 'lib/getui/message.rb', line 3

def offline_expire_time
  @offline_expire_time
end

#push_infoObject

Returns the value of attribute push_info.



3
4
5
# File 'lib/getui/message.rb', line 3

def push_info
  @push_info
end

#push_network_typeObject

Returns the value of attribute push_network_type.



3
4
5
# File 'lib/getui/message.rb', line 3

def push_network_type
  @push_network_type
end

#transmission_contentObject

Returns the value of attribute transmission_content.



3
4
5
# File 'lib/getui/message.rb', line 3

def transmission_content
  @transmission_content
end

#transmission_typeObject

Returns the value of attribute transmission_type.



3
4
5
# File 'lib/getui/message.rb', line 3

def transmission_type
  @transmission_type
end

Instance Method Details

#as_jsonObject



13
14
15
16
17
18
19
20
21
# File 'lib/getui/message.rb', line 13

def as_json
  {
   appkey: Getui.app_key,
   is_offline: self.is_offline,
   offline_expire_time: self.offline_expire_time,
   push_network_type: self.push_network_type,
   msgtype: message_type,
  }
end