kono_mailup 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -0
  3. data/app/controllers/kono_mailup/application_controller.rb +1 -1
  4. data/app/controllers/kono_mailup/tokens_controller.rb +12 -9
  5. data/db/migrate/20171124083941_create_settings.rb +1 -1
  6. data/lib/generators/kono_mailup/install/install_generator.rb +6 -4
  7. data/lib/generators/kono_mailup/install/templates/initializers.rb +4 -0
  8. data/lib/kono_mailup.rb +5 -0
  9. data/lib/kono_mailup/engine.rb +4 -0
  10. data/lib/kono_mailup/version.rb +1 -1
  11. data/vendor/mailup-ruby/lib/mailup.rb +229 -0
  12. data/vendor/mailup-ruby/lib/mailup/console/base.rb +115 -0
  13. data/vendor/mailup-ruby/lib/mailup/console/email.rb +80 -0
  14. data/vendor/mailup-ruby/lib/mailup/console/group.rb +125 -0
  15. data/vendor/mailup-ruby/lib/mailup/console/images.rb +69 -0
  16. data/vendor/mailup-ruby/lib/mailup/console/import.rb +46 -0
  17. data/vendor/mailup-ruby/lib/mailup/console/list.rb +913 -0
  18. data/vendor/mailup-ruby/lib/mailup/console/recipient.rb +70 -0
  19. data/vendor/mailup-ruby/lib/mailup/console/user.rb +77 -0
  20. data/vendor/mailup-ruby/lib/mailup/errors.rb +18 -0
  21. data/vendor/mailup-ruby/lib/mailup/public/base.rb +18 -0
  22. data/vendor/mailup-ruby/lib/mailup/public/console.rb +75 -0
  23. data/vendor/mailup-ruby/lib/mailup/stats/base.rb +41 -0
  24. data/vendor/mailup-ruby/lib/mailup/stats/message.rb +284 -0
  25. data/vendor/mailup-ruby/lib/mailup/stats/recipient.rb +303 -0
  26. data/vendor/mailup-ruby/lib/mailup/version.rb +4 -0
  27. data/vendor/mailup-ruby/rails/init.rb +1 -0
  28. data/vendor/omniauth-mailup/lib/omniauth-mailup.rb +2 -0
  29. data/vendor/omniauth-mailup/lib/omniauth-mailup/version.rb +5 -0
  30. data/vendor/omniauth-mailup/lib/omniauth/strategies/mailup.rb +41 -0
  31. metadata +45 -12
  32. data/README.rdoc +0 -3
  33. data/app/assets/images/kono_mailup/.keep +0 -0
