onesignal 0.2.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +14 -0
  3. data/Gemfile +6 -1
  4. data/LICENSE +6 -3
  5. data/README.md +144 -99
  6. data/RELEASE_INSTRUCTIONS.md +11 -0
  7. data/Rakefile +8 -8
  8. data/docs/App.md +76 -0
  9. data/docs/Button.md +22 -0
  10. data/docs/DefaultApi.md +1394 -0
  11. data/docs/DeliveryData.md +26 -0
  12. data/docs/ExportPlayersRequestBody.md +22 -0
  13. data/docs/Filter.md +24 -0
  14. data/docs/FilterExpressions.md +26 -0
  15. data/docs/FilterNotificationTarget.md +40 -0
  16. data/docs/GetNotificationRequestBody.md +22 -0
  17. data/docs/InlineResponse200.md +24 -0
  18. data/docs/InlineResponse2001.md +18 -0
  19. data/docs/InlineResponse2002.md +20 -0
  20. data/docs/InlineResponse2005.md +20 -0
  21. data/docs/InlineResponse2007.md +18 -0
  22. data/docs/InlineResponse2008.md +18 -0
  23. data/docs/InlineResponse201.md +20 -0
  24. data/docs/InlineResponse400.md +18 -0
  25. data/docs/InlineResponse4001.md +20 -0
  26. data/docs/InlineResponse4002.md +20 -0
  27. data/docs/InlineResponse4003.md +18 -0
  28. data/docs/InvalidIdentifierError.md +20 -0
  29. data/docs/Notification.md +240 -0
  30. data/docs/Notification200Errors.md +49 -0
  31. data/docs/NotificationAllOf.md +192 -0
  32. data/docs/NotificationAllOfAndroidBackgroundLayout.md +22 -0
  33. data/docs/NotificationSlice.md +24 -0
  34. data/docs/NotificationTarget.md +64 -0
  35. data/docs/NotificationWithMeta.md +260 -0
  36. data/docs/NotificationWithMetaAllOf.md +38 -0
  37. data/docs/Operator.md +18 -0
  38. data/docs/OutcomeData.md +22 -0
  39. data/docs/OutcomesData.md +18 -0
  40. data/docs/PlatformDeliveryData.md +28 -0
  41. data/docs/Player.md +70 -0
  42. data/docs/PlayerNotificationTarget.md +36 -0
  43. data/docs/PlayerSlice.md +24 -0
  44. data/docs/Purchase.md +22 -0
  45. data/docs/Segment.md +22 -0
  46. data/docs/SegmentNotificationTarget.md +20 -0
  47. data/docs/StringMap.md +102 -0
  48. data/docs/UpdatePlayerTagsRequestBody.md +18 -0
  49. data/lib/onesignal/api/default_api.rb +1365 -0
  50. data/lib/onesignal/api_client.rb +393 -0
  51. data/lib/onesignal/api_error.rb +57 -0
  52. data/lib/onesignal/configuration.rb +245 -0
  53. data/lib/onesignal/models/app.rb +519 -20
  54. data/lib/onesignal/models/button.rb +242 -0
  55. data/lib/onesignal/models/delivery_data.rb +260 -0
  56. data/lib/onesignal/models/export_players_request_body.rb +242 -0
  57. data/lib/onesignal/models/filter.rb +294 -0
  58. data/lib/onesignal/models/filter_expressions.rb +336 -0
  59. data/lib/onesignal/models/filter_notification_target.rb +330 -0
  60. data/lib/onesignal/models/get_notification_request_body.rb +273 -0
  61. data/lib/onesignal/models/inline_response200.rb +257 -0
  62. data/lib/onesignal/models/inline_response2001.rb +219 -0
  63. data/lib/onesignal/models/inline_response2002.rb +228 -0
  64. data/lib/onesignal/models/inline_response2005.rb +228 -0
  65. data/lib/onesignal/models/inline_response2007.rb +219 -0
  66. data/lib/onesignal/models/inline_response2008.rb +219 -0
  67. data/lib/onesignal/models/inline_response201.rb +229 -0
  68. data/lib/onesignal/models/inline_response400.rb +221 -0
  69. data/lib/onesignal/models/inline_response4001.rb +230 -0
  70. data/lib/onesignal/models/inline_response4002.rb +230 -0
  71. data/lib/onesignal/models/inline_response4003.rb +221 -0
  72. data/lib/onesignal/models/invalid_identifier_error.rb +234 -0
  73. data/lib/onesignal/models/notification.rb +1414 -9
  74. data/lib/onesignal/models/notification200_errors.rb +105 -0
  75. data/lib/onesignal/models/notification_all_of.rb +1144 -0
  76. data/lib/onesignal/models/notification_all_of_android_background_layout.rb +241 -0
  77. data/lib/onesignal/models/notification_slice.rb +248 -0
  78. data/lib/onesignal/models/notification_target.rb +495 -0
  79. data/lib/onesignal/models/notification_with_meta.rb +1526 -0
  80. data/lib/onesignal/models/notification_with_meta_all_of.rb +322 -0
  81. data/lib/onesignal/models/operator.rb +254 -0
  82. data/lib/onesignal/models/outcome_data.rb +286 -0
  83. data/lib/onesignal/models/outcomes_data.rb +221 -0
  84. data/lib/onesignal/models/platform_delivery_data.rb +265 -0
  85. data/lib/onesignal/models/player.rb +480 -13
  86. data/lib/onesignal/models/player_notification_target.rb +330 -0
  87. data/lib/onesignal/models/player_slice.rb +248 -0
  88. data/lib/onesignal/models/purchase.rb +255 -0
  89. data/lib/onesignal/models/segment.rb +252 -0
  90. data/lib/onesignal/models/segment_notification_target.rb +234 -0
  91. data/lib/onesignal/models/string_map.rb +640 -0
  92. data/lib/onesignal/models/update_player_tags_request_body.rb +220 -0
  93. data/lib/onesignal/version.rb +13 -1
  94. data/lib/onesignal.rb +73 -16
  95. data/onesignal.gemspec +37 -27
  96. data/spec/api/default_api_spec.rb +285 -0
  97. data/spec/api_client_spec.rb +226 -0
  98. data/spec/configuration_spec.rb +42 -0
  99. data/spec/models/app_spec.rb +212 -0
  100. data/spec/models/button_spec.rb +46 -0
  101. data/spec/models/delivery_data_spec.rb +58 -0
  102. data/spec/models/export_players_request_body_spec.rb +46 -0
  103. data/spec/models/filter_expressions_spec.rb +66 -0
  104. data/spec/models/filter_notification_target_spec.rb +100 -0
  105. data/spec/models/filter_spec.rb +56 -0
  106. data/spec/models/get_notification_request_body_spec.rb +50 -0
  107. data/spec/models/inline_response2001_spec.rb +34 -0
  108. data/spec/models/inline_response2002_spec.rb +40 -0
  109. data/spec/models/inline_response2005_spec.rb +40 -0
  110. data/spec/models/inline_response2007_spec.rb +34 -0
  111. data/spec/models/inline_response2008_spec.rb +34 -0
  112. data/spec/models/inline_response200_spec.rb +52 -0
  113. data/spec/models/inline_response201_spec.rb +40 -0
  114. data/spec/models/inline_response4001_spec.rb +40 -0
  115. data/spec/models/inline_response4002_spec.rb +40 -0
  116. data/spec/models/inline_response4003_spec.rb +34 -0
  117. data/spec/models/inline_response400_spec.rb +34 -0
  118. data/spec/models/invalid_identifier_error_spec.rb +40 -0
  119. data/spec/models/notification200_errors_spec.rb +31 -0
  120. data/spec/models/notification_all_of_android_background_layout_spec.rb +46 -0
  121. data/spec/models/notification_all_of_spec.rb +560 -0
  122. data/spec/models/notification_slice_spec.rb +52 -0
  123. data/spec/models/notification_spec.rb +704 -0
  124. data/spec/models/notification_target_spec.rb +172 -0
  125. data/spec/models/notification_with_meta_all_of_spec.rb +94 -0
  126. data/spec/models/notification_with_meta_spec.rb +764 -0
  127. data/spec/models/operator_spec.rb +38 -0
  128. data/spec/models/outcome_data_spec.rb +50 -0
  129. data/spec/models/outcomes_data_spec.rb +34 -0
  130. data/spec/models/platform_delivery_data_spec.rb +64 -0
  131. data/spec/models/player_notification_target_spec.rb +88 -0
  132. data/spec/models/player_slice_spec.rb +52 -0
  133. data/spec/models/player_spec.rb +190 -0
  134. data/spec/models/purchase_spec.rb +46 -0
  135. data/spec/models/segment_notification_target_spec.rb +40 -0
  136. data/spec/models/segment_spec.rb +46 -0
  137. data/spec/models/string_map_spec.rb +286 -0
  138. data/spec/models/update_player_tags_request_body_spec.rb +34 -0
  139. data/spec/spec_helper.rb +111 -0
  140. metadata +203 -64
  141. data/.gitignore +0 -10
  142. data/.rubocop.yml +0 -17
  143. data/.travis.yml +0 -16
  144. data/CODE_OF_CONDUCT.md +0 -49
  145. data/bin/console +0 -14
  146. data/bin/setup +0 -8
  147. data/lib/onesignal/app_id_missing_error.rb +0 -7
  148. data/lib/onesignal/client.rb +0 -44
  149. data/lib/onesignal/models/base_model.rb +0 -19
  150. data/lib/onesignal/request.rb +0 -94
  151. data/lib/onesignal/request_error.rb +0 -21
  152. data/lib/onesignal/resources/app_resource.rb +0 -27
  153. data/lib/onesignal/resources/base_resource.rb +0 -35
  154. data/lib/onesignal/resources/notification_resource.rb +0 -33
  155. data/lib/onesignal/resources/player_resource.rb +0 -53
