Module: Getui
- Defined in:
- lib/getui.rb,
lib/getui/auth.rb,
lib/getui/apple.rb,
lib/getui/errors.rb,
lib/getui/message.rb,
lib/getui/request.rb,
lib/getui/request.rb,
lib/getui/request.rb,
lib/getui/version.rb,
lib/getui/message/transmission.rb
Defined Under Namespace
Modules: Auth Classes: Apns, GenerateAuthTokenError, GetRequest, Message, PostRequest, PushError, Request
Constant Summary collapse
- VERSION =
"0.1.4"
Class Attribute Summary collapse
-
.app_id ⇒ Object
Returns the value of attribute app_id.
-
.app_key ⇒ Object
Returns the value of attribute app_key.
-
.cache_backend ⇒ Object
Returns the value of attribute cache_backend.
-
.master_secret ⇒ Object
Returns the value of attribute master_secret.
Class Method Summary collapse
- .push_app(message) ⇒ Object
- .push_list(cids, taskid, need_detail = true) ⇒ Object
- .push_single(cid, message) ⇒ Object
- .save_list_body(message) ⇒ Object
- .user_status(cid) ⇒ Object
Class Attribute Details
.app_id ⇒ Object
Returns the value of attribute app_id.
15 16 17 |
# File 'lib/getui.rb', line 15 def app_id @app_id end |
.app_key ⇒ Object
Returns the value of attribute app_key.
15 16 17 |
# File 'lib/getui.rb', line 15 def app_key @app_key end |
.cache_backend ⇒ Object
Returns the value of attribute cache_backend.
15 16 17 |
# File 'lib/getui.rb', line 15 def cache_backend @cache_backend end |
.master_secret ⇒ Object
Returns the value of attribute master_secret.
15 16 17 |
# File 'lib/getui.rb', line 15 def master_secret @master_secret end |
Class Method Details
.push_app(message) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/getui.rb', line 42 def push_app() json = .as_json json[:requestid] = SecureRandom.uuid[0..29] resp = Getui::Request.post("https://restapi.getui.com/v1/#{Getui.app_id}/push_app", json) res = JSON.parse(resp.body) raise Getui::PushError.new("#{resp.body}") unless res["result"] == "ok" res end |
.push_list(cids, taskid, need_detail = true) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/getui.rb', line 34 def push_list(cids, taskid, need_detail = true) json = {cid: cids, taskid: taskid, need_detail: need_detail} resp = Getui::Request.post("https://restapi.getui.com/v1/#{Getui.app_id}/push_list", json) res = JSON.parse(resp.body) raise Getui::PushError.new("#{resp.body}") unless res["result"] == "ok" res end |
.push_single(cid, message) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/getui.rb', line 16 def push_single(cid, ) json = .as_json json[:cid] = cid json[:requestid] = SecureRandom.uuid[0..29] resp = Getui::Request.post("https://restapi.getui.com/v1/#{Getui.app_id}/push_single", json) res = JSON.parse(resp.body) raise Getui::PushError.new("#{resp.body}") unless res["result"] == "ok" return res end |
.save_list_body(message) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/getui.rb', line 26 def save_list_body() json = .as_json resp = Getui::Request.post("https://restapi.getui.com/v1/#{Getui.app_id}/save_list_body", json) res = JSON.parse(resp.body) raise Getui::PushError.new("#{resp.body}") unless res["result"] == "ok" return res["taskid"] end |