pwush 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7a7b483cb55fae484b6e63a895d652da06fa869a
4
- data.tar.gz: f91d948289e8d97695fdde8b310eb058ea92f815
2
+ SHA256:
3
+ metadata.gz: 167bc841bf6dcfcb6586b1a8c609abbb9e3e7d0ae68ba0f8e9cade81ba6a9fa7
4
+ data.tar.gz: 80f429072e2a6c31882def50b9990ec9b76ae892be0a4f3922b8fe0f86bfd6ff
5
5
  SHA512:
6
- metadata.gz: 8a9557d1fac145eb988a489659a49a0631be3784da023d5f5e668b3f6bd20ff553cef442f1728e70079028bcdbd71275fc521d6b3650c2419a8e16d60cc59315
7
- data.tar.gz: 10b1f8f661f83ca25bd79c43871c93727d69a90962fa6071db8688c90fcac58e1beafbb0741d14fdbf0e0ed0c603e407911e7f220ee38102fdbf025434960292
6
+ metadata.gz: 81975b84e91988f0006e934a6222a892231031e910dd9796d97756bb6678bda817e540da02dc34465225138e7377b36cf48d55611f73f8bf77ff64aff90b5e46
7
+ data.tar.gz: 2e795ce936734b464200cddadb6e88b4714201da40f667493ce78697ad3f79fdf8533847616bd93f1d6c4851b834e670aa865464d594fbab0e94763afd966518
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pwush (0.1.3)
5
- dry-monads (~> 0.4)
6
- dry-struct (< 0.5)
7
- dry-types (< 0.13)
4
+ pwush (0.1.4)
5
+ dry-monads (~> 1.0)
6
+ dry-struct (<= 0.5.1)
7
+ dry-types (<= 0.13.2)
8
8
  http (~> 3.0)
9
9
  oj (~> 3)
10
10
 
@@ -27,29 +27,30 @@ GEM
27
27
  dry-container (0.6.0)
28
28
  concurrent-ruby (~> 1.0)
29
29
  dry-configurable (~> 0.1, >= 0.1.3)
30
- dry-core (0.4.5)
30
+ dry-core (0.4.7)
31
31
  concurrent-ruby (~> 1.0)
32
32
  dry-equalizer (0.2.1)
33
+ dry-inflector (0.1.2)
33
34
  dry-logic (0.4.2)
34
35
  dry-container (~> 0.2, >= 0.2.6)
35
36
  dry-core (~> 0.2)
36
37
  dry-equalizer (~> 0.2)
37
- dry-monads (0.4.0)
38
- dry-core (~> 0.3, >= 0.3.3)
38
+ dry-monads (1.0.1)
39
+ concurrent-ruby (~> 1.0)
40
+ dry-core (~> 0.4, >= 0.4.4)
39
41
  dry-equalizer
40
- dry-struct (0.4.0)
41
- dry-core (~> 0.4, >= 0.4.1)
42
+ dry-struct (0.5.1)
43
+ dry-core (~> 0.4, >= 0.4.3)
42
44
  dry-equalizer (~> 0.2)
43
- dry-types (~> 0.12, >= 0.12.2)
45
+ dry-types (~> 0.13)
44
46
  ice_nine (~> 0.11)
45
- dry-types (0.12.2)
47
+ dry-types (0.13.2)
46
48
  concurrent-ruby (~> 1.0)
47
- dry-configurable (~> 0.1)
48
49
  dry-container (~> 0.3)
49
- dry-core (~> 0.2, >= 0.2.1)
50
+ dry-core (~> 0.4, >= 0.4.4)
50
51
  dry-equalizer (~> 0.2)
52
+ dry-inflector (~> 0.1, >= 0.1.2)
51
53
  dry-logic (~> 0.4, >= 0.4.2)
52
- inflecto (~> 0.0.0, >= 0.0.2)
53
54
  hashdiff (0.3.7)
54
55
  http (3.3.0)
55
56
  addressable (~> 2.3)
@@ -58,13 +59,12 @@ GEM
58
59
  http_parser.rb (~> 0.6.0)