metadata CHANGED
@@ -1,109 +1,205 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onesignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
- - Bastian Bartmann
8
- autorequire:
9
- bindir: exe
7
+ - OneSignal
8
+ autorequire:
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-29 00:00:00.000000000 Z
11
+ date: 2022-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: typhoeus
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.11'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.11'
27
- - !ruby/object:Gem::Dependency
28
- name: minitest
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
19
+ version: '1.0'
20
+ - - ">="
32
21
  - !ruby/object:Gem::Version
33
- version: '5.0'
34
- type: :development
22
+ version: 1.0.1
23
+ type: :runtime
35
24
  prerelease: false
36
25
  version_requirements: !ruby/object:Gem::Requirement
37
26
  requirements:
38
27
  - - "~>"
39
28
  - !ruby/object:Gem::Version
40
- version: '5.0'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
29
+ version: '1.0'
30
+ - - ">="
46
31
  - !ruby/object:Gem::Version
47
- version: '10.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '10.0'
32
+ version: 1.0.1
55
33
  - !ruby/object:Gem::Dependency
56
- name: webmock
34
+ name: rspec
57
35
  requirement: !ruby/object:Gem::Requirement
58
36
  requirements:
59
37
  - - "~>"
60
38
  - !ruby/object:Gem::Version
61
- version: '1.24'
39
+ version: '3.6'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 3.6.0
62
43
  type: :development
