Class: UmengMessage::Subject

Inherits:
Object
  • Object
show all
Defined in:
lib/umeng_message/subject.rb

Constant Summary collapse

CAST_TYPE =
%w|unicast listcast filecast broadcast groupcast customizedcast|
PUSH_URL =
'http://msg.umeng.com/api/send'
CHECK_URL =
'http://msg.umeng.com/api/status'
CANCEL_URL =
'http://msg.umeng.com/api/cancel'
UPLOAD_URL =
'http://msg.umeng.com/upload'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(platform, options) ⇒ Subject

Returns a new instance of Subject.



13
14
15
16
# File 'lib/umeng_message/subject.rb', line 13

def initialize(platform, options)
  @platform          = platform
  @options           = options
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



6
7
8
# File 'lib/umeng_message/subject.rb', line 6

def content
  @content
end

#error_codeObject (readonly)

Returns the value of attribute error_code.



6
7
8
# File 'lib/umeng_message/subject.rb', line 6

def error_code
  @error_code
end

#file_idObject (readonly)

Returns the value of attribute file_id.



6
7
8
# File 'lib/umeng_message/subject.rb', line 6

def file_id
  @file_id
end

#payloadObject (readonly)

Returns the value of attribute payload.



6
7
8
# File 'lib/umeng_message/subject.rb', line 6

def payload
  @payload
end

#platformObject (readonly)

Returns the value of attribute platform.



6
7
8
# File 'lib/umeng_message/subject.rb', line 6

def platform
  @platform
end

#retObject (readonly)

Returns the value of attribute ret.



6
7
8
# File 'lib/umeng_message/subject.rb', line 6

def ret
  @ret
end

#task_idObject (readonly)

Returns the value of attribute task_id.



6
7
8
# File 'lib/umeng_message/subject.rb', line 6

def task_id
  @task_id
end

Instance Method Details

#cancelObject



26
27
28
# File 'lib/umeng_message/subject.rb', line 26

def cancel
  post_youmeng(CANCEL_URL, Params.cancel_params(@platform, @options['task_id']))
end

#checkObject



22
23
24
# File 'lib/umeng_message/subject.rb', line 22

def check
  post_youmeng(CHECK_URL, Params.check_params(@platform, @options['task_id']))
end

#pushObject



18
19
20
# File 'lib/umeng_message/subject.rb', line 18

def push
  post_youmeng(PUSH_URL, Params.push_params(@platform, @options))
end

#uploadObject



30
31
32
# File 'lib/umeng_message/subject.rb', line 30

def upload
  post_youmeng(UPLOAD_URL, Params.upload_params(@platform, @options['content']))
end