59
60
  http-cookie (1.0.3)
60
61
  domain_name (~> 0.5)
61
- http-form_data (2.1.0)
62
+ http-form_data (2.1.1)
62
63
  http_parser.rb (0.6.0)
63
64
  ice_nine (0.11.2)
64
- inflecto (0.0.2)
65
65
  json (2.1.0)
66
66
  method_source (0.9.0)
67
- oj (3.6.0)
67
+ oj (3.6.8)
68
68
  pry (0.11.3)
69
69
  coderay (~> 1.1.0)
70
70
  method_source (~> 0.9.0)
@@ -116,4 +116,4 @@ DEPENDENCIES
116
116
  webmock (~> 3.0)
117
117
 
118
118
  BUNDLED WITH
119
- 1.16.1
119
+ 1.16.2
@@ -1,9 +1,10 @@
1
1
  module Pwush
2
2
  class Message < Dry::Struct
3
+ # transform_types do |type|
4
+ # type.constructor { |value| value.nil? ? Undefined : value }
5
+ # end
3
6
  # https://www.pushwoosh.com/v1.0/reference#createmessage
4
7
 
5
- constructor_type :strict_with_defaults
6
-
7
8
  # YYYY-MM-DD HH:mm OR 'now'
8
9
  attribute :send_date, Types::Strict::String.default('now')
9
10
 
@@ -11,11 +12,11 @@ module Pwush
11
12
 
12
13
  # "timezone":"America/New_York", optional, if ignored UTC-0 is default in "send_date".
13
14
  # See http://php.net/manual/timezones.php for supported timezones
14
- attribute :timezone, Types::Strict::String.optional.default(nil)
15
+ attribute :timezone, Types::Strict::String.meta(omittable: true)
15
16
 
16
17
  # "campaign":"CAMPAIGN_CODE", optional.
17
18
  # Campaign code to which you want to assign this push message
18
- attribute :campaign, Types::Strict::String.optional.default(nil)
19
+ attribute :campaign, Types::Strict::String.meta(omittable: true)
19
20
 
20
21
  # "content":{
21
22
  # "en":"English",
@@ -25,90 +26,96 @@ module Pwush
25
26
  attribute :content, Types::Strict::String | Types::Hash
26
27
 
27
28
  # "page_id": 39, optional. HTML Pages. integer
28
- attribute :page_id, Types::Strict::Int.optional.default(nil)
29
+ attribute :page_id, Types::Strict::Integer.meta(omittable: true)
29
30
 
30
31
  # "rich_page_id": 42, optional. Rich Pages. integer
31
- attribute :rich_page_id, Types::Strict::Int.optional.default(nil)
32
+ attribute :rich_page_id, Types::Strict::Integer.meta(omittable: true)
32
33
 
33
34
  # "rich_media": "XXXX-XXXX", optional. Rich Media code. string
34
- attribute :rich_media, Types::Strict::String.optional.default(nil)
35
+ attribute :rich_media, Types::Strict::String.meta(omittable: true)
35
36
 
36
37
  # "remote_page" : "http://myremoteurl.com",
37
38
  # Remote Rich HTML Page URL. <scheme>://<authority>
38
- attribute :remote_page, Types::Strict::String.optional.default(nil)
39
+ attribute :remote_page, Types::Strict::String.meta(omittable: true)
39
40
 
40
41
  # "link": "http://google.com", optional, string.
41
42
  # For deeplinks add "minimize_link":0
42
- attribute :link, Types::Strict::String.optional.default(nil)
43
+ attribute :link, Types::Strict::String.meta(omittable: true)
43
44
 
44
45
  # "minimize_link": 0, optional.
45
46
  # False or 0 - do not minimize, 1 - Google, 2 - bitly. Default = 1
46
- attribute :minimize_link, Types::Strict::Int.constrained(included_in: 0..2).optional.default(nil)
47
+ attribute :minimize_link, Types::Strict::Integer.constrained(included_in: 0..2)
48
+ .meta(omittable: true)
47
49
 
48
50
  # "data": {"key":"value"}, JSON string or JSON object,