63
44
  prerelease: false
64
45
  version_requirements: !ruby/object:Gem::Requirement
65
46
  requirements:
66
47
  - - "~>"
67
48
  - !ruby/object:Gem::Version
68
- version: '1.24'
69
- description: Simple wrapper for the OneSignal API.
49
+ version: '3.6'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 3.6.0
53
+ description: OneSignal
70
54
  email:
71
- - babartmann@gmail.com
55
+ - devrel@onesignal.com
72
56
  executables: []
73
57
  extensions: []
74
58
  extra_rdoc_files: []
75
59
  files:
76
- - ".gitignore"
77
- - ".rubocop.yml"
78
- - ".travis.yml"
79
60
  - CHANGELOG.md
80
- - CODE_OF_CONDUCT.md
81
61
  - Gemfile
82
62
  - LICENSE
83
63
  - README.md
64
+ - RELEASE_INSTRUCTIONS.md
84
65
  - Rakefile
85
- - bin/console
86
- - bin/setup
66
+ - docs/App.md
67
+ - docs/Button.md
68
+ - docs/DefaultApi.md
69
+ - docs/DeliveryData.md
70
+ - docs/ExportPlayersRequestBody.md
71
+ - docs/Filter.md
72
+ - docs/FilterExpressions.md
73
+ - docs/FilterNotificationTarget.md
74
+ - docs/GetNotificationRequestBody.md
75
+ - docs/InlineResponse200.md
76
+ - docs/InlineResponse2001.md
77
+ - docs/InlineResponse2002.md
78
+ - docs/InlineResponse2005.md
79
+ - docs/InlineResponse2007.md
80
+ - docs/InlineResponse2008.md
81
+ - docs/InlineResponse201.md
82
+ - docs/InlineResponse400.md
83
+ - docs/InlineResponse4001.md
84
+ - docs/InlineResponse4002.md
85
+ - docs/InlineResponse4003.md
86
+ - docs/InvalidIdentifierError.md
87
+ - docs/Notification.md
88
+ - docs/Notification200Errors.md
89
+ - docs/NotificationAllOf.md
90
+ - docs/NotificationAllOfAndroidBackgroundLayout.md
91
+ - docs/NotificationSlice.md
92
+ - docs/NotificationTarget.md
93
+ - docs/NotificationWithMeta.md
94
+ - docs/NotificationWithMetaAllOf.md
95
+ - docs/Operator.md
96
+ - docs/OutcomeData.md
97
+ - docs/OutcomesData.md
98
+ - docs/PlatformDeliveryData.md
99
+ - docs/Player.md
100
+ - docs/PlayerNotificationTarget.md
101
+ - docs/PlayerSlice.md
102
+ - docs/Purchase.md
103
+ - docs/Segment.md
104
+ - docs/SegmentNotificationTarget.md
105
+ - docs/StringMap.md
106
+ - docs/UpdatePlayerTagsRequestBody.md
87
107
  - lib/onesignal.rb
