Class: MpWeixin::ReplyMessage

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model, ROXML
Defined in:
lib/mp_weixin/models/reply_message.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ActiveModel::Model

included, #persisted?

Constructor Details

#initialize(attributes = {}) ⇒ ReplyMessage

Returns a new instance of ReplyMessage.



19
20
21
22
# File 'lib/mp_weixin/models/reply_message.rb', line 19

def initialize(attributes = {})
  super
  @CreateTime ||= Time.now.to_i
end

Instance Attribute Details

#CreateTimeObject

xml_convention :camelcase



11
12
13
# File 'lib/mp_weixin/models/reply_message.rb', line 11

def CreateTime
  @CreateTime
end

#FromUserNameObject

xml_convention :camelcase



11
12
13
# File 'lib/mp_weixin/models/reply_message.rb', line 11

def FromUserName
  @FromUserName
end

#MsgTypeObject

xml_convention :camelcase



11
12
13
# File 'lib/mp_weixin/models/reply_message.rb', line 11

def MsgType
  @MsgType
end

#ToUserNameObject

xml_convention :camelcase



11
12
13
# File 'lib/mp_weixin/models/reply_message.rb', line 11

def ToUserName
  @ToUserName
end

Class Method Details

.set_nested_attr(nested_attr_name) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/mp_weixin/models/reply_message.rb', line 29

def set_nested_attr(nested_attr_name)
  # define_method(:hi) { puts "Hello World!" }
  class_eval <<-STR
    def #{nested_attr_name}=(nested_attr = [])
      @#{nested_attr_name} = nested_attr.is_a?(#{nested_attr_name}) ? nested_attr : #{nested_attr_name}.new(nested_attr)
    end
  STR
end

Instance Method Details

#to_xmlObject



24
25
26
# File 'lib/mp_weixin/models/reply_message.rb', line 24

def to_xml
  super.to_xml(:encoding => 'UTF-8', :indent => 0, :save_with => 0)
end