49
51
  # will be passed as "u" parameter in the payload (converted to JSON string)
50
- attribute :data, (Types::Strict::String | Types::Hash).optional.default(nil)
52
+ attribute :data, (Types::Strict::String | Types::Hash).meta(omittable: true)
51
53
 
52
54
  # 1 - iOS; 2 - BB; 3 - Android; 5 - Windows Phone; 7 - OS X; 8 - Windows 8;
53
55
  # 9 - Amazon; 10 - Safari; 11 - Chrome; 12 - Firefox;
54
56
  # ignored if "devices" < 10
55
- Platforms = Types::Strict::Int.enum(1, 2, 3, 5, 7, 8, 9, 10, 11, 12)
56
- attribute :platforms, Types::Strict::Array.of(Platforms).optional.default(nil)
57
+ Platforms = Types::Strict::Integer.enum(1, 2, 3, 5, 7, 8, 9, 10, 11, 12)
58
+ attribute :platforms, Types::Strict::Array.of(Platforms).meta(omittable: true)
57
59
 
58
60
  # "preset":"Q1A2Z-6X8SW", Push Preset Code from your Control Panel
59
- attribute :preset, Types::Strict::String.optional.default(nil)
61
+ attribute :preset, Types::Strict::String.meta(omittable: true)
60
62
 
61
63
  # "send_rate": 100, throttling. Valid values are from 100 to 1000 pushes/second.
62
- attribute :send_rate, Types::Strict::Int.constrained(included_in: 100..1000).optional.default(nil)
64
+ attribute :send_rate, Types::Strict::Integer.constrained(included_in: 100..1000)
65
+ .meta(omittable: true)
63
66
 
64
67
  # Optional. Specify tokens or hwids to send targeted push notifications.
65
68
  # Not more than 1000 tokens/hwids in an array.
66
69
  # If set, the message will only be sent to the devices on the list.
67
70
  # Ignored if the Applications Group is used. iOS push tokens can only be lower case.
68
- attribute :devices, Types::Strict::Array.of(Types::Strict::String).optional.default(nil)
71
+ attribute :devices, Types::Strict::Array.of(Types::Strict::String)
72
+ .meta(omittable: true)
69
73
 
70
74
  # "users":["user_3078a"], optional.
71
75
  # If set, message will only be delivered to the specified users Id's
72
76
  # (specified via /registerUser call).
73
77
  # If specified together with devices parameter, the latter will be ignored.
74
- attribute :users, Types::Strict::Array.of(Types::Strict::String).optional.default(nil)
78
+ attribute :users, Types::Strict::Array.of(Types::Strict::String)
79
+ .meta(omittable: true)
75
80
 
76
81
  # "filter": "FILTER_NAME", optional.
77
- attribute :filter, Types::Strict::String.optional.default(nil)
82
+ attribute :filter, Types::Strict::String.meta(omittable: true)
78
83
 
79
84
  # optional, placeholders for dynamic content instead of device tags
80
85
  # "dynamic_content_placeholders" :{
81
86
  # "firstname":"John",
82
87
  # "lastname":"Doe"
83
88
  # },
84
- attribute :dynamic_content_placeholders, Types::Hash.optional.default(nil)
89
+ attribute :dynamic_content_placeholders, Types::Hash.meta(omittable: true)
85
90
 
86
91
  # "conditions": [TAG_CONDITION1, TAG_CONDITION2, ..., TAG_CONDITIONN],
87
92
  # Optional.
88
- attribute :conditions, Types::Strict::Array.of(Types::Strict::String).optional.default(nil)
93
+ attribute :conditions, Types::Strict::Array.of(Types::Strict::String)
94
+ .meta(omittable: true)
89
95
 
90
96
  # iOS related
91
97
 
92
98
  # "ios_badges": 5, optional, integer.
93
99
  # iOS application badge number.
94
100
  # Use "+n" or "-n" to increment/decrement the badge value by n
95
- attribute :ios_badges, Types::Strict::Int.optional.default(nil)
101
+ attribute :ios_badges, Types::Strict::Integer.meta(omittable: true)
96
102
 
