Class: OneSignal::Player
- Defined in:
- lib/one_signal/player.rb
Constant Summary
Constants included from OneSignal
Class Method Summary collapse
- .all(params: {}) ⇒ Object
- .create(params: {}) ⇒ Object
- .create_focus(id: "", params: {}) ⇒ Object
- .create_purchase(id: "", params: {}) ⇒ Object
- .create_session(id: "", params: {}) ⇒ Object
- .csv_export(params: {}) ⇒ Object
- .get(id: "") ⇒ Object
- .update(id: "", params: {}) ⇒ Object
Class Method Details
.all(params: {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/one_signal/player.rb', line 21 def self.all(params: {}) uri_string = @@base_uri uri_string += "/players" uri = URI.parse(uri_string) response = send_get_request(uri: uri, params: params) ensure_http_status(response: response, status: '200', method_name: 'All', uri: uri, params: params) return response end |
.create(params: {}) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/one_signal/player.rb', line 54 def self.create(params: {}) uri_string = @@base_uri uri_string += "/players" uri = URI.parse(uri_string) response = send_post_request(uri: uri, body: params) ensure_http_status(response: response, status: '200', method_name: 'Create', uri: uri, params: params) return response end |
.create_focus(id: "", params: {}) ⇒ Object
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/one_signal/player.rb', line 106 def self.create_focus(id: "", params: {}) uri_string = @@base_uri uri_string += "/players" uri_string += "/#{id}" uri_string += "/on_focus" uri = URI.parse(uri_string) response = send_post_request(uri: uri, body: params) ensure_http_status(response: response, status: '200', method_name: 'Create Focus', uri: uri, params: params) return response end |
.create_purchase(id: "", params: {}) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/one_signal/player.rb', line 88 def self.create_purchase(id: "", params: {}) uri_string = @@base_uri uri_string += "/players" uri_string += "/#{id}" uri_string += "/on_purchase" uri = URI.parse(uri_string) response = send_post_request(uri: uri, body: params) ensure_http_status(response: response, status: '200', method_name: 'Create Purchase', uri: uri, params: params) return response end |
.create_session(id: "", params: {}) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/one_signal/player.rb', line 70 def self.create_session(id: "", params: {}) uri_string = @@base_uri uri_string += "/players" uri_string += "/#{id}" uri_string += "/on_session" uri = URI.parse(uri_string) response = send_post_request(uri: uri, body: params) ensure_http_status(response: response, status: '200', method_name: 'Create Session', uri: uri, params: params) return response end |
.csv_export(params: {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/one_signal/player.rb', line 5 def self.csv_export(params: {}) uri_string = @@base_uri uri_string += "/players/csv_export" uri = URI.parse(uri_string) response = send_post_request(uri: uri, body: params) ensure_http_status(response: response, status: '200', method_name: 'CSV Export', uri: uri, params: {}) return response end |
.get(id: "") ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/one_signal/player.rb', line 37 def self.get(id: "") uri_string = @@base_uri uri_string += "/players" uri_string += "/#{id}" uri = URI.parse(uri_string) response = send_get_request(uri: uri, params: nil) ensure_http_status(response: response, status: '200', method_name: 'Get', uri: uri, params: nil) return response end |
.update(id: "", params: {}) ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/one_signal/player.rb', line 124 def self.update(id: "", params: {}) uri_string = @@base_uri uri_string += "/players" uri_string += "/#{id}" uri = URI.parse(uri_string) response = send_put_request(uri: uri, body: params) ensure_http_status(response: response, status: '200', method_name: 'Update', uri: uri, params: params) return response end |