@@ -0,0 +1,303 @@
1
+ module MailUp
2
+ module Stats
3
+ class Recipient
4
+ attr_accessor :api
5
+
6
+ def initialize(id, api)
7
+ @api = api
8
+ @id = id
9
+ end
10
+
11
+ # Paged list of messages received by the specified recipient.
12
+ #
13
+ # @param [Hash] params Optional params or filters:
14
+ # @option params [Integer] :pageNumber The page number to return.
15
+ # @option params [Integer] :pageSize The number of results to per page.
16
+ # @option params [String] :filterby A filtering expression.
17
+ # @option params [String] :orderby The sorting condition for the results.
18
+ #
19
+ # @return [JSON] Results and data including:
20
+ # * IsPaginated [Boolean]
21
+ # * Items [Array<Hash>]
22
+ # * PageNumber [Integer]
23
+ # * PageSize [Integer]
24
+ # * Skipped [Integer]
25
+ # * TotalElementsCount [Integer]
26
+ #
27
+ # @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-ListRecipientMessageDeliveries
28
+ #
29
+ # @example
30
+ #
31
+ # deliveries = mailup.console.recipient(154).deliveries
32
+ # deliveries['TotalElementsCount']
33
+ # => 10
34
+ # deliveries['Items'].first['Subject']
35
+ # => "Message Subject"
36
+ #
37
+ def deliveries(params = {})
38
+ @api.get("#{@api.path}/Recipient/#{@id}/List/Deliveries", params: params)
39
+ end
40
+
41
+ # Count of messages received by the specified recipient.
42
+ #
43
+ #
44
+ # @return [Integer] Count of deliveries.
45
+ #
46
+ # @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-CountRecipientMessageDeliveries
47
+ #
48
+ # @example
49
+ #
50
+ # deliveries = mailup.console.recipient(154).deliveries_count
51
+ # => 324
52
+ #
53
+ def deliveries_count
54
+ @api.get("#{@api.path}/Recipient/#{@id}/Count/Deliveries")
55
+ end
56
+
57
+ # Paged list of messages viewed by the specified recipient.
58
+ #
59
+ # @param [Hash] params Optional params or filters:
60
+ # @option params [Integer] :pageNumber The page number to return.
61
+ # @option params [Integer] :pageSize The number of results to per page.
62
+ # @option params [String] :filterby A filtering expression.
63
+ # @option params [String] :orderby The sorting condition for the results.
64
+ #
65
+ # @return [JSON] Results and data including:
66
+ # * IsPaginated [Boolean]
67
+ # * Items [Array<Hash>]
68
+ # * PageNumber [Integer]
69
+ # * PageSize [Integer]
70
+ # * Skipped [Integer]
71
+ # * TotalElementsCount [Integer]
72
+ #
73
+ # @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-ListRecipientMessageViews
74
+ #
75
+ # @example
76
+ #
77
+ # views = mailup.console.recipient(154).views
78
+ # views['TotalElementsCount']
79
+ # => 10
80
+ # views['Items'].first['Subject']
81
+ # => "Message Subject"
82
+ #
83
+ def views(params = {})
84
+ @api.get("#{@api.path}/Recipient/#{@id}/List/Views", params: params)
85
+ end
86
+
87
+ # Count of messages viewed by the specified recipient.
88
+ #
89
+ #
90
+ # @return [Integer] Count of views.
91
+ #
92
+ # @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-CountRecipientMessageViews
93
+ #
94
+ # @example
95
+ #
96
+ # views = mailup.console.recipient(154).views_count
97
+ # => 324
98
+ #
99
+ def views_count
100
+ @api.get("#{@api.path}/Recipient/#{@id}/Count/Views")
101
+ end
102
+
103
+ # Paged list of bounces with details returned by the specified recipient.
104
+ #
105
+ # @param [Hash] params Optional params or filters:
106
+ # @option params [Integer] :pageNumber The page number to return.
107
+ # @option params [Integer] :pageSize The number of results to per page.
108
+ # @option params [String] :filterby A filtering expression.
109
+ # @option params [String] :orderby The sorting condition for the results.
110
+ #
111
+ # @return [JSON] Results and data including:
112
+ # * IsPaginated [Boolean]
113
+ # * Items [Array<Hash>]
114
+ # * PageNumber [Integer]
115
+ # * PageSize [Integer]
116
+ # * Skipped [Integer]
117
+ # * TotalElementsCount [Integer]
118
+ #
119
+ # @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-ListRecipientMessageBouncesDetails
120
+ #
121
+ # @example
122
+ #
123
+ # bounces = mailup.console.recipient(154).bounces_details
124
+ # bounces['TotalElementsCount']
125
+ # => 10
126
+ # bounces['Items'].first['Subject']
127
+ # => "Message Subject"
128
+ #
129
+ def bounces_details(params = {})
130
+ @api.get("#{@api.path}/Recipient/#{@id}/List/BouncesDetails", params: params)
131
+ end
132
+
133
+ # Paged list of bounces returned by the specified recipient.
134
+ #
135
+ # @param [Hash] params Optional params or filters:
136
+ # @option params [Integer] :pageNumber The page number to return.
137
+ # @option params [Integer] :pageSize The number of results to per page.
138
+ # @option params [String] :filterby A filtering expression.
139
+ # @option params [String] :orderby The sorting condition for the results.
140
+ #
141
+ # @return [JSON] Results and data including:
142
+ # * IsPaginated [Boolean]
143
+ # * Items [Array<Hash>]
144
+ # * PageNumber [Integer]
145
+ # * PageSize [Integer]
146
+ # * Skipped [Integer]
147
+ # * TotalElementsCount [Integer]
148
+ #
149
+ # @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-ListRecipientMessageBounces
150
+ #
151
+ # @example
152
+ #
153
+ # bounces = mailup.console.recipient(154).bounces
154
+ # bounces['TotalElementsCount']
155
+ # => 10
156
+ # bounces['Items'].first['Subject']
157
+ # => "Message Subject"
158
+ #
159
+ def bounces(params = {})
160
+ @api.get("#{@api.path}/Recipient/#{@id}/List/Bounces", params: params)
161
+ end
162
+
163
+ # Count of bounces returned by the specified recipient.
164
+ #
165
+ #
166
+ # @return [Integer] Count of bounces.
167
+ #
168
+ # @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-CountRecipientMessageBounces
169
+ #
170
+ # @example
171
+ #
172
+ # views = mailup.console.recipient(154).bounces_count
173
+ # => 324
174
+ #
175
+ def bounces_count
176
+ @api.get("#{@api.path}/Recipient/#{@id}/Count/Bounces")
177
+ end
178
+
179
+ # Paged list of unsubscriptions done by the specified recipient.
180
+ #
181
+ # @param [Hash] params Optional params or filters:
182
+ # @option params [Integer] :pageNumber The page number to return.
183
+ # @option params [Integer] :pageSize The number of results to per page.
184
+ # @option params [String] :filterby A filtering expression.
185
+ # @option params [String] :orderby The sorting condition for the results.
186
+ #
187
+ # @return [JSON] Results and data including:
188
+ # * IsPaginated [Boolean]
189
+ # * Items [Array<Hash>]
190
+ # * PageNumber [Integer]
191
+ # * PageSize [Integer]
192
+ # * Skipped [Integer]
193
+ # * TotalElementsCount [Integer]
194
+ #
195
+ # @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-ListRecipientUnsubscriptions
196
+ #
197
+ # @example
198
+ #
199
+ # unsubscribes = mailup.console.recipient(154).unsubscribes
200
+ # unsubscribes['TotalElementsCount']
201
+ # => 10
202
+ # unsubscribes['Items'].first['Subject']
203
+ # => "Message Subject"
204
+ #
205
+ def unsubscribes(params = {})
206
+ @api.get("#{@api.path}/Recipient/#{@id}/List/Unsubscriptions", params: params)
207
+ end
208
+
209
+ # Count of unsubscriptions done by the specified recipient.
210
+ #
211
+ #
212
+ # @return [Integer] Count of unsubscribes.
213
+ #
214
+ # @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-CountRecipientUnsubscriptions
215
+ #
216
+ # @example
217
+ #
218
+ # unsubscribes = mailup.console.recipient(154).unsubscribes_count
219
+ # => 324
220
+ #
221
+ def unsubscribes_count
222
+ @api.get("#{@api.path}/Recipient/#{@id}/Count/Unsubscriptions")
223
+ end
224
+
225
+ # Verbose paged list of message clicks on a link done by the specified recipient.
226
+ #
227
+ # @param [Hash] params Optional params or filters:
228
+ # @option params [Integer] :pageNumber The page number to return.
229
+ # @option params [Integer] :pageSize The number of results to per page.
230
+ # @option params [String] :filterby A filtering expression.
231
+ # @option params [String] :orderby The sorting condition for the results.
232
+ #
233
+ # @return [JSON] Results and data including:
234
+ # * IsPaginated [Boolean]
235
+ # * Items [Array<Hash>]
236
+ # * PageNumber [Integer]
237
+ # * PageSize [Integer]
238
+ # * Skipped [Integer]
239
+ # * TotalElementsCount [Integer]
240
+ #
241
+ # @see http://help.mailup.com/display/mailupapi/Email+statistics+methods#Emailstatisticsmethods-ListRecipientClickDetailsByDate
242
+ #
243
+ # @example
244
+ #
245
+ # clicks = mailup.console.recipient(154).clicks_details
246
+ # clicks['TotalElementsCount']
247
+ # => 10
248
+ # clicks['Items'].first['Subject']
249
+ # => "Message Subject"
250
+ #
251
+ def clicks_details(params = {})
252
+ @api.get("#{@api.path}/Recipient/#{@id}/List/ClicksDetails", params: params)
253
+ end
254
+
255
+ # Paged list of message clicks on a link done by the specified recipient.
256
+ #
257
+ # @param [Hash] params Optional params or filters:
258
+ # @option params [Integer] :pageNumber The page number to return.
259
+ # @option params [Integer] :pageSize The number of results to per page.
260
+ # @option params [String] :filterby A filtering expression.
261
+ # @option params [String] :orderby The sorting condition for the results.
262
+ #
263
+ # @return [JSON] Results and data including:
264
+ # * IsPaginated [Boolean]
265
+ # * Items [Array<Hash>]
266
+ # * PageNumber [Integer]
267
+ # * PageSize [Integer]
268
+ # * Skipped [Integer]
269
+ # * TotalElementsCount [Integer]
270
+ #
271
+ # @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-ListRecipientMessageClicks
272
+ #
273
+ # @example
274
+ #
275
+ # clicks = mailup.console.recipient(154).clicks
276
+ # clicks['TotalElementsCount']
277
+ # => 10
278
+ # clicks['Items'].first['Subject']
279
+ # => "Message Subject"
280
+ #
281
+ def clicks(params = {})
282
+ @api.get("#{@api.path}/Recipient/#{@id}/List/Clicks", params: params)
283
+ end
284
+
285
+ # Count of clicks on a link in the specified email.
286
+ #
287
+ #
288
+ # @return [Integer] Count of clicks.
289
+ #
290
+ # @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-CountRecipientClicks
291
+ #
292
+ # @example
293
+ #
294
+ # clicks = mailup.console.recipient(154).clicks_count
295
+ # => 324
296
+ #
297
+ def clicks_count
298
+ @api.get("#{@api.path}/Recipient/#{@id}/Count/Clicks")
299
+ end
300
+
301
+ end
302
+ end
303
+ end
@@ -0,0 +1,4 @@
1
+ module MailUp
2
+ API_VERSION = "1.1"
3
+ VERSION = "1.2.0"
4
+ end
@@ -0,0 +1 @@
1
+ require 'mailup'
@@ -0,0 +1,2 @@
1
+ require "omniauth-mailup/version"
2
+ require "omniauth/strategies/mailup"
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module MailUp
3
+ VERSION = "0.0.5"
4
+ end
5
+ end
@@ -0,0 +1,41 @@
1
+ require 'omniauth-oauth2'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class MailUp < OmniAuth::Strategies::OAuth2
7
+
8
+ option :name, :mailup
9
+
10
+ option :client_options, {
11
+ site: "https://services.mailup.com",
12
+ authorize_url: "/Authorization/OAuth/LogOn",
13
+ token_url: "/Authorization/OAuth/Token"
14
+ }
15
+
16
+ # TODO: Do we need this?
17
+ option :provider_ignores_state, true
18
+
19
+ # AuthHash data for Omniauth
20
+ uid { raw_info["UID"] } # TODO: Need uid from MailUp
21
+
22
+ info do
23
+ {
24
+ company: raw_info["Company"],
25
+ nickname: raw_info["Username"],
26
+ version: raw_info["Version"],
27
+ is_trial: raw_info["IsTrial"]
28
+ }
29
+ end
30
+
31
+ # Get more information about the user.
32
+ def raw_info
33
+ req = access_token.get('/API/v1.1/Rest/ConsoleService.svc/Console/Authentication/Info')
34
+ @raw_info ||= MultiJson.load(req.body)
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ # Make sure that 'mailup' camelizes properly to 'MailUp'.
41
+ OmniAuth.config.add_camelization 'mailup', 'MailUp'
metadata CHANGED
@@ -1,57 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kono_mailup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marino Bonetti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-24 00:00:00.000000000 Z
11
+ date: 2017-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: oauth2
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - "~>"
18
32
  - !ruby/object:Gem::Version