97
103
  # "ios_sound": "sound file.wav", optional.
98
104
  # Sound file name in the main bundle of application.
99
105
  # If left empty, the device will produce no sound upon receiving a push
100
- attribute :ios_sound, Types::Strict::String.optional.default(nil)
106
+ attribute :ios_sound, Types::Strict::String.meta(omittable: true)
101
107
 
102
108
  # "ios_ttl": 3600, optional.
103
109
  # Time to live parameter - maximum message lifespan in seconds
104
- attribute :ios_ttl, Types::Strict::Int.optional.default(nil)
110
+ attribute :ios_ttl, Types::Strict::Integer.meta(omittable: true)
105
111
 
106
112
  # "ios_silent": 1, optional.
107
113
  # Enable silent notifications (ignore "sound" and "content")
108
- attribute :ios_silent, Types::Strict::Int.constrained(included_in: 0..1).optional.default(nil)
114
+ attribute :ios_silent, Types::Strict::Integer.constrained(included_in: 0..1)
115
+ .meta(omittable: true)
109
116
 
110
117
  # iOS8 category ID from Pushwoosh
111
- attribute :ios_category_id, Types::Strict::Int.optional.default(nil)
118
+ attribute :ios_category_id, Types::Strict::Integer.meta(omittable: true)
112
119
 
113
120
  # Optional - root level parameters to the aps dictionary
114
121
  # "ios_root_params" : {
@@ -119,118 +126,121 @@ module Pwush
119
126
  # "attachment":"YOUR_ATTACHMENT_URL", // iOS 10 media attachment URL
120
127
  # "data": << User supplied data, max of 4KB>>
121
128
  # },
122
- attribute :ios_root_params, Types::Hash.optional.default(nil)
129
+ attribute :ios_root_params, Types::Hash.meta(omittable: true)
123
130
 
124
131
  # "apns_trim_content":1, optional. (0|1)
125
132
  # Trims the exceeding content strings with ellipsis
126
- attribute :apns_trim_content, Types::Strict::Int.constrained(included_in: 0..1).optional.default(nil)
133
+ attribute :apns_trim_content, Types::Strict::Integer.constrained(included_in: 0..1)
134
+ .meta(omittable: true)
127
135
 
128
136
  # "ios_title":"Title", optional. Add Title for push notification
129
- attribute :ios_title, Types::Strict::String.optional.default(nil)
137
+ attribute :ios_title, Types::Strict::String.meta(omittable: true)
130
138
 
131
139
  # "ios_subtitle" : "SubTitle", //Optional. Added sub-title for push notification
132
- attribute :ios_subtitle, Types::Strict::String.optional.default(nil)
140
+ attribute :ios_subtitle, Types::Strict::String.meta(omittable: true)
133
141
 
134
142
  # Android related
135
143
 
136
144
  # "android_root_params": {"key": "value"}
137
145
  # custom key-value object. root level parameters for the android payload recipients
138
- attribute :android_root_params, Types::Hash.optional.default(nil)
146
+ attribute :android_root_params, Types::Hash.meta(omittable: true)
139
147
 
140
148
  # "android_sound" : "soundfile", optional. No file extension.
141
149
  # If left empty, the device will produce no sound upon receiving a push
142
- attribute :android_sound, Types::Strict::String.optional.default(nil)
150
+ attribute :android_sound, Types::Strict::String.meta(omittable: true)
143
151
 
144
152
  # "android_header":"header", optional. Android notification header
145
- attribute :android_header, Types::Strict::String.optional.default(nil)
153
+ attribute :android_header, Types::Strict::String.meta(omittable: true)
146
154
 
147
155
  # "android_icon": "icon",
148
- attribute :android_icon, Types::Strict::String.optional.default(nil)
156
+ attribute :android_icon, Types::Strict::String.meta(omittable: true)
149
157
 
150
158
  # "android_custom_icon": "http://example.com/image.png", optional.
151
159
  # Full path URL to the image file
152
- attribute :android_custom_icon, Types::Strict::String.optional.default(nil)
160
+ attribute :android_custom_icon, Types::Strict::String.meta(omittable: true)
153
161
 
