spree_devices 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.rspec +1 -0
  4. data/.rubocop +2 -0
  5. data/.rubocop.yml +37 -0
  6. data/.ruby-gemset +1 -0
  7. data/.ruby-version +1 -0
  8. data/Gemfile +17 -0
  9. data/Gemfile.lock +402 -0
  10. data/Jenkinsfile +68 -0
  11. data/LICENSE +26 -0
  12. data/README.md +33 -0
  13. data/Rakefile +21 -0
  14. data/app/assets/javascripts/spree/backend/spree_devices.js +2 -0
  15. data/app/assets/javascripts/spree/frontend/spree_devices.js +2 -0
  16. data/app/assets/stylesheets/spree/backend/spree_devices.css +4 -0
  17. data/app/assets/stylesheets/spree/frontend/spree_devices.css +4 -0
  18. data/app/controllers/spree/api/base_controller_decorator.rb +24 -0
  19. data/app/controllers/spree/api/v1/devices_controller.rb +24 -0
  20. data/app/controllers/spree/devices_controller.rb +22 -0
  21. data/app/models/spree/device.rb +6 -0
  22. data/app/models/spree/user_decorator.rb +4 -0
  23. data/app/models/spree/user_device.rb +17 -0
  24. data/app/overrides/spree/users/show/add_devices_to_account_my_orders.html.erb.deface +2 -0
  25. data/app/services/spree/device_service.rb +36 -0
  26. data/app/views/spree/api/v1/devices/index.v1.rabl +2 -0
  27. data/app/views/spree/api/v1/devices/show.v1.rabl +2 -0
  28. data/app/views/spree/api/v1/shared/error.v1.rabl +5 -0
  29. data/app/views/spree/devices/index.html.erb +20 -0
  30. data/bin/rails +7 -0
  31. data/config/locales/ar.yml +3 -0
  32. data/config/locales/en.yml +6 -0
  33. data/config/routes.rb +11 -0
  34. data/db/migrate/20160317153123_create_devices.rb +9 -0
  35. data/db/migrate/20160317154122_create_user_devices.rb +9 -0
  36. data/db/migrate/20160321135103_rename_device_code_to_device_uid.rb +5 -0
  37. data/db/migrate/20160511093138_rename_devices_tables.rb +6 -0
  38. data/lib/generators/spree_devices/install/install_generator.rb +33 -0
  39. data/lib/spree_devices.rb +5 -0
  40. data/lib/spree_devices/engine.rb +31 -0
  41. data/lib/spree_devices/engine_factories/device_factory.rb +6 -0
  42. data/lib/spree_devices/engine_factories/user_device_factory.rb +6 -0
  43. data/lib/spree_devices/factories.rb +5 -0
  44. data/spec/api/v1/devices_spec.rb +96 -0
  45. data/spec/api/v1/products_spec.rb +33 -0
  46. data/spec/controllers/devices_controller_spec.rb +50 -0
  47. data/spec/spec_helper.rb +97 -0
  48. data/spec/support/devices_api.rb +22 -0
  49. data/spec/utils/rubocop_spec.rb +8 -0
  50. data/spree_devices.gemspec +26 -0
  51. metadata +215 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 88f663112587b0e0fcc2971edb4ceaf9c821830a
