lws 6.3.0 → 6.3.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b78881916d363dc9fed830e0be6cecacc6b3928e699b047cb6004eab310f4ec8
4
- data.tar.gz: 6de69f0e6437aeaf85cd1bdc1f6527a09cc0e9b33d200b377fb232ea932aa1b0
3
+ metadata.gz: 7ef5cd27ac33754477433676be254a830b11ae048deeaddc8c847b19468ffe64
4
+ data.tar.gz: 15fa827aed23e1a58d7843783f9f712aaf62e6db743acf43cdf64ac95fc11276
5
5
  SHA512:
6
- metadata.gz: 4f18155b4bf72c6572c9d2dac80d1bc2ad00b35bde4a4169806495fdd4deead5971d7da9c6b7954a7ec859d48a7ac067dfad71d1d8d92c79d557be760a90e2ce
7
- data.tar.gz: a4935986105ecdf15dd71a6dc33b4b2d40ce5d14363eec241e87cef28904a3db94a542cbe37b9c1cd54955f6c5df60b49d83f11195fb733c414ea3c5ee084251
6
+ metadata.gz: e49fae53085988517741dba01bd314152a21230c1338ff023ad0ad844f4c66343ec79adaa1a9703337eca4f8c4bbf76fd0c8152fadf3be5dd0de5cb5e4d70f19
7
+ data.tar.gz: a322643e07f01d0c97215d59523991385fe6b166843f10c2d64cc001749718053037bdaaadc1486f0eed8653d9338a4ff178374e9fc5f84c10868f346497a45d
data/CHANGELOG.md CHANGED
@@ -6,6 +6,16 @@ of LWS in the major/minor part of te version.
6
6
 
7
7
  The changelog follows the [Keep a Changelog] format from version 6.3.0 on.
8
8
 