154
162
  # "android_banner": "http://example.com/banner.png", optional.
155
163
  # Full path URL to the image file
156
- attribute :android_banner, Types::Strict::String.optional.default(nil)
164
+ attribute :android_banner, Types::Strict::String.meta(omittable: true)
157
165
 
158
166
  # "android_badges": 5, optional, integer.
159
167
  # Android application icon badge number.
160
168
  # Use "+n" or "-n" to increment/decrement the badge value by n
161
- attribute :android_badges, Types::Strict::Int.optional.default(nil)
169
+ attribute :android_badges, Types::Strict::Integer.meta(omittable: true)
162
170
 
163
171
  # "android_gcm_ttl": 3600, optional.
164
172
  # Time to live parameter - maximum message lifespan in seconds
165
- attribute :android_gcm_ttl, Types::Strict::Int.optional.default(nil)
173
+ attribute :android_gcm_ttl, Types::Strict::Integer.meta(omittable: true)
166
174
 
167
175
  # "android_vibration": 0, Android force-vibration for high-priority pushes, boolean
168
- attribute :android_vibration, Types::Strict::Bool.optional.default(nil)
176
+ attribute :android_vibration, Types::Strict::Bool.meta(omittable: true)
169
177
 
170
178
  # "android_led":"#rrggbb", LED hex color, device will do its best approximation
171
- attribute :android_led, Types::Strict::String.optional.default(nil)
179
+ attribute :android_led, Types::Strict::String.meta(omittable: true)
172
180
 
173
181
  # "android_priority":-1, priority of the push in the Android push drawer.
174
182
  # Valid values are -2, -1, 0, 1 and 2
175
- attribute :android_priority, Types::Strict::Int.constrained(included_in: -2..2).optional.default(nil)
183
+ attribute :android_priority, Types::Strict::Integer.constrained(included_in: -2..2)
184
+ .meta(omittable: true)
176
185
 
177
186
  # "android_ibc":"#RRGGBB", icon background color on Lollipop,
178
187
  # #RRGGBB, #AARRGGBB, "red", "black", "yellow", etc.
179
- attribute :android_ibc, Types::Strict::String.optional.default(nil)
188
+ attribute :android_ibc, Types::Strict::String.meta(omittable: true)
180
189
 
181
190
  # "android_silent": 1, optional. 0 or 1
182
191
  # Enable silent notificaiton (ignore sound and content)
183
- attribute :android_silent, Types::Strict::Int.constrained(included_in: 0..1).optional.default(nil)
192
+ attribute :android_silent, Types::Strict::Integer.constrained(included_in: 0..1)
193
+ .meta(omittable: true)
184
194
 
185
195
  # Amazon related
186
196
 
187
197
  # "adm_root_params": {"key": "value"}, // custom key-value object
188
- attribute :adm_root_params, Types::Hash.optional.default(nil)
198
+ attribute :adm_root_params, Types::Hash.meta(omittable: true)
189
199
  # "adm_sound": "push.mp3",
190
- attribute :adm_sound, Types::Strict::String.optional.default(nil)
200
+ attribute :adm_sound, Types::Strict::String.meta(omittable: true)
191
201
  # "adm_header": "Header",
192
- attribute :adm_header, Types::Strict::String.optional.default(nil)
202
+ attribute :adm_header, Types::Strict::String.meta(omittable: true)
193
203
  # "adm_icon": "icon",
194
- attribute :adm_icon, Types::Strict::String.optional.default(nil)
204
+ attribute :adm_icon, Types::Strict::String.meta(omittable: true)
195
205
  # "adm_custom_icon": "http://example.com/image.png",
196
- attribute :adm_custom_icon, Types::Strict::String.optional.default(nil)
206
+ attribute :adm_custom_icon, Types::Strict::String.meta(omittable: true)
197
207
  # "adm_banner": "http://example.com/banner.png",