4
+ data.tar.gz: 1ee9f1dd1af075dc10596b27268099a3a391bdd9
5
+ SHA512:
6
+ metadata.gz: 9ddb9a26e40a514be147629b8bfa574d8f21bb9fd6a0ef30e7173757d049616e7e76e54a044a7b9959ba20aba883354dda4dc608096d96c3526f76a83b0cb89e
7
+ data.tar.gz: 2a5df00c8fc6c83d009800674cfac99c03b6eb82fae5fecd97eb3f6143feb24c631f2c54c058145e21cf7ca4829f28e6c39d45c9aa131014137c21f4e862fdb0
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ \#*
2
+ *~
3
+ .#*
4
+ .DS_Store
5
+ .idea
6
+ .project
7
+ .sass-cache
8
+ coverage
9
+ tmp
10
+ nbproject
11
+ pkg
12
+ *.swp
13
+ spec/dummy
14
+ spree_devices.iml
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.rubocop ADDED
@@ -0,0 +1,2 @@
1
+ --rails
2
+ --display-cop-names
data/.rubocop.yml ADDED
@@ -0,0 +1,37 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4.1
3
+ Exclude:
4
+ - db/**/*
5
+ - out/**/*
6
+ - tmp/**/*
7
+ - bin/**/*
8
+ - spec/fixtures/**/*
9
+ - spec/dummy/**/*
10
+
11
+ Style/Documentation:
12
+ Enabled: false
13
+
14
+ Style/FrozenStringLiteralComment:
15
+ Enabled: false
16
+
17
+ Style/ClassAndModuleChildren:
18
+ Enabled: false
19
+
20
+ Metrics/MethodLength:
21
+ Exclude:
22
+ - config/routes/*
23
+
24
+ Metrics/LineLength:
25
+ Max: 120
26
+
27
+ Metrics/BlockLength:
28
+ CountComments: false # count full line comments?
29
+ Max: 25
30
+ ExcludedMethods: ['describe', 'context', 'it', 'class_eval']
31
+ Exclude:
32
+ - config/**/*
33
+ - config/routes/*
34
+
35
+ Metrics/AbcSize:
36
+ Exclude:
37
+ - config/**/*
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ spree-devices
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.4.1
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'spree', '~> 3.3'
4
+ gem 'spree_auth_devise', '~> 3.3'
5
+
6
+ group :test do
7
+ gem 'factory_bot'
8
+ gem 'rails-controller-testing'
9
+ gem 'rspec-rails'
10
+ gem 'simplecov'
11
+ end
12
+
13
+ group :development, :test do
14
+ gem 'rubocop'
15
+ end
16
+
17
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,402 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ spree_devices (1.2.0)
5
+ spree_api (>= 3.1.0, < 4.0)
6
+ spree_core (>= 3.1.0, < 4.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actioncable (5.1.5)
12
+ actionpack (= 5.1.5)
13
+ nio4r (~> 2.0)
14
+ websocket-driver (~> 0.6.1)
15
+ actionmailer (5.1.5)
16
+ actionpack (= 5.1.5)
17
+ actionview (= 5.1.5)
18
+ activejob (= 5.1.5)
19
+ mail (~> 2.5, >= 2.5.4)
20
+ rails-dom-testing (~> 2.0)
21
+ actionpack (5.1.5)
22
+ actionview (= 5.1.5)
23
+ activesupport (= 5.1.5)
24
+ rack (~> 2.0)
25
+ rack-test (>= 0.6.3)
26
+ rails-dom-testing (~> 2.0)
27
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
+ actionview (5.1.5)
29
+ activesupport (= 5.1.5)
30
+ builder (~> 3.1)
31
+ erubi (~> 1.4)
32
+ rails-dom-testing (~> 2.0)
33
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
34
+ activejob (5.1.5)
35
+ activesupport (= 5.1.5)
36
+ globalid (>= 0.3.6)
37
+ activemerchant (1.77.0)
38
+ activesupport (>= 3.2.14, < 6.x)
39
+ builder (>= 2.1.2, < 4.0.0)
40
+ i18n (>= 0.6.9)
41
+ nokogiri (~> 1.4)
42
+ activemodel (5.1.5)
43
+ activesupport (= 5.1.5)
44
+ activerecord (5.1.5)
45
+ activemodel (= 5.1.5)
46
+ activesupport (= 5.1.5)
47
+ arel (~> 8.0)
48
+ activesupport (5.1.5)
49
+ concurrent-ruby (~> 1.0, >= 1.0.2)
50
+ i18n (~> 0.7)
51
+ minitest (~> 5.1)
52
+ tzinfo (~> 1.1)
53
+ acts-as-taggable-on (5.0.0)
54
+ activerecord (>= 4.2.8)
55
+ acts_as_list (0.9.10)
56
+ activerecord (>= 3.0)
57
+ addressable (2.5.2)
58
+ public_suffix (>= 2.0.2, < 4.0)
59
+ arel (8.0.0)
60
+ ast (2.4.0)
61
+ autoprefixer-rails (8.1.0.1)
62
+ execjs
63
+ awesome_nested_set (3.1.4)
64
+ activerecord (>= 4.0.0, < 5.3)
65
+ bcrypt (3.1.11)
66
+ bootstrap-sass (3.3.7)
67
+ autoprefixer-rails (>= 5.2.1)
68
+ sass (>= 3.3.4)
69
+ builder (3.2.3)
70
+ camertron-eprun (1.1.1)
71
+ cancancan (2.1.3)
72
+ canonical-rails (0.2.2)
73
+ rails (>= 4.1, < 5.2)
74
+ capybara (2.18.0)
75
+ addressable
76
+ mini_mime (>= 0.1.3)
77
+ nokogiri (>= 1.3.3)
78
+ rack (>= 1.0.0)
79
+ rack-test (>= 0.5.4)
80
+ xpath (>= 2.0, < 4.0)
81
+ carmen (1.0.2)
82
+ activesupport (>= 3.0.0)
83
+ cldr-plurals-runtime-rb (1.0.1)
84
+ climate_control (0.2.0)
85
+ cliver (0.3.2)
86
+ cocaine (0.5.8)
87
+ climate_control (>= 0.0.3, < 1.0)
88
+ coffee-rails (4.2.2)
89
+ coffee-script (>= 2.2.0)
90
+ railties (>= 4.0.0)
91
+ coffee-script (2.4.1)
92
+ coffee-script-source
93
+ execjs
94
+ coffee-script-source (1.12.2)
95
+ concurrent-ruby (1.0.5)
96
+ crass (1.0.3)
97
+ css_parser (1.6.0)
98
+ addressable
99
+ database_cleaner (1.6.2)
100
+ deface (1.3.0)
101
+ nokogiri (~> 1.6)
102
+ polyglot
103
+ rails (>= 4.1)
104
+ rainbow (>= 2.1.0)
105
+ devise (4.4.2)
106
+ bcrypt (~> 3.0)
107
+ orm_adapter (~> 0.1)
108
+ railties (>= 4.1.0, < 6.0)
109
+ responders
110
+ warden (~> 1.2.3)
111
+ devise-encryptable (0.2.0)
112
+ devise (>= 2.1.0)
113
+ diff-lcs (1.3)
114
+ docile (1.3.0)
115
+ erubi (1.7.1)
116
+ execjs (2.7.0)
117
+ factory_bot (4.8.2)
118
+ activesupport (>= 3.0.0)
119
+ ffaker (2.8.1)
120
+ ffi (1.9.23)
121
+ friendly_id (5.2.3)
122
+ activerecord (>= 4.0.0)
123
+ globalid (0.4.1)
124
+ activesupport (>= 4.2.0)
125
+ highline (1.6.21)
126
+ htmlentities (4.3.4)
127
+ i18n (0.9.5)
128
+ concurrent-ruby (~> 1.0)
129
+ jquery-rails (4.3.1)
130
+ rails-dom-testing (>= 1, < 3)
131
+ railties (>= 4.2.0)
132
+ thor (>= 0.14, < 2.0)
133
+ jquery-ui-rails (6.0.1)
134
+ railties (>= 3.2.16)
135
+ json (2.1.0)
136
+ kaminari (1.0.1)
137
+ activesupport (>= 4.1.0)
138
+ kaminari-actionview (= 1.0.1)
139
+ kaminari-activerecord (= 1.0.1)
140
+ kaminari-core (= 1.0.1)
141
+ kaminari-actionview (1.0.1)
142
+ actionview
143
+ kaminari-core (= 1.0.1)
144
+ kaminari-activerecord (1.0.1)
145
+ activerecord
146
+ kaminari-core (= 1.0.1)
147
+ kaminari-core (1.0.1)
148
+ loofah (2.2.0)
149
+ crass (~> 1.0.2)
150
+ nokogiri (>= 1.5.9)
151
+ mail (2.7.0)
152
+ mini_mime (>= 0.1.1)
153
+ method_source (0.9.0)
154
+ mime-types (3.1)
155
+ mime-types-data (~> 3.2015)
156
+ mime-types-data (3.2016.0521)
157
+ mimemagic (0.3.2)
158
+ mini_mime (1.0.0)
159
+ mini_portile2 (2.3.0)
160
+ minitest (5.11.3)
161
+ monetize (1.7.0)
162
+ money (~> 6.9)
163
+ money (6.10.1)
164
+ i18n (>= 0.6.4, < 1.0)
165
+ nio4r (2.2.0)
166
+ nokogiri (1.8.2)
167
+ mini_portile2 (~> 2.3.0)
168
+ orm_adapter (0.5.0)
169
+ paperclip (5.1.0)
170
+ activemodel (>= 4.2.0)
171
+ activesupport (>= 4.2.0)
172
+ cocaine (~> 0.5.5)
173
+ mime-types
174
+ mimemagic (~> 0.3.0)
175
+ parallel (1.12.1)
176
+ paranoia (2.3.1)
177
+ activerecord (>= 4.0, < 5.2)
178
+ parser (2.5.0.4)
179
+ ast (~> 2.4.0)
180
+ poltergeist (1.17.0)
181
+ capybara (~> 2.1)
182
+ cliver (~> 0.3.1)
183
+ websocket-driver (>= 0.2.0)
184
+ polyamorous (1.3.3)
185
+ activerecord (>= 3.0)
186
+ polyglot (0.3.5)
187
+ powerpack (0.1.1)
188
+ premailer (1.11.1)
189
+ addressable
190
+ css_parser (>= 1.6.0)
191
+ htmlentities (>= 4.0.0)
192
+ premailer-rails (1.10.2)
193
+ actionmailer (>= 3, < 6)
194
+ premailer (~> 1.7, >= 1.7.9)
195
+ public_suffix (3.0.2)
196
+ rabl (0.13.1)
197
+ activesupport (>= 2.3.14)
198
+ rack (2.0.4)
199
+ rack-test (0.8.3)
200
+ rack (>= 1.0, < 3)
201
+ rails (5.1.5)
202
+ actioncable (= 5.1.5)
203
+ actionmailer (= 5.1.5)
204
+ actionpack (= 5.1.5)
205
+ actionview (= 5.1.5)
206
+ activejob (= 5.1.5)
207
+ activemodel (= 5.1.5)
208
+ activerecord (= 5.1.5)
209
+ activesupport (= 5.1.5)
210
+ bundler (>= 1.3.0)
211
+ railties (= 5.1.5)
212
+ sprockets-rails (>= 2.0.0)
213
+ rails-controller-testing (1.0.2)
214
+ actionpack (~> 5.x, >= 5.0.1)
215
+ actionview (~> 5.x, >= 5.0.1)
216
+ activesupport (~> 5.x)
217
+ rails-dom-testing (2.0.3)
218
+ activesupport (>= 4.2.0)
219
+ nokogiri (>= 1.6)
220
+ rails-html-sanitizer (1.0.3)
221
+ loofah (~> 2.0)
222
+ railties (5.1.5)
223
+ actionpack (= 5.1.5)
224
+ activesupport (= 5.1.5)
225
+ method_source
226
+ rake (>= 0.8.7)
227
+ thor (>= 0.18.1, < 2.0)
228
+ rainbow (3.0.0)
229
+ rake (12.3.0)
230
+ ransack (1.8.7)
231
+ actionpack (>= 3.0)
232
+ activerecord (>= 3.0)
233
+ activesupport (>= 3.0)
234
+ i18n
235
+ polyamorous (~> 1.3.2)
236
+ rb-fsevent (0.10.3)
237
+ rb-inotify (0.9.10)
238
+ ffi (>= 0.5.0, < 2)
239
+ responders (2.4.0)
240
+ actionpack (>= 4.2.0, < 5.3)
241
+ railties (>= 4.2.0, < 5.3)
242
+ rspec-core (3.7.1)
243
+ rspec-support (~> 3.7.0)
244
+ rspec-expectations (3.7.0)
245
+ diff-lcs (>= 1.2.0, < 2.0)
246
+ rspec-support (~> 3.7.0)
247
+ rspec-mocks (3.7.0)
248
+ diff-lcs (>= 1.2.0, < 2.0)
249
+ rspec-support (~> 3.7.0)
250
+ rspec-rails (3.7.2)
251
+ actionpack (>= 3.0)
252
+ activesupport (>= 3.0)
253
+ railties (>= 3.0)
254
+ rspec-core (~> 3.7.0)
255
+ rspec-expectations (~> 3.7.0)
256
+ rspec-mocks (~> 3.7.0)
257
+ rspec-support (~> 3.7.0)
258
+ rspec-support (3.7.1)
259
+ rubocop (0.53.0)
260
+ parallel (~> 1.10)
261
+ parser (>= 2.5)
262
+ powerpack (~> 0.1)
263
+ rainbow (>= 2.2.2, < 4.0)
264
+ ruby-progressbar (~> 1.7)
265
+ unicode-display_width (~> 1.0, >= 1.0.1)
266
+ ruby-progressbar (1.9.0)
267
+ sass (3.5.5)
268
+ sass-listen (~> 4.0.0)
269
+ sass-listen (4.0.0)
270
+ rb-fsevent (~> 0.9, >= 0.9.4)
271
+ rb-inotify (~> 0.9, >= 0.9.7)
272
+ sass-rails (5.0.7)
273
+ railties (>= 4.0.0, < 6)
274
+ sass (~> 3.1)
275
+ sprockets (>= 2.8, < 4.0)
276
+ sprockets-rails (>= 2.0, < 4.0)
277
+ tilt (>= 1.1, < 3)
278
+ select2-rails (3.5.9.1)
279
+ thor (~> 0.14)
280
+ simplecov (0.16.0)
281
+ docile (~> 1.1)
282
+ json (>= 1.8, < 3)
283
+ simplecov-html (~> 0.10.0)
284
+ simplecov-html (0.10.2)
285
+ spree (3.4.4)
286
+ spree_api (= 3.4.4)
287
+ spree_backend (= 3.4.4)
288
+ spree_cmd (= 3.4.4)
289
+ spree_core (= 3.4.4)
290
+ spree_frontend (= 3.4.4)
291
+ spree_sample (= 3.4.4)
292
+ spree_api (3.4.4)
293
+ rabl (~> 0.13.1)
294
+ spree_core (= 3.4.4)
295
+ versioncake (~> 3.3.0)
296
+ spree_auth_devise (3.3.3)
297
+ devise (~> 4.4.0)
298
+ devise-encryptable (= 0.2.0)
299
+ spree_core (>= 3.1.0, < 4.0)
300
+ spree_extension
301
+ spree_backend (3.4.4)
302
+ bootstrap-sass (~> 3.3)
303
+ jquery-rails (~> 4.3)
304
+ jquery-ui-rails (~> 6.0.1)
305
+ select2-rails (= 3.5.9.1)
306
+ spree_api (= 3.4.4)
307
+ spree_core (= 3.4.4)
308
+ spree_cmd (3.4.4)
309
+ thor (~> 0.14)
310
+ spree_core (3.4.4)
311
+ activemerchant (~> 1.67)
312
+ acts-as-taggable-on (~> 5.0)
313
+ acts_as_list (~> 0.8)
314
+ awesome_nested_set (~> 3.1.3)
315
+ cancancan (~> 2.0)
316
+ carmen (~> 1.0.0)
317
+ deface (~> 1.0)
318
+ ffaker (~> 2.2)
319
+ friendly_id (~> 5.2.1)
320
+ highline (~> 1.6.18)
321
+ kaminari (~> 1.0.1)
322
+ monetize (~> 1.1)
323
+ paperclip (~> 5.1.0)
324
+ paranoia (~> 2.3.0)
325
+ premailer-rails
326
+ rails (~> 5.1.4)
327
+ ransack (~> 1.8.0)
328
+ responders
329
+ sprockets-rails
330
+ state_machines-activerecord (~> 0.5)
331
+ stringex
332
+ twitter_cldr (~> 4.3)
333
+ spree_extension (0.0.5)
334
+ activerecord (>= 4.2)
335
+ spree_frontend (3.4.4)
336
+ bootstrap-sass (>= 3.3.5.1, < 3.4)
337
+ canonical-rails (~> 0.2.0)
338
+ jquery-rails (~> 4.3)
339
+ spree_api (= 3.4.4)
340
+ spree_core (= 3.4.4)
341
+ spree_sample (3.4.4)
342
+ spree_core (= 3.4.4)
343
+ sprockets (3.7.1)
344
+ concurrent-ruby (~> 1.0)
345
+ rack (> 1, < 3)
346
+ sprockets-rails (3.2.1)
347
+ actionpack (>= 4.0)
348
+ activesupport (>= 4.0)
349
+ sprockets (>= 3.0.0)
350
+ sqlite3 (1.3.13)
351
+ state_machines (0.5.0)
352
+ state_machines-activemodel (0.5.0)
353
+ activemodel (>= 4.1, < 5.2)
354
+ state_machines (>= 0.5.0)
355
+ state_machines-activerecord (0.5.0)
356
+ activerecord (>= 4.1, < 5.2)
357
+ state_machines-activemodel (>= 0.5.0)
358
+ stringex (2.8.4)
359
+ thor (0.20.0)
360
+ thread_safe (0.3.6)
361
+ tilt (2.0.8)
362
+ twitter_cldr (4.4.3)
363
+ camertron-eprun
364
+ cldr-plurals-runtime-rb (~> 1.0)
365
+ tzinfo
366
+ tzinfo (1.2.5)
367
+ thread_safe (~> 0.1)
368
+ unicode-display_width (1.3.0)
369
+ versioncake (3.3.0)
370
+ actionpack (>= 3.2)
371
+ activesupport (>= 3.2)
372
+ railties (>= 3.2)
373
+ tzinfo
374
+ warden (1.2.7)
375
+ rack (>= 1.0)
376
+ websocket-driver (0.6.5)
377
+ websocket-extensions (>= 0.1.0)
378
+ websocket-extensions (0.1.3)
379
+ xpath (3.0.0)
380
+ nokogiri (~> 1.8)
381
+
382
+ PLATFORMS
383
+ ruby
384
+
385
+ DEPENDENCIES
386
+ coffee-rails
387
+ database_cleaner
388
+ factory_bot
389
+ ffaker
390
+ poltergeist
391
+ rails-controller-testing
392
+ rspec-rails
393
+ rubocop
394
+ sass-rails
395
+ simplecov
396
+ spree (~> 3.3)
397
+ spree_auth_devise (~> 3.3)
398
+ spree_devices!
399
+ sqlite3
400
+
401
+ BUNDLED WITH
402
+ 1.16.1