19
- version: 4.2.10
33
+ version: '1.0'
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: 4.2.10
40
+ version: '1.0'
27
41
  - !ruby/object:Gem::Dependency
28
- name: mailup
42
+ name: omniauth-oauth2
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '1.2'
47
+ version: 1.3.0
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '1.2'
54
+ version: 1.3.0
41
55
  - !ruby/object:Gem::Dependency
42
- name: omniauth-mailup
56
+ name: multi_json
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: 0.0.5
61
+ version: '1.10'
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: 0.0.5
68
+ version: '1.10'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rails-settings-cached
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -119,9 +133,8 @@ extensions: []
119
133
  extra_rdoc_files: []
120
134
  files:
121
135
  - MIT-LICENSE
122
- - README.rdoc
136
+ - README.md
123
137
  - Rakefile
124
- - app/assets/images/kono_mailup/.keep
125
138
  - app/assets/javascripts/kono_mailup/application.js
126
139
  - app/assets/stylesheets/kono_mailup/application.css
127
140
  - app/controllers/kono_mailup/application_controller.rb
@@ -192,6 +205,26 @@ files:
192
205
  - spec/dummy/public/422.html
193
206
  - spec/dummy/public/500.html
194
207
  - spec/dummy/public/favicon.ico
208
+ - vendor/mailup-ruby/lib/mailup.rb
209
+ - vendor/mailup-ruby/lib/mailup/console/base.rb
210
+ - vendor/mailup-ruby/lib/mailup/console/email.rb
211
+ - vendor/mailup-ruby/lib/mailup/console/group.rb
212
+ - vendor/mailup-ruby/lib/mailup/console/images.rb
213
+ - vendor/mailup-ruby/lib/mailup/console/import.rb
214
+ - vendor/mailup-ruby/lib/mailup/console/list.rb
215
+ - vendor/mailup-ruby/lib/mailup/console/recipient.rb
216
+ - vendor/mailup-ruby/lib/mailup/console/user.rb
217
+ - vendor/mailup-ruby/lib/mailup/errors.rb
218
+ - vendor/mailup-ruby/lib/mailup/public/base.rb
219
+ - vendor/mailup-ruby/lib/mailup/public/console.rb
220
+ - vendor/mailup-ruby/lib/mailup/stats/base.rb
221
+ - vendor/mailup-ruby/lib/mailup/stats/message.rb
222
+ - vendor/mailup-ruby/lib/mailup/stats/recipient.rb
223
+ - vendor/mailup-ruby/lib/mailup/version.rb
224
+ - vendor/mailup-ruby/rails/init.rb
225
+ - vendor/omniauth-mailup/lib/omniauth-mailup.rb
226
+ - vendor/omniauth-mailup/lib/omniauth-mailup/version.rb
227
+ - vendor/omniauth-mailup/lib/omniauth/strategies/mailup.rb
195
228
  homepage: https://github.com/ArchimediaZerogroup/KonoMailup
196
229
  licenses:
197
230
  - MIT