198
- attribute :adm_banner, Types::Strict::String.optional.default(nil)
208
+ attribute :adm_banner, Types::Strict::String.meta(omittable: true)
199
209
  # "adm_ttl": 3600, optional. Time to live parameter - the maximum message lifespan in seconds
200
- attribute :adm_ttl, Types::Strict::Int.optional.default(nil)
210
+ attribute :adm_ttl, Types::Strict::Integer.meta(omittable: true)
201
211
  # "adm_priority":-1, priority of the push in Amazon push drawer, valid values are -2, -1, 0, 1 and 2
202
- attribute :adm_priority, Types::Strict::Int.optional.default(nil)
212
+ attribute :adm_priority, Types::Strict::Integer.meta(omittable: true)
203
213
 
204
214
  # Windows Phone related
205
215
 
206
216
  # Windows Phone notification type. 'Tile' or 'Toast'. Raw notifications are not supported. 'Tile' if default
207
- attribute :wp_type, Types::Strict::String.optional.default(nil)
217
+ attribute :wp_type, Types::Strict::String.meta(omittable: true)
208
218
  # tile image
209
- attribute :wp_background, Types::Strict::String.optional.default(nil)
219
+ attribute :wp_background, Types::Strict::String.meta(omittable: true)
210
220
  # back tile image
211
- attribute :wp_backbackground, Types::Strict::String.optional.default(nil)
221
+ attribute :wp_backbackground, Types::Strict::String.meta(omittable: true)
212
222
  # back tile title
213
- attribute :wp_backtitle, Types::Strict::String.optional.default(nil)
223
+ attribute :wp_backtitle, Types::Strict::String.meta(omittable: true)
214
224
  # back tile content
215
- attribute :wp_backcontent, Types::Strict::String.optional.default(nil)
225
+ attribute :wp_backcontent, Types::Strict::String.meta(omittable: true)
216
226
  # Badge for Windows Phone notification
217
- attribute :wp_count, Types::Strict::Int.optional.default(nil)
227
+ attribute :wp_count, Types::Strict::Integer.meta(omittable: true)
218
228
 
219
229
  # BlackBerry related
220
230
 
221
231
  # BlackBerry header, applicable to BB10 Series devices
222
- attribute :blackberry_header, Types::Strict::String.optional.default(nil)
232
+ attribute :blackberry_header, Types::Strict::String.meta(omittable: true)
223
233
 
224
234
  # Mac OS X related
225
235
 
226
236
  # "mac_badges": 3,
227
- attribute :mac_badges, Types::Strict::Int.optional.default(nil)
237
+ attribute :mac_badges, Types::Strict::Integer.meta(omittable: true)
228
238
  # "mac_sound": "sound.caf",
229
- attribute :mac_sound, Types::Strict::String.optional.default(nil)
239
+ attribute :mac_sound, Types::Strict::String.meta(omittable: true)
230
240
  # "mac_root_params": {"content-available":1},
231
- attribute :mac_root_params, Types::Hash.optional.default(nil)
241
+ attribute :mac_root_params, Types::Hash.meta(omittable: true)
232
242
  # Time to live parameter — maximum message lifespan in seconds
233
- attribute :mac_ttl, Types::Strict::Int.optional.default(nil)
243
+ attribute :mac_ttl, Types::Strict::Integer.meta(omittable: true)
234
244
 
235
245
  # WNS related
236
246
 
@@ -238,66 +248,68 @@ module Pwush
238
248
  # "en": "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48YmFkZ2UgdmFsdWU9ImF2YWlsYWJsZSIvPg==",
239
249
  # "de": "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48YmFkZ2UgdmFsdWU9Im5ld01lc3NhZ2UiLz4="
240
250
  # },
241
- attribute :wns_content, Types::Hash.optional.default(nil)
251
+ attribute :wns_content, Types::Hash.meta(omittable: true)
242
252
  # 'Tile' | 'Toast' | 'Badge' | 'Raw'
243
- attribute :wns_type, Types::Strict::String.optional.default(nil)
253
+ attribute :wns_type, Types::Strict::String.meta(omittable: true)
244
254
  # optional. Used in Tile replacement policy. An alphanumeric string of no more than 16 characters.