88
- - lib/onesignal/app_id_missing_error.rb
89
- - lib/onesignal/client.rb
108
+ - lib/onesignal/api/default_api.rb
109
+ - lib/onesignal/api_client.rb
110
+ - lib/onesignal/api_error.rb
111
+ - lib/onesignal/configuration.rb
90
112
  - lib/onesignal/models/app.rb
91
- - lib/onesignal/models/base_model.rb
113
+ - lib/onesignal/models/button.rb
114
+ - lib/onesignal/models/delivery_data.rb
115
+ - lib/onesignal/models/export_players_request_body.rb
116
+ - lib/onesignal/models/filter.rb
117
+ - lib/onesignal/models/filter_expressions.rb
118
+ - lib/onesignal/models/filter_notification_target.rb
119
+ - lib/onesignal/models/get_notification_request_body.rb
120
+ - lib/onesignal/models/inline_response200.rb
121
+ - lib/onesignal/models/inline_response2001.rb
122
+ - lib/onesignal/models/inline_response2002.rb
123
+ - lib/onesignal/models/inline_response2005.rb
124
+ - lib/onesignal/models/inline_response2007.rb
125
+ - lib/onesignal/models/inline_response2008.rb
126
+ - lib/onesignal/models/inline_response201.rb
127
+ - lib/onesignal/models/inline_response400.rb
128
+ - lib/onesignal/models/inline_response4001.rb
129
+ - lib/onesignal/models/inline_response4002.rb
130
+ - lib/onesignal/models/inline_response4003.rb
131
+ - lib/onesignal/models/invalid_identifier_error.rb
92
132
  - lib/onesignal/models/notification.rb
133
+ - lib/onesignal/models/notification200_errors.rb
134
+ - lib/onesignal/models/notification_all_of.rb
135
+ - lib/onesignal/models/notification_all_of_android_background_layout.rb
136
+ - lib/onesignal/models/notification_slice.rb
137
+ - lib/onesignal/models/notification_target.rb
138
+ - lib/onesignal/models/notification_with_meta.rb
139
+ - lib/onesignal/models/notification_with_meta_all_of.rb
140
+ - lib/onesignal/models/operator.rb
141
+ - lib/onesignal/models/outcome_data.rb
142
+ - lib/onesignal/models/outcomes_data.rb
143
+ - lib/onesignal/models/platform_delivery_data.rb
93
144
  - lib/onesignal/models/player.rb
