Class: Baidu::Push::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/baidu/push/message.rb

Instance Method Summary collapse

Instance Method Details

#messages=(msg = {}) ⇒ Object



136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/baidu/push/message.rb', line 136

def messages=(msg = {})
  message = {}
  message[:title] = msg[:title].to_s
  message[:description] = msg[:description].to_s
  case device_type
    when 3
      message[:custom_content] = msg[:custom_content]
    when 4
      message[:aps] = msg[:aps]
      msg[:custom_content].each { |k, v| message[k] = v }
  end
  super(message.to_json)
end

#non_nil_attributesObject



132
133
134
# File 'lib/baidu/push/message.rb', line 132

def non_nil_attributes
  attributes.reject { |_, v| v.nil? }
end