245
- attribute :wns_tag, Types::Strict::String.optional.default(nil)
255
+ attribute :wns_tag, Types::Strict::String.meta(omittable: true)
246
256
  # optional. (1|0) Translates into X-WNS-Cache-Policy value
247
- attribute :wns_cache, Types::Strict::Int.optional.default(nil)
257
+ attribute :wns_cache, Types::Strict::Integer.meta(omittable: true)
248
258
  # optional. Expiration time for notification in seconds
249
- attribute :wns_ttl, Types::Strict::Int.optional.default(nil)
259
+ attribute :wns_ttl, Types::Strict::Integer.meta(omittable: true)
250
260
 
251
261
  # Safari related
252
262
 
253
263
  # obligatory, title of the notification
254
- attribute :safari_title, Types::Strict::String.optional.default(nil)
264
+ attribute :safari_title, Types::Strict::String.meta(omittable: true)
255
265
 
256
266
  # "safari_action": "Click here", // optional
257
- attribute :safari_action, Types::Strict::String.optional.default(nil)
267
+ attribute :safari_action, Types::Strict::String.meta(omittable: true)
258
268
 
259
269
  # "safari_url_args": ["firstArgument", "secondArgument"],
260
270
  # Obligatory, but the value may be empty
261
- attribute :safari_url_args, Types::Strict::Array.of(Types::Strict::String).optional.default(nil)
271
+ attribute :safari_url_args, Types::Strict::Array.of(Types::Strict::String)
272
+ .meta(omittable: true)
262
273
 
263
274
  # Optional. Time to live parameter - the maximum lifespan of a message in seconds
264
- attribute :safari_ttl, Types::Strict::Int.constrained(min_size: 0).optional.default(nil)
275
+ attribute :safari_ttl, Types::Strict::Integer.constrained(min_size: 0)
276
+ .meta(omittable: true)
265
277
 
266
278
  # Chrome related
267
279
 
268
280
  # You can specify the header of the message in this parameter
269
- attribute :chrome_title, Types::Strict::String.optional.default(nil)
281
+ attribute :chrome_title, Types::Strict::String.meta(omittable: true)
270
282
 
271
283
  # "chrome_icon":"", full path URL to the icon or extension resources file path
272
- attribute :chrome_icon, Types::Strict::String.optional.default(nil)
284
+ attribute :chrome_icon, Types::Strict::String.meta(omittable: true)
273
285
 
274
286
  # Time to live parameter - maximum message lifespan in seconds
275
- attribute :chrome_gcm_ttl, Types::Strict::Int.optional.default(nil)
287
+ attribute :chrome_gcm_ttl, Types::Strict::Integer.meta(omittable: true)
276
288
 
277
289
  # optional, changes chrome push display time.
278
290
  # Set to 0 to display push until user interacts with it
279
- attribute :chrome_duration, Types::Strict::Int.optional.default(nil)
291
+ attribute :chrome_duration, Types::Strict::Integer.meta(omittable: true)
280
292
 
281
293
  # optional, URL to large image.
282
- attribute :chrome_image, Types::Strict::String.optional.default(nil)
294
+ attribute :chrome_image, Types::Strict::String.meta(omittable: true)
283
295
 
284
- attribute :chrome_button_text1, Types::Strict::String.optional.default(nil)
296
+ attribute :chrome_button_text1, Types::Strict::String.meta(omittable: true)
285
297
 
286
298
  # ignored if chrome_button_text1 is not set
287
- attribute :chrome_button_url1, Types::Strict::String.optional.default(nil)
299
+ attribute :chrome_button_url1, Types::Strict::String.meta(omittable: true)
288
300
 
289
- attribute :chrome_button_text2, Types::Strict::String.optional.default(nil)
301
+ attribute :chrome_button_text2, Types::Strict::String.meta(omittable: true)
290
302
 
291
303
  # ignored if chrome_button_text2 is not set
292
- attribute :chrome_button_url2, Types::Strict::String.optional.default(nil)
304
+ attribute :chrome_button_url2, Types::Strict::String.meta(omittable: true)
293
305
 