94
- - lib/onesignal/request.rb
95
- - lib/onesignal/request_error.rb
96
- - lib/onesignal/resources/app_resource.rb
97
- - lib/onesignal/resources/base_resource.rb
98
- - lib/onesignal/resources/notification_resource.rb
99
- - lib/onesignal/resources/player_resource.rb
145
+ - lib/onesignal/models/player_notification_target.rb
146
+ - lib/onesignal/models/player_slice.rb
147
+ - lib/onesignal/models/purchase.rb
148
+ - lib/onesignal/models/segment.rb
149
+ - lib/onesignal/models/segment_notification_target.rb
150
+ - lib/onesignal/models/string_map.rb
151
+ - lib/onesignal/models/update_player_tags_request_body.rb
100
152
  - lib/onesignal/version.rb
101
153
  - onesignal.gemspec
102
- homepage: https://github.com/coding-chimp/onesignal
154
+ - spec/api/default_api_spec.rb
155
+ - spec/api_client_spec.rb
156
+ - spec/configuration_spec.rb
157
+ - spec/models/app_spec.rb
158
+ - spec/models/button_spec.rb
159
+ - spec/models/delivery_data_spec.rb
160
+ - spec/models/export_players_request_body_spec.rb
161
+ - spec/models/filter_expressions_spec.rb
162
+ - spec/models/filter_notification_target_spec.rb
163
+ - spec/models/filter_spec.rb
164
+ - spec/models/get_notification_request_body_spec.rb
165
+ - spec/models/inline_response2001_spec.rb
166
+ - spec/models/inline_response2002_spec.rb
167
+ - spec/models/inline_response2005_spec.rb
168
+ - spec/models/inline_response2007_spec.rb
169
+ - spec/models/inline_response2008_spec.rb
170
+ - spec/models/inline_response200_spec.rb
171
+ - spec/models/inline_response201_spec.rb
172
+ - spec/models/inline_response4001_spec.rb
173
+ - spec/models/inline_response4002_spec.rb
174
+ - spec/models/inline_response4003_spec.rb
175
+ - spec/models/inline_response400_spec.rb
176
+ - spec/models/invalid_identifier_error_spec.rb
177
+ - spec/models/notification200_errors_spec.rb
178
+ - spec/models/notification_all_of_android_background_layout_spec.rb
179
+ - spec/models/notification_all_of_spec.rb
180
+ - spec/models/notification_slice_spec.rb
181
+ - spec/models/notification_spec.rb
182
+ - spec/models/notification_target_spec.rb
183
+ - spec/models/notification_with_meta_all_of_spec.rb
184
+ - spec/models/notification_with_meta_spec.rb
185
+ - spec/models/operator_spec.rb
186
+ - spec/models/outcome_data_spec.rb
187
+ - spec/models/outcomes_data_spec.rb
188
+ - spec/models/platform_delivery_data_spec.rb
189
+ - spec/models/player_notification_target_spec.rb
190
+ - spec/models/player_slice_spec.rb
191
+ - spec/models/player_spec.rb
192
+ - spec/models/purchase_spec.rb
193
+ - spec/models/segment_notification_target_spec.rb
194
+ - spec/models/segment_spec.rb
195
+ - spec/models/string_map_spec.rb
196
+ - spec/models/update_player_tags_request_body_spec.rb
197
+ - spec/spec_helper.rb
198
+ homepage: https://onesignal.com/
103
199
  licenses:
104
- - MIT
200
+ - Modified MIT
105
201
  metadata: {}
106
- post_install_message:
202
+ post_install_message:
107
203
  rdoc_options: []
108
204
  require_paths:
109
205
  - lib
@@ -111,16 +207,59 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
207
  requirements:
112
208
  - - ">="
113
209
  - !ruby/object:Gem::Version
114
- version: 2.0.0
210
+ version: '2.4'
115
211
  required_rubygems_version: !ruby/object:Gem::Requirement
116
212
  requirements:
117
213
  - - ">="
118
214
  - !ruby/object:Gem::Version
119
215
  version: '0'
120
216
  requirements: []
121
- rubyforge_project:
122
- rubygems_version: 2.5.1
123
- signing_key:
217
+ rubygems_version: 3.3.11
218
+ signing_key:
124
219
  specification_version: 4
