lws 6.1.5 → 6.2.0
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 +5 -5
- data/CHANGELOG.md +5 -0
- data/lib/lws.rb +1 -1
- data/lib/lws/apps/corporate_website.rb +63 -28
- data/lib/lws/apps/resource.rb +486 -0
- data/lib/lws/version.rb +1 -1
- data/test/corporate_website_test.rb +27 -1
- data/test/resource_test.rb +90 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2d578f48839e82886fbae900676021fa42ed4b6ba6027545e274c1873df0048d
|
4
|
+
data.tar.gz: 1fb84987148c6e8783b87c1401553fec78081d09efbfc502d77307f08321bfa5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f70e8d929cfb091b04c2239f290fb668007db26e581ad2cf633946171472199e33cf7d0d5278341a7e64d75e50d6deca229f056cfcd99a54b0f92f5edcb49762
|
7
|
+
data.tar.gz: fd7405242f6ba25d772b699f995b0fff4447cf3ea10cafdcf4a3d2748278b4913155f6925568b23358b65c01ee724166b65b8ec4748977aec3352613144f1de7
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,11 @@ Up until v6.1.0, we used the standard Gem version numbering starting at v0.0.1.
|
|
4
4
|
From v6.1.0 on the version will follow the API version of LWS in the major/minor
|
5
5
|
part of te version.
|
6
6
|
|
7
|
+
## v6.2.0
|
8
|
+
|
9
|
+
* Add the Resource app implementation (#12097)
|
10
|
+
* Update the CorporateWebsite app for recent API changes
|
11
|
+
|
7
12
|
## v6.1.5
|
8
13
|
|
9
14
|
* Update the gemspec to relax the dependency on WebMock to support 2.x and 3.x
|
data/lib/lws.rb
CHANGED
@@ -38,7 +38,7 @@ module LWS
|
|
38
38
|
# The list of supported apps (web service libraries) loaded by
|
39
39
|
# {.setup}.
|
40
40
|
SUPPORTED_APPS = [:generic, :auth, :corporate_website, :digital_signage,
|
41
|
-
:maps, :presence, :ticket]
|
41
|
+
:maps, :presence, :resource, :ticket]
|
42
42
|
|
43
43
|
# @return [Config] the API configuration for the web services
|
44
44
|
mattr_reader :config
|
@@ -38,6 +38,7 @@ module LWS::CorporateWebsite
|
|
38
38
|
# = The article class
|
39
39
|
class Article < LWS::Generic::Model
|
40
40
|
use_api LWS::CorporateWebsite.api
|
41
|
+
uri "pages/:page_id/articles(/:id)"
|
41
42
|
|
42
43
|
# @!attribute id [r]
|
43
44
|
# @return [Fixnum] the (unique) ID of the article
|
@@ -47,35 +48,23 @@ module LWS::CorporateWebsite
|
|
47
48
|
# @return [String, nil] the body of the article
|
48
49
|
attribute :body
|
49
50
|
|
50
|
-
# @!attribute key
|
51
|
-
# @return [String] the (page) key of the article
|
52
|
-
attribute :key
|
53
|
-
|
54
|
-
# @!attribute language
|
55
|
-
# @return [String] the ID of the language of the article (2 character)
|
56
|
-
attribute :language
|
57
|
-
|
58
51
|
# @!attribute layout
|
59
52
|
# @return ["text_image_social", "text_only", "map"] the layout used for
|
60
53
|
# the article
|
61
54
|
attribute :layout
|
62
55
|
|
63
|
-
# @!attribute menu_key
|
64
|
-
# @return [String, nil] the key of menu the article belongs to
|
65
|
-
attribute :menu_key
|
66
|
-
|
67
|
-
# @!attribute menu_item
|
68
|
-
# @return [Boolean] whether the article has a menu item
|
69
|
-
attribute :menu_item
|
70
|
-
|
71
|
-
# @!attribute news
|
72
|
-
# @return [Boolean, nil] flag whether the article is a news article
|
73
|
-
attribute :news
|
74
|
-
|
75
56
|
# @!attribute order
|
76
57
|
# @return [Fixnum, nil] the order (number) of the article withing the page
|
77
58
|
attribute :order
|
78
59
|
|
60
|
+
# @!attribute page
|
61
|
+
# @return [Page] the page the article belongs to
|
62
|
+
belongs_to :page
|
63
|
+
|
64
|
+
# @!attribute page_id
|
65
|
+
# @return [Fixnum] the ID of the page the article belongs to
|
66
|
+
attribute :page_id
|
67
|
+
|
79
68
|
# @!attribute picture
|
80
69
|
# @return [String, nil] the path to the picture accompanying the article
|
81
70
|
attribute :picture
|
@@ -88,10 +77,6 @@ module LWS::CorporateWebsite
|
|
88
77
|
# @return [String, nil] the URL to the picture accompanying the article
|
89
78
|
attribute :picture_url
|
90
79
|
|
91
|
-
# @!attribute sitemap
|
92
|
-
# @return [Boolean] flag whether the article is included in the sitemap
|
93
|
-
attribute :sitemap
|
94
|
-
|
95
80
|
# @!attribute social_avatar
|
96
81
|
# @return [String, nil] the path to the social avatar accompanying the article
|
97
82
|
attribute :social_avatar
|
@@ -116,10 +101,6 @@ module LWS::CorporateWebsite
|
|
116
101
|
# @return [String, nil] the title of the article
|
117
102
|
attribute :title
|
118
103
|
|
119
|
-
# @!attribute url
|
120
|
-
# @return [String] the (partial) URL of the article
|
121
|
-
attribute :url
|
122
|
-
|
123
104
|
# @!attribute created_at [r]
|
124
105
|
# @return [String] the timestamp of when the article was created
|
125
106
|
attribute :created_at
|
@@ -171,6 +152,60 @@ module LWS::CorporateWebsite
|
|
171
152
|
attribute :updated_at
|
172
153
|
end
|
173
154
|
|
155
|
+
# = The page class
|
156
|
+
class Page < LWS::Generic::Model
|
157
|
+
use_api LWS::CorporateWebsite.api
|
158
|
+
|
159
|
+
# @!attribute id [r]
|
160
|
+
# @return [Fixnum] the (unique) ID of the page
|
161
|
+
attribute :id
|
162
|
+
|
163
|
+
# @!attribute articles
|
164
|
+
# @return [Array<Article>] the articles that are part of the page
|
165
|
+
has_many :articles,
|
166
|
+
uri: "pages/:page_id/articles(/:id)"
|
167
|
+
|
168
|
+
# @!attribute language
|
169
|
+
# @return [String] the ID of the language of the page (2 character)
|
170
|
+
attribute :language
|
171
|
+
|
172
|
+
# @!attribute menu_kind
|
173
|
+
# @return [String] the name of the menu (head) the page belongs to
|
174
|
+
attribute :menu_kind
|
175
|
+
|
176
|
+
# @!attribute menu_name
|
177
|
+
# @return [String] the name of the page in the menu
|
178
|
+
attribute :menu_name
|
179
|
+
|
180
|
+
# @!attribute news
|
181
|
+
# @return [Boolean, nil] flag whether the page is a news page
|
182
|
+
attribute :news
|
183
|
+
|
184
|
+
# @!attribute order
|
185
|
+
# @return [Fixnum] the order (number) of the page withing the menu
|
186
|
+
attribute :order
|
187
|
+
|
188
|
+
# @!attribute sitemap
|
189
|
+
# @return [Boolean] flag whether the page is included in the sitemap
|
190
|
+
attribute :sitemap
|
191
|
+
|
192
|
+
# @!attribute id [r]
|
193
|
+
# @return [String] the slug of the page
|
194
|
+
attribute :slug
|
195
|
+
|
196
|
+
# @!attribute youtube_link
|
197
|
+
# @return [String, nil] the URL of a YouTube video used for the page
|
198
|
+
attribute :youtube_link
|
199
|
+
|
200
|
+
# @!attribute created_at [r]
|
201
|
+
# @return [String] the timestamp of when the page was created
|
202
|
+
attribute :created_at
|
203
|
+
|
204
|
+
# @!attribute updated_at [r]
|
205
|
+
# @return [String] the timestamp of when the page was last updated
|
206
|
+
attribute :updated_at
|
207
|
+
end
|
208
|
+
|
174
209
|
# = The social page class
|
175
210
|
class SocialPage < LWS::Generic::Model
|
176
211
|
use_api LWS::CorporateWebsite.api
|
@@ -0,0 +1,486 @@
|
|
1
|
+
#
|
2
|
+
# Copyright © 2016 LeftClick B.V.
|
3
|
+
#
|
4
|
+
# This software is property of LeftClick B.V. and cannot be redistributed
|
5
|
+
# and/or modified without permission. The software or any of its parts
|
6
|
+
# cannot be used for any other purposes than the LeftClick services and
|
7
|
+
# only during a valid license subscription. For more information, please
|
8
|
+
# contact LeftClick B.V. at: Geldropseweg 8B, 5731 SG Mierlo, The
|
9
|
+
# Netherlands, info@leftclick.eu, +31492-782120.
|
10
|
+
|
11
|
+
|
12
|
+
# = The resource app module
|
13
|
+
module LWS::Resource
|
14
|
+
|
15
|
+
# :nocov:
|
16
|
+
unless defined? ENDPOINT
|
17
|
+
# The API endpoint for the resource app
|
18
|
+
ENDPOINT = { production: "https://resource.leftclick.cloud/",
|
19
|
+
development: "https://resource-dev.leftclick.cloud/" }
|
20
|
+
end
|
21
|
+
# :nocov:
|
22
|
+
|
23
|
+
# @!visibility private
|
24
|
+
def self.api
|
25
|
+
LWS.setup_api(LWS.config.endpoints[:resource] ||
|
26
|
+
ENDPOINT[LWS.config.environment])
|
27
|
+
end
|
28
|
+
|
29
|
+
### Generic classes
|
30
|
+
|
31
|
+
# (see Generic::Configuration)
|
32
|
+
class Configuration < LWS::Generic::Configuration
|
33
|
+
use_api LWS::Resource.api
|
34
|
+
end
|
35
|
+
|
36
|
+
### App specific classes
|
37
|
+
|
38
|
+
# = The collection class
|
39
|
+
#
|
40
|
+
# There are two ways to view collections. Either it is viewed as a set
|
41
|
+
# of items with metadata (use {#metadata} and {#items}), or it is viewed
|
42
|
+
# as something that is associated with one or more meta collections that
|
43
|
+
# each have specific item objects (see for example {#feed}, {#image},
|
44
|
+
# {#images}, etc.).
|
45
|
+
class Collection < LWS::Generic::Model
|
46
|
+
use_api LWS::Resource.api
|
47
|
+
|
48
|
+
# @!attribute id [r]
|
49
|
+
# @return [Fixnum] the (unique) ID of the collection
|
50
|
+
attribute :id
|
51
|
+
|
52
|
+
# @!attribute account
|
53
|
+
# @return [LWS::Auth::Account] the account of the user that created the
|
54
|
+
# collection
|
55
|
+
belongs_to :account, class_name: "LWS::Auth::Account"
|
56
|
+
|
57
|
+
# @!attribute account_id
|
58
|
+
# @return [Fixnum] the ID of the account of the user that created the
|
59
|
+
# collection
|
60
|
+
attribute :account_id
|
61
|
+
|
62
|
+
# @!attribute company
|
63
|
+
# @return [LWS::Auth::Company] the company the collection belongs to
|
64
|
+
belongs_to :company, class_name: "LWS::Auth::Company"
|
65
|
+
|
66
|
+
# @!attribute company_id
|
67
|
+
# @return [Fixnum] the ID of the company the collection belongs to
|
68
|
+
attribute :company_id
|
69
|
+
|
70
|
+
# @!attribute folder
|
71
|
+
# @return [Folder] the folder that the collection is filed in
|
72
|
+
belongs_to :folder
|
73
|
+
|
74
|
+
# @!attribute folder_id
|
75
|
+
# @return [Fixnum] the ID of the folder that the collection is
|
76
|
+
# filed in
|
77
|
+
attribute :folder_id
|
78
|
+
|
79
|
+
# @!attribute items
|
80
|
+
# The returned object are of a class that is determined by the kind of
|
81
|
+
# this collection.
|
82
|
+
#
|
83
|
+
# @return [Collection::Item] the items that are part of the collection
|
84
|
+
has_many :items, class_name: "LWS::Resource::Collection::Item"
|
85
|
+
|
86
|
+
# @!attribute kind
|
87
|
+
# @return ["feed", "feeds", "image", "images", "video", "videos", "weather_location"]
|
88
|
+
# the name of the class/kind of the collection
|
89
|
+
attribute :kind
|
90
|
+
|
91
|
+
# @!attribute metadata
|
92
|
+
# @return [Hash] the metadata of the collection
|
93
|
+
attribute :metadata
|
94
|
+
|
95
|
+
# @!attribute name
|
96
|
+
# @return [String] the name of the collection
|
97
|
+
attribute :name
|
98
|
+
|
99
|
+
# @!attribute preview_url
|
100
|
+
# @return [String] the URL of a preview of the collection
|
101
|
+
attribute :preview_url
|
102
|
+
|
103
|
+
# @!attribute created_at [r]
|
104
|
+
# @return [String] the timestamp of when the collection was created
|
105
|
+
attribute :created_at
|
106
|
+
|
107
|
+
# @!attribute updated_at [r]
|
108
|
+
# @return [String] the timestamp of when the collection was last updated
|
109
|
+
attribute :updated_at
|
110
|
+
|
111
|
+
|
112
|
+
# @!group Collection Items Attribute Summary
|
113
|
+
|
114
|
+
# @!attribute feed
|
115
|
+
# @return [Collection::Feed] the feed that is part of the collection
|
116
|
+
# (if kind is +:feed+)
|
117
|
+
has_one :feed
|
118
|
+
|
119
|
+
# @!attribute feeds
|
120
|
+
# @return [Array<Collection::Feed>] the feeds that are part of the collection
|
121
|
+
# (if kind is +:feeds+)
|
122
|
+
has_many :feeds
|
123
|
+
|
124
|
+
# @!attribute image
|
125
|
+
# @return [Collection::Image] the image that is part of the collection
|
126
|
+
# (if kind is +:image+)
|
127
|
+
has_one :image
|
128
|
+
|
129
|
+
# @!attribute images
|
130
|
+
# @return [Array<Collection::Image>] the images that are part of the
|
131
|
+
# collection (if kind is +:images+)
|
132
|
+
has_many :images
|
133
|
+
|
134
|
+
# @!attribute video
|
135
|
+
# @return [Collection::Video] the video that is part of the collection
|
136
|
+
# (if kind is +:video+)
|
137
|
+
has_one :video
|
138
|
+
|
139
|
+
# @!attribute videos
|
140
|
+
# @return [Array<Collection::Video>] the videos that are part of the
|
141
|
+
# collection (if kind is +:videos+)
|
142
|
+
has_many :videos
|
143
|
+
|
144
|
+
# @!attribute weather_location
|
145
|
+
# @return [Collection::WeatherLocation] the weather collection that is
|
146
|
+
# part of the collection (if kind is +:weather_location+)
|
147
|
+
has_one :weather_location
|
148
|
+
|
149
|
+
# @!endgroup Collection Items Attribute Summary
|
150
|
+
end
|
151
|
+
|
152
|
+
# = The collection item class
|
153
|
+
class Collection::Item < LWS::Generic::Model
|
154
|
+
use_api LWS::Resource.api
|
155
|
+
uri "collections/:collection_id/items(/:id)"
|
156
|
+
|
157
|
+
# @!attribute id [r]
|
158
|
+
# @return [Fixnum] the (unique) ID of the collection item
|
159
|
+
attribute :id
|
160
|
+
|
161
|
+
# @!attribute collection
|
162
|
+
# @return [Collection] the collection that the collection item is a
|
163
|
+
# part of
|
164
|
+
belongs_to :collection
|
165
|
+
|
166
|
+
# @!attribute collection_id
|
167
|
+
# @return [Fixnum] the ID of the collection that the collection item is a
|
168
|
+
# part of
|
169
|
+
attribute :collection_id
|
170
|
+
|
171
|
+
# @!attribute name
|
172
|
+
# @return [String] the name of the collection item
|
173
|
+
attribute :name
|
174
|
+
|
175
|
+
# @!attribute created_at [r]
|
176
|
+
# @return [String] the timestamp of when the collection item was created
|
177
|
+
attribute :created_at
|
178
|
+
|
179
|
+
# @!attribute updated_at [r]
|
180
|
+
# @return [String] the timestamp of when the collection item was last updated
|
181
|
+
attribute :updated_at
|
182
|
+
end
|
183
|
+
|
184
|
+
# = The collection post class
|
185
|
+
class Collection::Post < Collection::Item
|
186
|
+
use_api LWS::Resource.api
|
187
|
+
|
188
|
+
# @!attribute author
|
189
|
+
# @return [String] the author of the post
|
190
|
+
attribute :author
|
191
|
+
|
192
|
+
# @!attribute avatar
|
193
|
+
# @return [Hash] the URL information of the avatar image of the post
|
194
|
+
attribute :avatar
|
195
|
+
|
196
|
+
# @!attribute category
|
197
|
+
# @return [String] the category of the post
|
198
|
+
attribute :category
|
199
|
+
|
200
|
+
# @!attribute comments
|
201
|
+
# @return [String] the comments of the post
|
202
|
+
attribute :comments
|
203
|
+
|
204
|
+
# @!attribute description
|
205
|
+
# @return [String] the description of the post
|
206
|
+
attribute :description
|
207
|
+
|
208
|
+
# @!attribute description
|
209
|
+
# @return [String] the description of the post
|
210
|
+
attribute :enclosures
|
211
|
+
|
212
|
+
# @!attribute guid
|
213
|
+
# @return [String] the GUID of the post
|
214
|
+
attribute :guid
|
215
|
+
|
216
|
+
# @!attribute handle
|
217
|
+
# @return [String] the handle of the post
|
218
|
+
attribute :handle
|
219
|
+
|
220
|
+
# @!attribute link
|
221
|
+
# @return [String] the link of the post
|
222
|
+
attribute :link
|
223
|
+
|
224
|
+
# @!attribute link
|
225
|
+
# @return [String] the timestamp of the modification date of the post
|
226
|
+
attribute :modification_date
|
227
|
+
|
228
|
+
# @!attribute order_priority
|
229
|
+
# @return [Fixnum] the order priority of the of the post (ascending;
|
230
|
+
# 0 is lowers)
|
231
|
+
attribute :order_priority
|
232
|
+
|
233
|
+
# @!attribute link
|
234
|
+
# @return [String] the timestamp of the publication date of the post
|
235
|
+
attribute :publication_date
|
236
|
+
|
237
|
+
# @!attribute source_url
|
238
|
+
# @return [String] the source URL of the post
|
239
|
+
attribute :source_url
|
240
|
+
|
241
|
+
# @!attribute summary
|
242
|
+
# @return [String] the summary of the post
|
243
|
+
attribute :summary
|
244
|
+
|
245
|
+
# @!attribute title
|
246
|
+
# @return [String] the title of the post
|
247
|
+
attribute :title
|
248
|
+
end
|
249
|
+
|
250
|
+
# = The collection feed class
|
251
|
+
class Collection::Feed < Collection::Item
|
252
|
+
use_api LWS::Resource.api
|
253
|
+
uri "collections/:collection_id/feeds(/:id)"
|
254
|
+
|
255
|
+
# @!attribute feed_url
|
256
|
+
# @return [String] the URL of the feed
|
257
|
+
attribute :feed_url
|
258
|
+
|
259
|
+
# @!attribute posts
|
260
|
+
# @return [Collection::Post] the posts included in the feed
|
261
|
+
has_many :posts,
|
262
|
+
class_name: "LWS::Resource::Collection::Feed::Post",
|
263
|
+
uri: "collections/:collection_id/feeds/:feed_id/posts(/:id)"
|
264
|
+
|
265
|
+
# @!attribute refresh_interval
|
266
|
+
# @return [Fixnum] the interval used to refresh the feed (in seconds)
|
267
|
+
attribute :refresh_interval
|
268
|
+
end
|
269
|
+
|
270
|
+
# = The collection feed post class
|
271
|
+
class Collection::Feed::Post < Collection::Post
|
272
|
+
uri "collections/:collection_id/feeds/:feed_id/posts(/:id)"
|
273
|
+
|
274
|
+
# @!attribute feed
|
275
|
+
# @return [Collection::Feed] the collection feed that the collection feed
|
276
|
+
# post is a part of
|
277
|
+
belongs_to :feed,
|
278
|
+
class_name: "LWS::Resource::Collection::Feed",
|
279
|
+
uri: "collections/:collection_id/feeds(/:id)"
|
280
|
+
|
281
|
+
# @!attribute feed_id
|
282
|
+
# @return [Fixnum] the ID of the collection feed that the collection
|
283
|
+
# feed is a post is part of
|
284
|
+
attribute :feed_id
|
285
|
+
end
|
286
|
+
|
287
|
+
# = The collection image class
|
288
|
+
class Collection::Image < Collection::Item
|
289
|
+
use_api LWS::Resource.api
|
290
|
+
uri "collections/:collection_id/images(/:id)"
|
291
|
+
|
292
|
+
# @!attribute data_url
|
293
|
+
# @return [String] the URL of the image
|
294
|
+
attribute :data_url
|
295
|
+
|
296
|
+
# @!attribute metadata
|
297
|
+
# @return [Hash] the metadata of the image
|
298
|
+
attribute :metadata
|
299
|
+
end
|
300
|
+
|
301
|
+
# = The collection video class
|
302
|
+
class Collection::Video < Collection::Item
|
303
|
+
use_api LWS::Resource.api
|
304
|
+
uri "collections/:collection_id/videos(/:id)"
|
305
|
+
|
306
|
+
# @!attribute data_url
|
307
|
+
# @return [String] the URL of the video
|
308
|
+
attribute :data_url
|
309
|
+
|
310
|
+
# @!attribute metadata
|
311
|
+
# @return [Hash] the metadata of the video
|
312
|
+
attribute :metadata
|
313
|
+
|
314
|
+
# @!attribute data_url
|
315
|
+
# @return [String] the URL of the thumbnail of the video
|
316
|
+
attribute :thumbnail_url
|
317
|
+
end
|
318
|
+
|
319
|
+
# = The collection weather location class
|
320
|
+
class Collection::WeatherLocation < Collection::Item
|
321
|
+
use_api LWS::Resource.api
|
322
|
+
uri "collections/:collection_id/weather_locations(/:id)"
|
323
|
+
|
324
|
+
# @!attribute city
|
325
|
+
# @return [String] the city of the weather location
|
326
|
+
attribute :city
|
327
|
+
|
328
|
+
# @!attribute country
|
329
|
+
# @return [String] the country of the weather location
|
330
|
+
attribute :country
|
331
|
+
|
332
|
+
# @!attribute description
|
333
|
+
# @return [String] the description of the weather location
|
334
|
+
attribute :description
|
335
|
+
|
336
|
+
# @!attribute feed_url
|
337
|
+
# @return [String] the URL of the feed of the weather location
|
338
|
+
attribute :feed_url
|
339
|
+
|
340
|
+
# @!attribute forecasts
|
341
|
+
# @return [Forecast] the forecasts for the weather location
|
342
|
+
has_many :forecasts,
|
343
|
+
class_name: "LWS::Resource::Collection::WeatherLocation::Forecast",
|
344
|
+
uri: "collections/:collection_id/weather_location/:weather_location_id/forecasts(/:id)"
|
345
|
+
|
346
|
+
# @!attribute kind
|
347
|
+
# @return ["unknown", "yahoo"] the kind of the weather location
|
348
|
+
attribute :kind
|
349
|
+
|
350
|
+
# @!attribute lat
|
351
|
+
# @return [Float, nil] the latitude of the weather location
|
352
|
+
attribute :lat
|
353
|
+
|
354
|
+
# @!attribute link
|
355
|
+
# @return [String] the link of the weather location
|
356
|
+
attribute :link
|
357
|
+
|
358
|
+
# @!attribute long
|
359
|
+
# @return [Float, nil] the longitude of the weather location
|
360
|
+
attribute :long
|
361
|
+
|
362
|
+
# @!attribute refresh_intervla
|
363
|
+
# @return [Fixnum] the interval used to refresh the weather location
|
364
|
+
# (in seconds)
|
365
|
+
attribute :refresh_interval
|
366
|
+
|
367
|
+
# @!attribute region
|
368
|
+
# @return [String] the region of the weather location
|
369
|
+
attribute :region
|
370
|
+
|
371
|
+
# @!attribute title
|
372
|
+
# @return [String] the title of the weather location
|
373
|
+
attribute :title
|
374
|
+
end
|
375
|
+
|
376
|
+
# = The collection weather location forecast class
|
377
|
+
class Collection::WeatherLocation::Forecast < Collection::Item
|
378
|
+
use_api LWS::Resource.api
|
379
|
+
uri "collections/:collection_id/weather_locations/:weather_location_id/forecasts(/:id)"
|
380
|
+
|
381
|
+
# @!attribute code
|
382
|
+
# @return [Fixnum] the code for the weather location forecast
|
383
|
+
attribute :code
|
384
|
+
|
385
|
+
# @!attribute date
|
386
|
+
# @return [Fixnum] the timestamp of the date of the weather location forecast
|
387
|
+
attribute :date
|
388
|
+
|
389
|
+
# @!attribute description
|
390
|
+
# @return [Fixnum] the description of the weather location forecast
|
391
|
+
attribute :description
|
392
|
+
|
393
|
+
# @!attribute observation
|
394
|
+
# @return [Boolean] whether the weather location forecast is a
|
395
|
+
# current observation
|
396
|
+
attribute :observation
|
397
|
+
|
398
|
+
# @!attribute temperature
|
399
|
+
# The temperature hash contains either the current temperature (key
|
400
|
+
# "now") if the forecast is an observation or the temperature range
|
401
|
+
# (keys "low" and "high") if it is not.
|
402
|
+
# @return [Hash{String=>Float}] the temperature information of the
|
403
|
+
# weather location forecast
|
404
|
+
attribute :temperature
|
405
|
+
|
406
|
+
# @!attribute weather_location
|
407
|
+
# @return [Collection::WeatherLocation] the collection weather location
|
408
|
+
# that the collection weather location post is a part of
|
409
|
+
belongs_to :weather_location,
|
410
|
+
class_name: "LWS::Resource::Collection::WeatherLocation",
|
411
|
+
uri: "collections/:collection_id/weather_location(/:id)"
|
412
|
+
|
413
|
+
# @!attribute weather_location_id
|
414
|
+
# @return [Fixnum] the ID of the collection weather location that the
|
415
|
+
# collection weather location is a post is part of
|
416
|
+
attribute :weather_location_id
|
417
|
+
|
418
|
+
# @!attribute wind
|
419
|
+
# The wind hash contains the wind chill temperature (key "chill"),
|
420
|
+
# direction in degrees (key "direction"), and wind speed (key "speed").
|
421
|
+
# @return [Hash{String=>Float}] the temperature information of the
|
422
|
+
# weather location forecast
|
423
|
+
attribute :wind
|
424
|
+
end
|
425
|
+
|
426
|
+
# = The folder class
|
427
|
+
class Folder < LWS::Generic::Model
|
428
|
+
use_api LWS::Resource.api
|
429
|
+
|
430
|
+
# @!attribute id [r]
|
431
|
+
# @return [Fixnum] the (unique) ID of the folder
|
432
|
+
attribute :id
|
433
|
+
|
434
|
+
# @!attribute account
|
435
|
+
# @return [LWS::Auth::Account] the account of the user that created
|
436
|
+
# the folder
|
437
|
+
belongs_to :account, class_name: "LWS::Auth::Account"
|
438
|
+
|
439
|
+
# @!attribute account_id
|
440
|
+
# @return [Fixnum] the ID of the account of the user that created
|
441
|
+
# the folder
|
442
|
+
attribute :account_id
|
443
|
+
|
444
|
+
# @!attribute collections
|
445
|
+
# @return [Array<Collection>] the collections filed in the folder
|
446
|
+
has_many :collections
|
447
|
+
|
448
|
+
# @!attribute company
|
449
|
+
# @return [LWS::Auth::Company] the company the folder belongs to
|
450
|
+
belongs_to :company, class_name: "LWS::Auth::Company"
|
451
|
+
|
452
|
+
# @!attribute company_id
|
453
|
+
# @return [Fixnum] the ID of the company the folder belongs to
|
454
|
+
attribute :company_id
|
455
|
+
|
456
|
+
# @!attribute folders
|
457
|
+
# @return [Array<Folder>] the folders contained in the folder
|
458
|
+
has_many :folders
|
459
|
+
|
460
|
+
# @!attribute favourite
|
461
|
+
# @return [Boolean] flag whether the folder is considered as a favourite
|
462
|
+
attribute :favourite
|
463
|
+
|
464
|
+
# @!attribute name
|
465
|
+
# @return [String] the name of the folder
|
466
|
+
attribute :name
|
467
|
+
|
468
|
+
# @!attribute parent
|
469
|
+
# @return [Folder, nil] the parent folder of the folder
|
470
|
+
belongs_to :parent, class_name: "LWS::Resource::Folder",
|
471
|
+
foreign_key: "parent_id"
|
472
|
+
|
473
|
+
# @!attribute parent_id
|
474
|
+
# @return [Fixnum, nil] the ID of the parent folder of the folder
|
475
|
+
attribute :parent_id
|
476
|
+
|
477
|
+
# @!attribute created_at [r]
|
478
|
+
# @return [String] the timestamp of when the folder was created
|
479
|
+
attribute :created_at
|
480
|
+
|
481
|
+
# @!attribute updated_at [r]
|
482
|
+
# @return [String] the timestamp of when the folder was last updated
|
483
|
+
attribute :updated_at
|
484
|
+
end
|
485
|
+
|
486
|
+
end
|
data/lib/lws/version.rb
CHANGED
@@ -16,7 +16,8 @@ class TestCorporateWebsiteArticle < MiniTest::Test
|
|
16
16
|
include LWS::CorporateWebsite
|
17
17
|
|
18
18
|
def setup
|
19
|
-
@
|
19
|
+
@page = Page.all.first
|
20
|
+
@article = @page.articles.first
|
20
21
|
end
|
21
22
|
|
22
23
|
def test_valid
|
@@ -25,6 +26,11 @@ class TestCorporateWebsiteArticle < MiniTest::Test
|
|
25
26
|
refute_nil(@article.id)
|
26
27
|
end
|
27
28
|
|
29
|
+
def test_valid_associations
|
30
|
+
assert_instance_of(Page, @article.page)
|
31
|
+
assert_equal(@page, @article.page)
|
32
|
+
end
|
33
|
+
|
28
34
|
end
|
29
35
|
|
30
36
|
class TestCorporateWebsiteOfficeTime < MiniTest::Test
|
@@ -43,6 +49,26 @@ class TestCorporateWebsiteOfficeTime < MiniTest::Test
|
|
43
49
|
|
44
50
|
end
|
45
51
|
|
52
|
+
class TestCorporateWebsitePage < MiniTest::Test
|
53
|
+
|
54
|
+
include LWS::CorporateWebsite
|
55
|
+
|
56
|
+
def setup
|
57
|
+
@page = Page.all.first
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_valid
|
61
|
+
refute_nil(@page)
|
62
|
+
assert_instance_of(Page, @page)
|
63
|
+
refute_nil(@page.id)
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_valid_associations
|
67
|
+
assert_instance_of(Article, @page.articles.first)
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
46
72
|
# FIXME: There is no social page to test
|
47
73
|
#class TestCorporateWebsiteSocialPage < MiniTest::Test
|
48
74
|
#
|
@@ -0,0 +1,90 @@
|
|
1
|
+
#
|
2
|
+
# Copyright © 2016 LeftClick B.V.
|
3
|
+
#
|
4
|
+
# This software is property of LeftClick B.V. and cannot be redistributed
|
5
|
+
# and/or modified without permission. The software or any of its parts
|
6
|
+
# cannot be used for any other purposes than the LeftClick services and
|
7
|
+
# only during a valid license subscription. For more information, please
|
8
|
+
# contact LeftClick B.V. at: Geldropseweg 8B, 5731 SG Mierlo, The
|
9
|
+
# Netherlands, info@leftclick.eu, +31492-782120.
|
10
|
+
|
11
|
+
|
12
|
+
require "test_helper"
|
13
|
+
|
14
|
+
# FIXME: Cannot reach the following classes yet:
|
15
|
+
# * Collection::Feed
|
16
|
+
# * Collection::Feed::Post
|
17
|
+
# * Collection::Image
|
18
|
+
# * Collection::Post
|
19
|
+
# * Collection::Video
|
20
|
+
# * Collection::WeatherLocation
|
21
|
+
# * Collection::WeatherLocation::Forecast
|
22
|
+
|
23
|
+
class TestCollection < MiniTest::Test
|
24
|
+
|
25
|
+
include LWS::Resource
|
26
|
+
|
27
|
+
def setup
|
28
|
+
@collection = Collection.all.first # FIXME
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_valid
|
32
|
+
refute_nil(@collection)
|
33
|
+
assert_instance_of(Collection, @collection)
|
34
|
+
refute_nil(@collection.id)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_valid_associations
|
38
|
+
assert_instance_of(LWS::Auth::Account, @collection.account)
|
39
|
+
assert_instance_of(LWS::Auth::Company, @collection.company)
|
40
|
+
assert_instance_of(Folder, @collection.folder)
|
41
|
+
# FIXME: Test the collection item relations based on @collection.kind
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
class TestCollectionItem < MiniTest::Test
|
47
|
+
|
48
|
+
include LWS::Resource
|
49
|
+
|
50
|
+
def setup
|
51
|
+
@collection = Collection.where(includes: "items").first # FIXME
|
52
|
+
@collection_item = @collection.items.first
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_valid
|
56
|
+
refute_nil(@collection_item)
|
57
|
+
assert_instance_of(Collection::Item, @collection_item)
|
58
|
+
refute_nil(@collection_item.id)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_valid_associations
|
62
|
+
assert_instance_of(Collection, @collection_item.collection)
|
63
|
+
assert_equal(@collection, @collection_item.collection)
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
class TestFolder < MiniTest::Test
|
69
|
+
|
70
|
+
include LWS::Resource
|
71
|
+
|
72
|
+
def setup
|
73
|
+
@folder = Folder.all.first
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_valid
|
77
|
+
refute_nil(@folder)
|
78
|
+
assert_instance_of(Folder, @folder)
|
79
|
+
refute_nil(@folder.id)
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_valid_associations
|
83
|
+
assert_instance_of(LWS::Auth::Account, @folder.account)
|
84
|
+
assert_instance_of(Collection, @folder.collections.first)
|
85
|
+
assert_instance_of(LWS::Auth::Company, @folder.company)
|
86
|
+
# FIXME: Not available as data yet
|
87
|
+
#assert_instance_of(Folder, @folder.folders.first)
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LeftClick B.V.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday_middleware
|
@@ -230,6 +230,7 @@ files:
|
|
230
230
|
- lib/lws/apps/generic.rb
|
231
231
|
- lib/lws/apps/maps.rb
|
232
232
|
- lib/lws/apps/presence.rb
|
233
|
+
- lib/lws/apps/resource.rb
|
233
234
|
- lib/lws/apps/ticket.rb
|
234
235
|
- lib/lws/config.rb
|
235
236
|
- lib/lws/errors.rb
|
@@ -259,6 +260,7 @@ files:
|
|
259
260
|
- test/logger_test.rb
|
260
261
|
- test/maps_test.rb
|
261
262
|
- test/presence_test.rb
|
263
|
+
- test/resource_test.rb
|
262
264
|
- test/setup_test.rb
|
263
265
|
- test/stubbing_test.rb
|
264
266
|
- test/support/with_env.rb
|
@@ -283,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
283
285
|
version: '0'
|
284
286
|
requirements: []
|
285
287
|
rubyforge_project:
|
286
|
-
rubygems_version: 2.
|
288
|
+
rubygems_version: 2.7.6
|
287
289
|
signing_key:
|
288
290
|
specification_version: 4
|
289
291
|
summary: LeftClick web services library for Ruby
|
@@ -306,6 +308,7 @@ test_files:
|
|
306
308
|
- test/logger_test.rb
|
307
309
|
- test/maps_test.rb
|
308
310
|
- test/presence_test.rb
|
311
|
+
- test/resource_test.rb
|
309
312
|
- test/setup_test.rb
|
310
313
|
- test/stubbing_test.rb
|
311
314
|
- test/support/with_env.rb
|