294
306
  # Firefox-related
295
307
 
296
308
  # optional. You can specify message header here
297
- attribute :firefox_title, Types::Strict::String.optional.default(nil)
309
+ attribute :firefox_title, Types::Strict::String.meta(omittable: true)
298
310
 
299
311
  # full path URL to the icon or path to the file in extension resources
300
- attribute :firefox_icon, Types::Strict::String.optional.default(nil)
312
+ attribute :firefox_icon, Types::Strict::String.meta(omittable: true)
301
313
 
302
314
  def defined_attributes
303
315
  __attributes__.reject { |_, v| v.nil? }
@@ -1,17 +1,16 @@
1
- require 'dry-monads'
1
+ require 'dry/monads/result'
2
2
 
3
3
  require 'pwush/response/deffered'
4
4
  require 'pwush/response/value'
5
5
 
6
6
  module Pwush
7
7
  module Response
8
+ include Dry::Monads::Result::Mixin
9
+
8
10
  def self.wrap
9
11
  Deffered.new(yield).resolve
10
12
  rescue Http::TimeoutError => e
11
13
  Failure.new(e)
12
14
  end
13
-
14
- class Success < Dry::Monads::Success; end
15
- class Failure < Dry::Monads::Failure; end
16
15
  end
17
16
  end
@@ -1,6 +1,8 @@
1
1
  module Pwush
2
2
  module Response
3
3
  class Deffered
4
+ include Dry::Monads::Result::Mixin
5
+
4
6
  def initialize(raw_result)
5
7
  @_raw_result = raw_result
6
8
  end
@@ -1,11 +1,9 @@
1
1
  module Pwush
2
2
  module Response
3
3
  class Value < Dry::Struct::Value
4
- constructor_type :strict
5
-
6
- attribute :status_code, Types::Coercible::Int
7
- attribute :status_message, Types::Strict::String.optional
8
- attribute :body, (Types::Hash | Types::String).optional
4
+ attribute :status_code, Types::Coercible::Integer
5
+ attribute :status_message, Types::Strict::String.meta(omittable: true)
6
+ attribute :body, (Types::Hash | Types::String).meta(omittable: true)
9
7
  end
10
8
  end
11
9
  end
@@ -1,3 +1,3 @@
1
1
  module Pwush
2
- VERSION = '0.1.4'.freeze
2
+ VERSION = '0.1.5'.freeze
3
3
  end
@@ -20,9 +20,9 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_dependency 'dry-monads', '~> 0.4'
24
- spec.add_dependency 'dry-struct', '< 0.5 '
25
- spec.add_dependency 'dry-types', '< 0.13'
23
+ spec.add_dependency 'dry-monads', '~> 1.0'
24
+ spec.add_dependency 'dry-struct', '<= 0.5.1 '
25
+ spec.add_dependency 'dry-types', '<= 0.13.2'
26
26
  spec.add_dependency 'http', '~> 3.0'
27
27
  spec.add_dependency 'oj', '~> 3'
28
28
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwush
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Litvinov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-19 00:00:00.000000000 Z
11
+ date: 2018-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-monads
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.4'
19
+ version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.4'
26
+ version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: dry-struct
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "<"
31
+ - - "<="
32
32
  - !ruby/object:Gem::Version
33
- version: '0.5'
33
+ version: 0.5.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "<"
38
+ - - "<="
39
39
  - !ruby/object:Gem::Version
40
- version: '0.5'
40
+ version: 0.5.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: dry-types
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "<"
45
+ - - "<="
46
46
  - !ruby/object:Gem::Version
47
- version: '0.13'
47
+ version: 0.13.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "<"
52
+ - - "<="
53
53
  - !ruby/object:Gem::Version
54
- version: '0.13'
54
+ version: 0.13.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: http
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
229
  version: '0'
230
230
  requirements: []
231
231
  rubyforge_project:
232
- rubygems_version: 2.6.14
232
+ rubygems_version: 2.7.6
233
233
  signing_key:
234
234
  specification_version: 4
235
235
  summary: Pushwoosh remote API ruby toolkit