125
- summary: Simple wrapper for the OneSignal API.
126
- test_files: []
220
+ summary: OneSignal
221
+ test_files:
222
+ - spec/api/default_api_spec.rb
223
+ - spec/api_client_spec.rb
224
+ - spec/configuration_spec.rb
225
+ - spec/models/notification_spec.rb
226
+ - spec/models/notification_target_spec.rb
227
+ - spec/models/inline_response2002_spec.rb
228
+ - spec/models/filter_notification_target_spec.rb
229
+ - spec/models/get_notification_request_body_spec.rb
230
+ - spec/models/update_player_tags_request_body_spec.rb
231
+ - spec/models/segment_spec.rb
232
+ - spec/models/delivery_data_spec.rb
233
+ - spec/models/inline_response2008_spec.rb
234
+ - spec/models/segment_notification_target_spec.rb
235
+ - spec/models/inline_response2001_spec.rb
236
+ - spec/models/player_slice_spec.rb
237
+ - spec/models/outcome_data_spec.rb
238
+ - spec/models/string_map_spec.rb
239
+ - spec/models/player_spec.rb
240
+ - spec/models/player_notification_target_spec.rb
241
+ - spec/models/filter_expressions_spec.rb
242
+ - spec/models/button_spec.rb
243
+ - spec/models/notification_all_of_android_background_layout_spec.rb
244
+ - spec/models/inline_response4001_spec.rb
245
+ - spec/models/operator_spec.rb
246
+ - spec/models/inline_response2005_spec.rb
247
+ - spec/models/export_players_request_body_spec.rb
248
+ - spec/models/notification_with_meta_spec.rb
249
+ - spec/models/notification_slice_spec.rb
250
+ - spec/models/notification_all_of_spec.rb
251
+ - spec/models/purchase_spec.rb
252
+ - spec/models/app_spec.rb
253
+ - spec/models/outcomes_data_spec.rb
254
+ - spec/models/notification200_errors_spec.rb
255
+ - spec/models/inline_response4002_spec.rb
256
+ - spec/models/inline_response200_spec.rb
257
+ - spec/models/inline_response201_spec.rb
258
+ - spec/models/inline_response4003_spec.rb
259
+ - spec/models/invalid_identifier_error_spec.rb
260
+ - spec/models/notification_with_meta_all_of_spec.rb
261
+ - spec/models/filter_spec.rb
262
+ - spec/models/platform_delivery_data_spec.rb
263
+ - spec/models/inline_response2007_spec.rb
264
+ - spec/models/inline_response400_spec.rb
265
+ - spec/spec_helper.rb
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- test.rb
data/.rubocop.yml DELETED
@@ -1,17 +0,0 @@
1
- AllCops:
2
- TargetRubyVersion: 2.1
3
-
4
- ClassLength:
5
- Enabled: false
6
-
7
- Documentation:
8
- Enabled: false
9
-
10
- IfUnlessModifier:
11
- Enabled: false
12
-
13
- MethodLength:
14
- Enabled: false
15
-
16
- NumericLiterals:
17
- Enabled: false
data/.travis.yml DELETED
@@ -1,16 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
-
4
- rvm:
5
- - 2.0.0
6
- - 2.1.0
7
- - 2.2.0
8
- - 2.3.0
9
-
10
- before_install:
11
- - gem install bundler -v 1.11.2
12
-
13
- notifications:
14
- slack:
15
- rooms:
16
- secure: Gr8OCGVXegUFZmA0GYQnvAMs6cei1139C7sce13VvcG1HulIvpidnobJuNghfTx44psQTYDptHpz8AVn+kChbsQ46+0zXdNgCq2t9fJAVzTlTGnsB5O28FjUUEJAppjztUeRPKJX+B284AHJ0ZM/Vw7upoJ9IPbJ9bpcr5Xbms8eF/iYmJcicZ7iZNkHET8PFKqQP4H4/ahBOHfiI150zys1Pjos66wRukss1K52i6cvGmMajx58aVxDdwrw8wksNOHFu7VuoThipNHTIFyzr39EdG+DDrrfDLkLtpcb4+3QFn3/XZO7WHNfubnUY2DQ9xZrn8mUgIBFx6bVbcZ+xt/eh+4h5cDQyeEFY3GI+GiWJBDQa8VS69+CZQqEAvBNzHMPAkp19DZt0KFPEQqNG7KwXwuMx/kVsbnDhSGGN7d1Dc2m1XXVHViOUS6YePPzwjOZ3B7MTtb4FFSnsDeYvFFeBxqkX7a25L4llR9AcBMMxgCHDJi070qr3bOoQv9Qwi/Xw4P92ZLQ+VRoskzPRmbFcdfZxsI6R9orxJ1YgA/FGuQZAbmVQ3gZAWcW4iP1sgYh8EkOUH/c1c5tb03gC4OyU1R44L/FBBQiAXBCAl50PhJgCR13KrR6vxBnV/AIg+Pbk1uQPx4zqda4UbertMc+bB0M6EDV9OUPezb59Pk=
data/CODE_OF_CONDUCT.md DELETED
@@ -1,49 +0,0 @@
1
- # Contributor Code of Conduct
2
-
3
- As contributors and maintainers of this project, and in the interest of
4
- fostering an open and welcoming community, we pledge to respect all people who
5
- contribute through reporting issues, posting feature requests, updating
6
- documentation, submitting pull requests or patches, and other activities.
7
-
8
- We are committed to making participation in this project a harassment-free
9
- experience for everyone, regardless of level of experience, gender, gender
10
- identity and expression, sexual orientation, disability, personal appearance,
11
- body size, race, ethnicity, age, religion, or nationality.
12
-
13
- Examples of unacceptable behavior by participants include:
14
-
15
- * The use of sexualized language or imagery
16
- * Personal attacks
17
- * Trolling or insulting/derogatory comments
18
- * Public or private harassment
19
- * Publishing other's private information, such as physical or electronic
20
- addresses, without explicit permission
21
- * Other unethical or unprofessional conduct
22
-
23
- Project maintainers have the right and responsibility to remove, edit, or
24
- reject comments, commits, code, wiki edits, issues, and other contributions
25
- that are not aligned to this Code of Conduct, or to ban temporarily or
26
- permanently any contributor for other behaviors that they deem inappropriate,
27
- threatening, offensive, or harmful.
28
-
29
- By adopting this Code of Conduct, project maintainers commit themselves to
30
- fairly and consistently applying these principles to every aspect of managing
31
- this project. Project maintainers who do not follow or enforce the Code of
32
- Conduct may be permanently removed from the project team.
33
-
34
- This code of conduct applies both within project spaces and in public spaces
35
- when an individual is representing the project or its community.
36
-
37
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
- reported by contacting a project maintainer at babartmann@gmail.com. All
39
- complaints will be reviewed and investigated and will result in a response that
40
- is deemed necessary and appropriate to the circumstances. Maintainers are
41
- obligated to maintain confidentiality with regard to the reporter of an
42
- incident.
43
-
44
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
- version 1.3.0, available at
46
- [http://contributor-covenant.org/version/1/3/0/][version]
47
-
48
- [homepage]: http://contributor-covenant.org
49
- [version]: http://contributor-covenant.org/version/1/3/0/
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bundler/setup'
4
- require 'onesignal'
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require 'irb'
14
- IRB.start
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,7 +0,0 @@
1
- module OneSignal
2
- class AppIdMissingError < StandardError
3
- def initialize(message = 'An app ID is needed for this resource')
4
- super(message)
5
- end
6
- end
7
- end
@@ -1,44 +0,0 @@
1
- module OneSignal
2
- class Client
3
- BASE_URL = 'https://onesignal.com/api/v1'.freeze
4
-
5
- attr_reader :auth_token, :app_id
6
-
7
- def initialize(auth_token: nil, app_id: nil)
8
- @auth_token = auth_token
9
- @app_id = app_id
10
-
11
- ensure_auth_token_presence
12
- end
13
-
14
- def apps
15
- @apps ||= AppResource.new(self)
16
- end
17
-
18
- def players
19
- ensure_app_id_presence
20
-
21
- @players ||= PlayerResource.new(self)
22
- end
23
-
24
- def notifications
25
- ensure_app_id_presence
26
-
27
- @notifications ||= NotificationResource.new(self)
28
- end
29
-
30
- private
31
-
32
- def ensure_auth_token_presence
33
- if auth_token.nil?
34
- raise ArgumentError, 'missing keyword: auth_token'
35
- end
36
- end
37
-
38
- def ensure_app_id_presence
39
- if app_id.nil?
40
- raise AppIdMissingError
41
- end
42
- end
43
- end
44
- end
@@ -1,19 +0,0 @@
1
- module OneSignal
2
- class BaseModel
3
- def self.to_proc
4
- method(:new).to_proc
5
- end
6
-
7
- def initialize(attributes = {})
8
- attributes.each { |key, value| send("#{key}=", value) }
9
- end
10
-
11
- def inspect
12
- values = Hash[
13
- instance_variables.map { |name| [name, instance_variable_get(name)] }
14
- ]
15
-
16
- "<#{self.class.name} #{values}>"
17
- end
18
- end
19
- end
@@ -1,94 +0,0 @@
1
- require 'net/http'
2
-
3
- module OneSignal
4
- class Request
5
- def initialize(client)
6
- @client = client
7
- end
8
-
9
- def get(path, params = {})
10
- uri = uri(path)
11
-
12
- if @client.app_id
13
- params[:app_id] = @client.app_id
14
- end
15
-
16
- uri.query = URI.encode_www_form(params)
17
-
18
- request(uri, Net::HTTP::Get)
19
- end
20
-
21
- def post(path, params)
22
- uri = uri(path)
23
- request(uri, Net::HTTP::Post, params)
24
- end
25
-
26
- def put(path, params)
27
- uri = uri(path)
28
- request(uri, Net::HTTP::Put, params)
29
- end
30
-
31
- def delete(path, params = {})
32
- uri = uri(path)
33
-
34
- if @client.app_id
35
- params[:app_id] = @client.app_id
36
- end
37
-
38
- uri.query = URI.encode_www_form(params)
39
-
40
- request(uri, Net::HTTP::Delete, params)
41
- end
42
-
43
- private
44
-
45
- def uri(path)
46
- URI.parse(OneSignal::Client::BASE_URL + path)
47
- end
48
-
49
- def request(uri, klass, params = nil)
50
- request = klass.new(uri.request_uri)
51
-
52
- if params && @client.app_id
53
- params[:app_id] = @client.app_id
54
- end
55
-
56
- if params
57
- request.body = params.to_json
58
- end
59
-
60
- response = make_request(uri, request)
61
-
62
- ensure_success(response, uri, params)
63
-
64
- response
65
- end
66
-
67
- def make_request(uri, request)
68
- add_headers(request)
69
- http = http_object(uri)
70
- http.request(request)
71
- end
72
-
73
- def add_headers(request)
74
- request.add_field('Content-Type', 'application/json')
75
- request.add_field('Authorization', "Basic #{@client.auth_token}")
76
- end
77
-
78
- def http_object(uri)
79
- http = Net::HTTP.new(uri.host, uri.port)
80
- http.use_ssl = true
81
- http.open_timeout = 30
82
- http.read_timeout = 30
83
-
84
- http
85
- end
86
-
87
- def ensure_success(response, uri, params = nil)
88
- if response.code != '200'
89
- message = "OneSignal error - uri: #{uri} - params: #{params}"
90
- raise RequestError.new(message, response.code, response.body)
91
- end
92
- end
93
- end
94
- end
@@ -1,21 +0,0 @@
1
- module OneSignal
2
- class RequestError < StandardError
3
- attr_reader :http_status
4
- attr_reader :http_body
5
-
6
- def initialize(message, http_status, http_body)
7
- @http_status = http_status
8
- @http_body = http_body
9
-
10
- if @http_status
11
- message += " - http status : #{@http_status}"
12
- end
13
-
14
- if @http_body
15
- message += " - http body : #{@http_body}"
16
- end
17
-
18
- super(message)
19
- end
20
- end
21
- end
@@ -1,27 +0,0 @@
1
- module OneSignal
2
- class AppResource < BaseResource
3
- def all
4
- get('/apps')
5
-
6
- response_body.map(&OneSignal::App)
7
- end
8
-
9
- def find(id)
10
- get("/apps/#{id}")
11
-
12
- OneSignal::App.new(response_body)
13
- end
14
-
15
- def create(params)
16
- post('/apps', params)
17
-
18
- OneSignal::App.new(response_body)
19
- end
20
-
21
- def update(id, params)
22
- put("/apps/#{id}", params)
23
-
24
- OneSignal::App.new(response_body)
25
- end
26
- end
27
- end