Class: Pwush::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/pwush/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Client



5
6
7
# File 'lib/pwush/client.rb', line 5

def initialize(options)
  @config = Config.new(options)
end

Instance Method Details

#application_open(hwid) ⇒ Object



60
61
62
# File 'lib/pwush/client.rb', line 60

def application_open(hwid)
  post(:applicationOpen, hwid: hwid)
end

#applicationsObject

enterprise api



29
30
31
# File 'lib/pwush/client.rb', line 29

def applications
  post(:getApplications)
end

#create_message(*messages) ⇒ Object Also known as: push



9
10
11
# File 'lib/pwush/client.rb', line 9

def create_message(*messages)
  post(:createMessage, notifications: messages.flatten)
end

#create_test_device(params) ⇒ Object



48
49
50
# File 'lib/pwush/client.rb', line 48

def create_test_device(params)
  post(:createTestDevice, params)
end

#list_test_devicesObject



52
53
54
# File 'lib/pwush/client.rb', line 52

def list_test_devices
  post(:listTestDevices)
end

#message_delivery_event(hwid, hash_tag = nil) ⇒ Object



68
69
70
# File 'lib/pwush/client.rb', line 68

def message_delivery_event(hwid, hash_tag = nil)
  post(:messageDeliveryEvent, hwid: hwid, hash: hash_tag)
end

#message_details(message) ⇒ Object



14
15
16
# File 'lib/pwush/client.rb', line 14

def message_details(message)
  post(:getMessageDetails, message: message)
end

#message_stats(message) ⇒ Object

enterprise api



19
20
21
# File 'lib/pwush/client.rb', line 19

def message_stats(message)
  post(:getMsgStats, message: message)
end

#preset(preset_code) ⇒ Object

enterprise api



34
35
36
# File 'lib/pwush/client.rb', line 34

def preset(preset_code)
  post(:getPreset, preset_code: preset_code)
end

#push_stat(hwid, hash_tag = nil) ⇒ Object



64
65
66
# File 'lib/pwush/client.rb', line 64

def push_stat(hwid, hash_tag = nil)
  post(:pushStat, hwid: hwid, hash: hash_tag)
end

#register_device(params) ⇒ Object

DEVICE API



40
41
42
# File 'lib/pwush/client.rb', line 40

def register_device(params)
  post(:registerDevice, params)
end

#results(request_id) ⇒ Object

enterprise api



24
25
26
# File 'lib/pwush/client.rb', line 24

def results(request_id)
  post(:getResults,  request_id: request_id)
end

#set_badge(hwid, badge) ⇒ Object



56
57
58
# File 'lib/pwush/client.rb', line 56

def set_badge(hwid, badge)
  post(:setBadge, hwid: hwid, badge: badge)
end

#set_purchase(hwid, params = {}) ⇒ Object



72
73
74
# File 'lib/pwush/client.rb', line 72

def set_purchase(hwid, params = {})
  post(:setPurchase, params.merge(hwid: hwid))
end

#unregister_device(hwid) ⇒ Object



44
45
46
# File 'lib/pwush/client.rb', line 44

def unregister_device(hwid)
  post(:unregisterDevice, hwid: hwid)
end