9
+ ## [6.3.1] - 2019-09-05
10
+ ### Changed
11
+ * Reworked the JSON parser to handle metadata better
12
+ * Updated/reworked the Resource app models: added/removed/updated attributes
13
+ where necessary (#12106)
14
+
15
+ ### Removed
16
+ * Removed some attributes that are already part of the generic model from
17
+ DigitalSignage app models
18
+
9
19
  ## [6.3.0] - 2019-09-05
10
20
  ### Added
11
21
  * Added slide, layout and related models to the DigitalSignage app (#12103)
@@ -140,3 +150,4 @@ Initial release
140
150
 
141
151
  [Keep a Changelog]: https://keepachangelog.com/en/1.0.0/
142
152
  [6.3.0]: https://gitlab.leftclick.eu/platform/ruby-lws/compare/v6.2.3...v6.3.0
153
+ [6.3.1]: https://gitlab.leftclick.eu/platform/ruby-lws/compare/v6.3.0...v6.3.1
@@ -558,14 +558,6 @@ module LWS::DigitalSignage
558
558
  # @return [Array<Version>] the versions of the layout
559
559
  has_many :versions, class_name: "LWS::DigitalSignage::Layout::Version",
560
560
  uri: "layouts/:layout_id/versions(/:id)"
561
-
562
- # @!attribute created_at [r]
563
- # @return [String] the timestamp of when the layout was created
564
- attribute :created_at
565
-
566
- # @!attribute updated_at [r]
567
- # @return [String] the timestamp of when the layout was last updated
568
- attribute :updated_at
569
561
  end
570
562
 
571
563
  # = The layout category class
@@ -591,14 +583,6 @@ module LWS::DigitalSignage
591
583
  # @!attribute name
592
584
  # @return [String] the name of the layout category
593
585
  attribute :name
594
-
595
- # @!attribute created_at [r]
596
- # @return [String] the timestamp of when the layout category was created
597
- attribute :created_at
598
-
599
- # @!attribute updated_at [r]
600
- # @return [String] the timestamp of when the layout category was last updated
601
- attribute :updated_at
602
586
  end
603
587
 
604
588
  # = The layout element class
@@ -657,15 +641,6 @@ module LWS::DigitalSignage
657
641
  # FIXME: Missing endpoint in LWS
658
642
  belongs_to :version, class_name: "LWS::DigitalSignage::Layout::Version",
659
643
  foreign_key: :layout_version_id
660
-
661
- # @!attribute created_at [r]
662
- # @return [String] the timestamp of when the layout element was created
663
- attribute :created_at
664
-
665
- # @!attribute updated_at [r]
666
- # @return [String] the timestamp of when the layout element was last
667
- # updated
668
- attribute :updated_at
669
644
  end
670
645
 
671
646
  # = The layout element customizable class
@@ -698,22 +673,15 @@ module LWS::DigitalSignage
698
673
  attribute :hint_message
699
674
 
700
675
  # @!attribute presets
701
- # @return [Array<Hash>] the presets for attribute values (label to value)
676
+ # This is a list of mappings of the preset label (key +"label"+) to the
677
+ # preset value (key +"value"+).
678
+ #
679
+ # @return [Array<Hash{String => String}>] the presets for attribute values
702
680
  attribute :presets
703
681
 
704
682
  # @!attribute uuid
705
683
  # @return [String] the UUID of the customizable attribute/property
706
684
  attribute :uuid
707
-
708
- # @!attribute created_at [r]
709
- # @return [String] the timestamp of when the layout element customizable
710
- # was created
711
- attribute :created_at
712
-
713
- # @!attribute updated_at [r]
714
- # @return [String] the timestamp of when the layout element customizable
715
- # was last updated
716
- attribute :updated_at
717
685
  end
718
686
 
719
687
  # = The layout element property class
@@ -747,15 +715,6 @@ module LWS::DigitalSignage
747
715
  # @!attribute value
748
716
  # @return [String] the attribute/property value
749
717
  attribute :value
750
-
751
- # @!attribute created_at [r]
752
- # @return [String] the timestamp of when the layout element was created
753
- attribute :created_at
754
-
755
- # @!attribute updated_at [r]
756
- # @return [String] the timestamp of when the layout element was last
757
- # updated
758
- attribute :updated_at
759
718
  end
760
719
 
761
720
  # = The layout version class
@@ -782,14 +741,6 @@ module LWS::DigitalSignage
782
741
  # @!attribute layout_id
783
742
  # @return [Integer] the ID of the layout the layout version is for
784
743
  attribute :layout_id
785
-
786
- # @!attribute created_at [r]
787
- # @return [String] the timestamp of when the layout version was created
788
- attribute :created_at
789
-
790
- # @!attribute updated_at [r]
791
- # @return [String] the timestamp of when the layout version was last updated
792
- attribute :updated_at
793
744
  end
794
745
 
795
746
  # = The player class
@@ -1745,14 +1696,6 @@ module LWS::DigitalSignage
1745
1696
  # @!attribute value
1746
1697
  # @return [String, nil] the value of the player tag
1747
1698
  attribute :value
1748
-
1749
- # @!attribute created_at [r]
1750
- # @return [String] the timestamp of when the player tag was created
1751
- attribute :created_at
1752
-
1753
- # @!attribute updated_at [r]
1754
- # @return [String] the timestamp of when the player tag was last updated
1755
- attribute :updated_at
1756
1699
  end
1757
1700
 
1758
1701
  # = The slide class
@@ -1799,14 +1742,6 @@ module LWS::DigitalSignage
1799
1742
  # @return [Array<Schedule>] the slide schedules that apply for the slide
1800
1743
  # FIXME: Missing endpoint in LWS
1801
1744
  has_many :schedules, class_name: "LWS::DigitalSignage::Slide::Schedule"
1802
-
1803
- # @!attribute created_at [r]
1804
- # @return [string] the timestamp of when the slide was created
1805
- attribute :created_at
1806
-
1807
- # @!attribute updated_at [r]
1808
- # @return [string] the timestamp of when the slide was last updated
1809
- attribute :updated_at
1810
1745
  end
1811
1746
 
1812
1747
  # = The slide schedule class
@@ -1859,14 +1794,6 @@ module LWS::DigitalSignage
1859
1794
  # @!attribute visible
1860
1795
  # @return [Boolean] whether the slide is visible within the slide schedule
1861
1796
  attribute :visible
1862
-
1863
- # @!attribute created_at [r]
1864
- # @return [string] the timestamp of when the slide schedule was created
1865
- attribute :created_at
1866
-
1867
- # @!attribute updated_at [r]
1868
- # @return [string] the timestamp of when the slide schedule was last updated
1869
- attribute :updated_at
1870
1797
  end
1871
1798
 
1872
1799
  end
@@ -43,10 +43,9 @@ module LWS::Resource
43
43
  # = The collection class
44
44
  #
45
45
  # There are two ways to view collections. Either it is viewed as a set
46
- # of items with metadata (use {#metadata} and {#items}), or it is viewed
47
- # as something that is associated with one or more meta collections that
48
- # each have specific item objects (see for example {#feed}, {#image},
49
- # {#images}, etc.).
46
+ # of items (see {#items}), or it is viewed as something that is associated
47
+ # with one or more meta collections that each have specific item objects (see
48
+ # for example {#feed}, {#image}, {#images}, etc.).
50
49
  class Collection < LWS::Generic::Model
51
50
  use_api LWS::Resource.api
52
51
 
@@ -68,6 +67,14 @@ module LWS::Resource
68
67
  # @return [Integer] the ID of the company the collection belongs to
69
68
  attribute :company_id
70
69
 
70
+ # @!attribute deleted_at
71
+ # @return [String, nil] the timestamp of when the collection was deleted
72
+ attribute :deleted_at
73
+
74
+ # @!attribute description
75
+ # @return [String] the description of the collection
76
+ attribute :description
77
+
71
78
  # @!attribute email
72
79
  # @return [String, nil] the email address used for email imports
73
80
  attribute :email
@@ -93,10 +100,6 @@ module LWS::Resource
93
100
  # the name of the class/kind of the collection
94
101
  attribute :kind
95
102
 
96
- # @!attribute metadata
97
- # @return [Hash] the metadata of the collection
98
- attribute :metadata
99
-
100
103
  # @!attribute name
101
104
  # @return [String] the name of the collection
102
105
  attribute :name
@@ -112,6 +115,11 @@ module LWS::Resource
112
115
 
113
116
  # @!group Collection Items Attribute Summary
114
117
 
118
+ # @!attribute config
119
+ # @return [Collection::Config] the configuration that is part of the
120
+ # collection (if kind is +:config+)
121
+ has_one :config
122
+
115
123
  # @!attribute feed
116
124
  # @return [Collection::Feed] the feed that is part of the collection
117
125
  # (if kind is +:feed+)
@@ -132,6 +140,21 @@ module LWS::Resource
132
140
  # collection (if kind is +:images+)
133
141
  has_many :images
134
142
 
143
+ # @!attribute powerpoint
144
+ # @return [Collection::PowerPoint] the PowerPoint presentation that is
145
+ # part of the collection (if kind is +:powerpoint+)
146
+ has_one :powerpoint
147
+
148
+ # @!attribute youtube
149
+ # @return [Collection::YouTube] the YouTube video that is part of the collection
150
+ # (if kind is +:youtube+)
151
+ has_one :youtube
152
+
153
+ # @!attribute youtubes
154
+ # @return [Array<Collection::YouTube>] the YouTube videos that are part
155
+ # of the collection (if kind is +:youtubes+)
156
+ has_many :youtubes
157
+
135
158
  # @!attribute video
136
159
  # @return [Collection::Video] the video that is part of the collection
137
160
  # (if kind is +:video+)
@@ -142,6 +165,16 @@ module LWS::Resource
142
165
  # collection (if kind is +:videos+)
143
166
  has_many :videos
144
167
 
168
+ # @!attribute vimeo
169
+ # @return [Collection::Vimeo] the Vimeo video that is part of the collection
170
+ # (if kind is +:vimeo+)
171
+ has_one :vimeo
172
+
173
+ # @!attribute vimeos
174
+ # @return [Array<Collection::Vimeo>] the Vimeo videos that are part of
175
+ # the collection (if kind is +:vimeos+)
176
+ has_many :vimeos
177
+
145
178
  # @!attribute weather_location
146
179
  # @return [Collection::WeatherLocation] the weather collection that is
147
180
  # part of the collection (if kind is +:weather_location+)
@@ -165,9 +198,23 @@ module LWS::Resource
165
198
  # part of
166
199
  attribute :collection_id
167
200
 
201
+ # @!attribute metadata
202
+ # @return [Hash] the metadata of the collection item
203
+ attribute :metadata
204
+
168
205
  # @!attribute name
169
206
  # @return [String] the name of the collection item
170
207
  attribute :name
208
+
209
+ # @!attribute position
210
+ # @return [Integer] the position of the item within the collection
211
+ attribute :position
212
+ end
213
+
214
+ # = The collection config class
215
+ class Collection::Config < Collection::Item
216
+ use_api LWS::Resource.api
217
+ uri "collections/:collection_id/configs(/:id)"
171
218
  end
172
219
 
173
220
  # = The collection post class
@@ -282,9 +329,9 @@ module LWS::Resource
282
329
  # @return [String] the URL of the image
283
330
  attribute :data_url
284
331
 
285
- # @!attribute metadata
286
- # @return [Hash] the metadata of the image
287
- attribute :metadata
332
+ # @!attribute thumbnail_url
333
+ # @return [String] the URL of the thumbnail of the image
334
+ attribute :thumbnail_url
288
335
  end
289
336
 
290
337
  # = The collection video class
@@ -296,12 +343,36 @@ module LWS::Resource
296
343
  # @return [String] the URL of the video
297
344
  attribute :data_url
298
345
 
299
- # @!attribute metadata
300
- # @return [Hash] the metadata of the video
301
- attribute :metadata
346
+ # @!attribute thumbnail_url
347
+ # @return [String] the URL of the thumbnail of the video
348
+ attribute :thumbnail_url
349
+ end
350
+
351
+ # = The collection Vimeo class
352
+ class Collection::Vimeo < Collection::Item
353
+ use_api LWS::Resource.api
354
+ uri "collections/:collection_id/vimeos(/:id)"
302
355
 
303
356
  # @!attribute data_url
304
- # @return [String] the URL of the thumbnail of the video
357
+ # @return [String] the URL of the vimeo
358
+ attribute :data_url
359
+
360
+ # @!attribute thumbnail_url
361
+ # @return [String] the URL of the thumbnail of the vimeo
362
+ attribute :thumbnail_url
363
+ end
364
+
365
+ # = The collection YouTube class
366
+ class Collection::YouTube < Collection::Item
367
+ use_api LWS::Resource.api
368
+ uri "collections/:collection_id/youtubes(/:id)"
369
+
370
+ # @!attribute data_url
371
+ # @return [String] the URL of the youtube
372
+ attribute :data_url
373
+
374
+ # @!attribute thumbnail_url
375
+ # @return [String] the URL of the thumbnail of the youtube
305
376
  attribute :thumbnail_url
306
377
  end
307
378
 
@@ -348,7 +419,7 @@ module LWS::Resource
348
419
  # @return [Float, nil] the longitude of the weather location
349
420
  attribute :long
350
421
 
351
- # @!attribute refresh_intervla
422
+ # @!attribute refresh_interval
352
423
  # @return [Integer] the interval used to refresh the weather location
353
424
  # (in seconds)
354
425
  attribute :refresh_interval
@@ -438,6 +509,14 @@ module LWS::Resource
438
509
  # @return [Integer] the ID of the company the folder belongs to
439
510
  attribute :company_id
440
511
 
512
+ # @!attribute deleted_at
513
+ # @return [String, nil] the timestamp of when the folder was deleted
514
+ attribute :deleted_at
515
+
516
+ # @!attribute description
517
+ # @return [String] the description of the folder
518
+ attribute :description
519
+
441
520
  # @!attribute folders
442
521
  # @return [Array<Folder>] the folders contained in the folder
443
522
  has_many :folders
@@ -18,12 +18,27 @@ module LWS
18
18
  class JSONParser < Faraday::Response::Middleware
19
19
 
20
20
  def parse(body)
21
- data = MultiJson.load(body, symbolize_keys: true) || {}
22
- metadata = data.delete(:metadata)
23
- errors = data.delete(:errors)
24
-
25
- # If there are errors, discard the data.
26
- data = nil if errors.present?
21
+ json = MultiJson.load(body, symbolize_keys: true)
22
+ data = nil
23
+ metadata = nil
24
+ errors = nil
25
+
26
+ if json.is_a? Array
27
+ data = json
28
+ elsif json.is_a? Hash
29
+ if json[:errors].present?
30
+ metadata = json[:metadata]
31
+ errors = json[:errors]
32
+ elsif json[:data].present?
33
+ data = json[:data]
34
+ metadata = json[:metadata]
35
+ errors = json[:errors]
36
+ else
37
+ data = json
38
+ end
39
+ else
40
+ raise "cannot interpret parsed JSON: #{json.inspect}"
41
+ end
27
42
 
28
43
  { data: data,
29
44
  metadata: metadata,
data/lib/lws/version.rb CHANGED
@@ -13,6 +13,6 @@ module LWS
13
13
 
14
14
  # The LWS library version.
15
15
  # @note The major and minor version parts match the LWS API version!
16
- VERSION = '6.3.0'.freeze
16
+ VERSION = '6.3.1'.freeze
17
17
 
18
18
  end
@@ -19,10 +19,11 @@ class TestJSONParser < MiniTest::Test
19
19
  # Redo LWS setup with persistent HTTP connections disabled.
20
20
  reconfigure(http_persistent: false)
21
21
  WebMock.enable!
22
- company = { id: "correct",
23
- country: "NL",
24
- # ...
25
- }
22
+ company = { data:
23
+ { id: "correct",
24
+ country: "NL",
25
+ # ...
26
+ } }
26
27
 
27
28
  full_uri = LWS::Auth.api.url_prefix.dup
28
29
  full_uri.path = "/companies/broken"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lws
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.3.0
4
+ version: 6.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - LeftClick B.V.