lws 7.2.3 → 7.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/lwsconsole +1 -1
- data/lib/lws/apps/auth.rb +13 -14
- data/lib/lws/apps/corporate_website.rb +13 -13
- data/lib/lws/apps/digital_signage.rb +24 -15
- data/lib/lws/apps/generic.rb +33 -11
- data/lib/lws/apps/maps.rb +13 -13
- data/lib/lws/apps/presence.rb +23 -13
- data/lib/lws/apps/resource.rb +13 -13
- data/lib/lws/apps/ticket.rb +13 -13
- data/lib/lws/config.rb +50 -17
- data/lib/lws/errors.rb +8 -7
- data/lib/lws/middleware/http_logger.rb +8 -7
- data/lib/lws/middleware/json_logger.rb +8 -7
- data/lib/lws/middleware/json_parser.rb +8 -7
- data/lib/lws/middleware/request_headers.rb +8 -7
- data/lib/lws/middleware.rb +8 -7
- data/lib/lws/stubbing.rb +8 -7
- data/lib/lws/version.rb +9 -8
- data/lib/lws.rb +10 -10
- data/test/api_token_middleware_test.rb +8 -7
- data/test/auth_test.rb +8 -7
- data/test/caching_test.rb +8 -7
- data/test/config/full.yml +1 -0
- data/test/corporate_website_test.rb +8 -7
- data/test/digital_signage_test.rb +10 -9
- data/test/generic_test.rb +8 -7
- data/test/http_caching_test.rb +8 -7
- data/test/json_parser_test.rb +8 -7
- data/test/logger_test.rb +8 -7
- data/test/maps_test.rb +8 -7
- data/test/presence_test.rb +8 -7
- data/test/resource_test.rb +8 -7
- data/test/setup_test.rb +55 -9
- data/test/stubbing_test.rb +8 -7
- data/test/support/with_env.rb +8 -7
- data/test/test_helper.rb +8 -7
- data/test/ticket_test.rb +8 -7
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3537305fd2e0820336aeae72b893d57e81f7c5e89c1439ad11ceab621c98fe7
|
4
|
+
data.tar.gz: 24be84fdc5a329eed12a2d5b0cfe5a2e950e44a44b99b335fd9d1a0329cb2286
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53bdca49fdb5085a4d9cd55df5e840155f6cbff9f0370edd74bc494abadeac971829266201d3c4ac8d870b252cd50b0e276b5e1e89b65b9f20c751d74f1761a5
|
7
|
+
data.tar.gz: aa06286ad53e4947e12ed41258094a352f19d6b4f379167418ac70f442926a3cc19a9a0aa43f5c0bf83ca617a0efe6114fe266092aaec671f95edb478252cf7f
|
data/bin/lwsconsole
CHANGED
@@ -36,7 +36,7 @@ EOB
|
|
36
36
|
@options[:debug] = debug
|
37
37
|
end
|
38
38
|
opts.on("-e", "--environment=ENV", "select the LWS environment (default: production)") do |env|
|
39
|
-
@options[:environment] = env
|
39
|
+
@options[:environment] = env
|
40
40
|
end
|
41
41
|
opts.on("-t", "--token=TOKEN", "the LWS API token necessary to gain access") do |token|
|
42
42
|
@options[:token] = token
|
data/lib/lws/apps/auth.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
#
|
2
|
-
# Copyright © 2016–
|
2
|
+
# Copyright © 2016–2021 LeftClick Web Services B.V.
|
3
3
|
#
|
4
|
-
# This software is property of LeftClick B.V. and cannot be
|
5
|
-
# and/or modified without permission. The software or any
|
6
|
-
# cannot be used for any other purposes than the LeftClick
|
7
|
-
# only during a valid license subscription. For more
|
8
|
-
# contact LeftClick B.V. at:
|
9
|
-
#
|
4
|
+
# This software is property of LeftClick Web Services B.V. and cannot be
|
5
|
+
# redistributed and/or modified without permission. The software or any
|
6
|
+
# of its parts cannot be used for any other purposes than the LeftClick
|
7
|
+
# services and only during a valid license subscription. For more
|
8
|
+
# information, please contact LeftClick Web Services B.V. at:
|
9
|
+
# Schootense Dreef 20A, 5708 HZ Helmond, The Netherlands,
|
10
|
+
# info@leftclick.eu, +3185-4444-004.
|
10
11
|
|
11
12
|
|
12
13
|
# = The auth app module
|
@@ -14,18 +15,16 @@ module LWS::Auth
|
|
14
15
|
|
15
16
|
# :nocov:
|
16
17
|
unless defined? ENDPOINT
|
17
|
-
#
|
18
|
+
# @!method self.endpoint
|
19
|
+
# @return [String] the actual API endpoint used to reach the app
|
20
|
+
|
21
|
+
# The API endpoint environment mapping for the Auth app
|
18
22
|
ENDPOINT = { production: "https://leftclick.cloud/" ,
|
19
23
|
development: "https://dev.leftclick.cloud/" }
|
20
24
|
end
|
21
25
|
# :nocov:
|
22
26
|
|
23
|
-
|
24
|
-
class << self
|
25
|
-
attr_accessor :api
|
26
|
-
end
|
27
|
-
@api = LWS.setup_api(LWS.config.endpoints[:auth] ||
|
28
|
-
ENDPOINT[LWS.config.environment])
|
27
|
+
include LWS::Generic
|
29
28
|
|
30
29
|
### Generic classes
|
31
30
|
|
@@ -1,12 +1,13 @@
|
|
1
1
|
#
|
2
|
-
# Copyright © 2016–
|
2
|
+
# Copyright © 2016–2021 LeftClick Web Services B.V.
|
3
3
|
#
|
4
|
-
# This software is property of LeftClick B.V. and cannot be
|
5
|
-
# and/or modified without permission. The software or any
|
6
|
-
# cannot be used for any other purposes than the LeftClick
|
7
|
-
# only during a valid license subscription. For more
|
8
|
-
# contact LeftClick B.V. at:
|
9
|
-
#
|
4
|
+
# This software is property of LeftClick Web Services B.V. and cannot be
|
5
|
+
# redistributed and/or modified without permission. The software or any
|
6
|
+
# of its parts cannot be used for any other purposes than the LeftClick
|
7
|
+
# services and only during a valid license subscription. For more
|
8
|
+
# information, please contact LeftClick Web Services B.V. at:
|
9
|
+
# Schootense Dreef 20A, 5708 HZ Helmond, The Netherlands,
|
10
|
+
# info@leftclick.eu, +3185-4444-004.
|
10
11
|
|
11
12
|
|
12
13
|
# = The corporate website app module
|
@@ -14,17 +15,16 @@ module LWS::CorporateWebsite
|
|
14
15
|
|
15
16
|
# :nocov:
|
16
17
|
unless defined? ENDPOINT
|
17
|
-
#
|
18
|
+
# @!method self.endpoint
|
19
|
+
# @return [String] the actual API endpoint used to reach the app
|
20
|
+
|
21
|
+
# The API endpoint environment mapping for the Corporate Website app
|
18
22
|
ENDPOINT = { production: "https://www.leftclick.cloud/",
|
19
23
|
development: "https://www-dev.leftclick.cloud/" }
|
20
24
|
end
|
21
25
|
# :nocov:
|
22
26
|
|
23
|
-
|
24
|
-
def self.api
|
25
|
-
LWS.setup_api(LWS.config.endpoints[:corporate_website] ||
|
26
|
-
ENDPOINT[LWS.config.environment])
|
27
|
-
end
|
27
|
+
include LWS::Generic
|
28
28
|
|
29
29
|
### Generic classes
|
30
30
|
|
@@ -1,12 +1,13 @@
|
|
1
1
|
#
|
2
|
-
# Copyright © 2016–
|
2
|
+
# Copyright © 2016–2021 LeftClick Web Services B.V.
|
3
3
|
#
|
4
|
-
# This software is property of LeftClick B.V. and cannot be
|
5
|
-
# and/or modified without permission. The software or any
|
6
|
-
# cannot be used for any other purposes than the LeftClick
|
7
|
-
# only during a valid license subscription. For more
|
8
|
-
# contact LeftClick B.V. at:
|
9
|
-
#
|
4
|
+
# This software is property of LeftClick Web Services B.V. and cannot be
|
5
|
+
# redistributed and/or modified without permission. The software or any
|
6
|
+
# of its parts cannot be used for any other purposes than the LeftClick
|
7
|
+
# services and only during a valid license subscription. For more
|
8
|
+
# information, please contact LeftClick Web Services B.V. at:
|
9
|
+
# Schootense Dreef 20A, 5708 HZ Helmond, The Netherlands,
|
10
|
+
# info@leftclick.eu, +3185-4444-004.
|
10
11
|
|
11
12
|
|
12
13
|
# = The digital_signage app module
|
@@ -14,17 +15,16 @@ module LWS::DigitalSignage
|
|
14
15
|
|
15
16
|
# :nocov:
|
16
17
|
unless defined? ENDPOINT
|
17
|
-
#
|
18
|
+
# @!method self.endpoint
|
19
|
+
# @return [String] the actual endpoint used to reach the app
|
20
|
+
|
21
|
+
# The API endpoint environment mapping for the Digital Signage app
|
18
22
|
ENDPOINT = { production: "https://cm.leftclick.cloud/" ,
|
19
23
|
development: "https://cm-dev.leftclick.cloud/" }
|
20
24
|
end
|
21
25
|
# :nocov:
|
22
26
|
|
23
|
-
|
24
|
-
def self.api
|
25
|
-
LWS.setup_api(LWS.config.endpoints[:digital_signage] ||
|
26
|
-
ENDPOINT[LWS.config.environment])
|
27
|
-
end
|
27
|
+
include LWS::Generic
|
28
28
|
|
29
29
|
### Generic classes
|
30
30
|
|
@@ -78,6 +78,11 @@ module LWS::DigitalSignage
|
|
78
78
|
# @return [Array<Channel::Group>] the groups the channel is a member of
|
79
79
|
has_many :groups, class_name: "LWS::DigitalSignage::Channel::Group"
|
80
80
|
|
81
|
+
# @!attribute layout_kind
|
82
|
+
# @return ["default", "stage"] the layout (version) kinds to consider
|
83
|
+
# when generating a playlist for the channel
|
84
|
+
attribute :layout_kind
|
85
|
+
|
81
86
|
# @!attribute marquee_config
|
82
87
|
# @return [String] the marquee/ticker tape configuration (JSON) of the channel
|
83
88
|
attribute :marquee_config
|
@@ -809,8 +814,8 @@ module LWS::DigitalSignage
|
|
809
814
|
attribute :rotation_angle
|
810
815
|
|
811
816
|
# @!attribute status [r]
|
812
|
-
# @return ["initializing", "creating_pack", "creating_thumbnail",
|
813
|
-
# the status of the layout version
|
817
|
+
# @return ["initializing", "creating_pack", "creating_thumbnail",
|
818
|
+
# "available", "archive", "stage"] the status of the layout version
|
814
819
|
attribute :status
|
815
820
|
|
816
821
|
# @!attribute thumbnail_url
|
@@ -1805,6 +1810,10 @@ module LWS::DigitalSignage
|
|
1805
1810
|
# @!attribute thumbnail_url
|
1806
1811
|
# @return [String, nil] the URL of the thumbnail of the slide
|
1807
1812
|
attribute :thumbnail_url
|
1813
|
+
|
1814
|
+
# @!attribute uuid
|
1815
|
+
# @return [String] the UUID of the slide
|
1816
|
+
attribute :uuid
|
1808
1817
|
end
|
1809
1818
|
|
1810
1819
|
# = The slide schedule class
|
data/lib/lws/apps/generic.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
#
|
2
|
-
# Copyright © 2016–
|
2
|
+
# Copyright © 2016–2021 LeftClick Web Services B.V.
|
3
3
|
#
|
4
|
-
# This software is property of LeftClick B.V. and cannot be
|
5
|
-
# and/or modified without permission. The software or any
|
6
|
-
# cannot be used for any other purposes than the LeftClick
|
7
|
-
# only during a valid license subscription. For more
|
8
|
-
# contact LeftClick B.V. at:
|
9
|
-
#
|
4
|
+
# This software is property of LeftClick Web Services B.V. and cannot be
|
5
|
+
# redistributed and/or modified without permission. The software or any
|
6
|
+
# of its parts cannot be used for any other purposes than the LeftClick
|
7
|
+
# services and only during a valid license subscription. For more
|
8
|
+
# information, please contact LeftClick Web Services B.V. at:
|
9
|
+
# Schootense Dreef 20A, 5708 HZ Helmond, The Netherlands,
|
10
|
+
# info@leftclick.eu, +3185-4444-004.
|
10
11
|
|
11
12
|
|
12
13
|
# = The generic app module
|
@@ -14,6 +15,25 @@
|
|
14
15
|
# This module contains classes that are present in all applications.
|
15
16
|
module LWS::Generic
|
16
17
|
|
18
|
+
def self.included(app_mod)
|
19
|
+
app_mod.module_eval do |mod|
|
20
|
+
# Set up the API using the configured or default endpoint for the current
|
21
|
+
# environment.
|
22
|
+
endpoints = mod.const_get(:ENDPOINT)
|
23
|
+
app_name = mod.name.demodulize.underscore.to_sym
|
24
|
+
@api = LWS.setup_api(LWS.config.endpoints[app_name] ||
|
25
|
+
endpoints[LWS.config.environment])
|
26
|
+
|
27
|
+
def self.api
|
28
|
+
@api
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.endpoint
|
32
|
+
@api.url_prefix.to_s
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
17
37
|
# = The generic model class
|
18
38
|
#
|
19
39
|
# This model forms the base for all LWS models.
|
@@ -203,11 +223,13 @@ module LWS::Generic
|
|
203
223
|
def self.use_api(api)
|
204
224
|
config = LWS.config
|
205
225
|
|
206
|
-
#
|
207
|
-
#
|
208
|
-
@as_connection = Faraday.new(url: api.url_prefix) do |c|
|
226
|
+
# An API connection to Active Storage (with JSON request/response, but
|
227
|
+
# without caching).
|
228
|
+
@as_connection = Faraday.new(url: api.url_prefix, proxy: config.proxy) do |c|
|
209
229
|
# Request
|
210
230
|
c.request :json
|
231
|
+
c.use LWS::Middleware::RequestHeaders, config.api_token
|
232
|
+
c.use config.api_token_middleware if config.api_token_middleware.present?
|
211
233
|
|
212
234
|
# Response
|
213
235
|
c.use LWS::JSONLogger, config.logger if config.json_debug
|
@@ -223,7 +245,7 @@ module LWS::Generic
|
|
223
245
|
|
224
246
|
# A plain file connection to LWS (with token autnentication and caching but without
|
225
247
|
# JSON request/response).
|
226
|
-
@lws_connection = Faraday.new(url: api.url_prefix) do |c|
|
248
|
+
@lws_connection = Faraday.new(url: api.url_prefix, proxy: config.proxy) do |c|
|
227
249
|
# Request
|
228
250
|
if config.caching_object
|
229
251
|
c.use FaradayMiddleware::Caching, config.caching_object
|
data/lib/lws/apps/maps.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
#
|
2
|
-
# Copyright © 2016–
|
2
|
+
# Copyright © 2016–2021 LeftClick Web Services B.V.
|
3
3
|
#
|
4
|
-
# This software is property of LeftClick B.V. and cannot be
|
5
|
-
# and/or modified without permission. The software or any
|
6
|
-
# cannot be used for any other purposes than the LeftClick
|
7
|
-
# only during a valid license subscription. For more
|
8
|
-
# contact LeftClick B.V. at:
|
9
|
-
#
|
4
|
+
# This software is property of LeftClick Web Services B.V. and cannot be
|
5
|
+
# redistributed and/or modified without permission. The software or any
|
6
|
+
# of its parts cannot be used for any other purposes than the LeftClick
|
7
|
+
# services and only during a valid license subscription. For more
|
8
|
+
# information, please contact LeftClick Web Services B.V. at:
|
9
|
+
# Schootense Dreef 20A, 5708 HZ Helmond, The Netherlands,
|
10
|
+
# info@leftclick.eu, +3185-4444-004.
|
10
11
|
|
11
12
|
|
12
13
|
# = The maps app module
|
@@ -14,17 +15,16 @@ module LWS::Maps
|
|
14
15
|
|
15
16
|
# :nocov:
|
16
17
|
unless defined? ENDPOINT
|
17
|
-
#
|
18
|
+
# @!method self.endpoint
|
19
|
+
# @return [String] the actual API endpoint used to reach the app
|
20
|
+
|
21
|
+
# The API endpoint environment mapping for the Maps app
|
18
22
|
ENDPOINT = { production: "https://maps.leftclick.cloud/",
|
19
23
|
development: "https://maps-dev.leftclick.cloud/" }
|
20
24
|
end
|
21
25
|
# :nocov:
|
22
26
|
|
23
|
-
|
24
|
-
def self.api
|
25
|
-
LWS.setup_api(LWS.config.endpoints[:maps] ||
|
26
|
-
ENDPOINT[LWS.config.environment])
|
27
|
-
end
|
27
|
+
include LWS::Generic
|
28
28
|
|
29
29
|
### Generic classes
|
30
30
|
|
data/lib/lws/apps/presence.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
#
|
2
|
-
# Copyright © 2016–
|
2
|
+
# Copyright © 2016–2021 LeftClick Web Services B.V.
|
3
3
|
#
|
4
|
-
# This software is property of LeftClick B.V. and cannot be
|
5
|
-
# and/or modified without permission. The software or any
|
6
|
-
# cannot be used for any other purposes than the LeftClick
|
7
|
-
# only during a valid license subscription. For more
|
8
|
-
# contact LeftClick B.V. at:
|
9
|
-
#
|
4
|
+
# This software is property of LeftClick Web Services B.V. and cannot be
|
5
|
+
# redistributed and/or modified without permission. The software or any
|
6
|
+
# of its parts cannot be used for any other purposes than the LeftClick
|
7
|
+
# services and only during a valid license subscription. For more
|
8
|
+
# information, please contact LeftClick Web Services B.V. at:
|
9
|
+
# Schootense Dreef 20A, 5708 HZ Helmond, The Netherlands,
|
10
|
+
# info@leftclick.eu, +3185-4444-004.
|
10
11
|
|
11
12
|
|
12
13
|
# = The presence app module
|
@@ -14,17 +15,16 @@ module LWS::Presence
|
|
14
15
|
|
15
16
|
# :nocov:
|
16
17
|
unless defined? ENDPOINT
|
17
|
-
#
|
18
|
+
# @!method self.endpoint
|
19
|
+
# @return [String] the actual API endpoint used to reach the app
|
20
|
+
|
21
|
+
# The API endpoint environment mapping for the Presence app
|
18
22
|
ENDPOINT = { production: "https://presence.leftclick.cloud/",
|
19
23
|
development: "https://presence-dev.leftclick.cloud/" }
|
20
24
|
end
|
21
25
|
# :nocov:
|
22
26
|
|
23
|
-
|
24
|
-
def self.api
|
25
|
-
LWS.setup_api(LWS.config.endpoints[:presence] ||
|
26
|
-
ENDPOINT[LWS.config.environment])
|
27
|
-
end
|
27
|
+
include LWS::Generic
|
28
28
|
|
29
29
|
### Generic classes
|
30
30
|
|
@@ -220,6 +220,11 @@ module LWS::Presence
|
|
220
220
|
# @return [String, nil] reference of the location in the remote database
|
221
221
|
attribute :import_ref
|
222
222
|
|
223
|
+
# @!attribute invite_remarks
|
224
|
+
# @return [String, nil] the remarks to add when sending invites for
|
225
|
+
# appointments involving the location
|
226
|
+
attribute :invite_remarks
|
227
|
+
|
223
228
|
# @!attribute journals
|
224
229
|
# @return [Array<Journal>] the journal (entries) associated with the location
|
225
230
|
has_many :journals, class: "LWS::Presence::Journal"
|
@@ -288,6 +293,11 @@ module LWS::Presence
|
|
288
293
|
# @return [Array<Reader>] the (RFID/code/ID/...) readers linked to this location
|
289
294
|
has_many :readers
|
290
295
|
|
296
|
+
# @!attribute reservation_required
|
297
|
+
# @return [Boolean] whether a reservation is required for checking in to
|
298
|
+
# this location
|
299
|
+
attribute :reservation_required
|
300
|
+
|
291
301
|
# @!attribute status
|
292
302
|
# @return ["available", "maintenance_cleaning",
|
293
303
|
# "maintenance_technical", "reserved", "unavailable",
|
data/lib/lws/apps/resource.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
#
|
2
|
-
# Copyright © 2016–
|
2
|
+
# Copyright © 2016–2021 LeftClick Web Services B.V.
|
3
3
|
#
|
4
|
-
# This software is property of LeftClick B.V. and cannot be
|
5
|
-
# and/or modified without permission. The software or any
|
6
|
-
# cannot be used for any other purposes than the LeftClick
|
7
|
-
# only during a valid license subscription. For more
|
8
|
-
# contact LeftClick B.V. at:
|
9
|
-
#
|
4
|
+
# This software is property of LeftClick Web Services B.V. and cannot be
|
5
|
+
# redistributed and/or modified without permission. The software or any
|
6
|
+
# of its parts cannot be used for any other purposes than the LeftClick
|
7
|
+
# services and only during a valid license subscription. For more
|
8
|
+
# information, please contact LeftClick Web Services B.V. at:
|
9
|
+
# Schootense Dreef 20A, 5708 HZ Helmond, The Netherlands,
|
10
|
+
# info@leftclick.eu, +3185-4444-004.
|
10
11
|
|
11
12
|
|
12
13
|
# = The resource app module
|
@@ -14,17 +15,16 @@ module LWS::Resource
|
|
14
15
|
|
15
16
|
# :nocov:
|
16
17
|
unless defined? ENDPOINT
|
17
|
-
#
|
18
|
+
# @!method self.endpoint
|
19
|
+
# @return [String] the actual API endpoint used to reach the app
|
20
|
+
|
21
|
+
# The API endpoint environment mapping for the Resource app
|
18
22
|
ENDPOINT = { production: "https://resource.leftclick.cloud/",
|
19
23
|
development: "https://resource-dev.leftclick.cloud/" }
|
20
24
|
end
|
21
25
|
# :nocov:
|
22
26
|
|
23
|
-
|
24
|
-
def self.api
|
25
|
-
LWS.setup_api(LWS.config.endpoints[:resource] ||
|
26
|
-
ENDPOINT[LWS.config.environment])
|
27
|
-
end
|
27
|
+
include LWS::Generic
|
28
28
|
|
29
29
|
### Generic classes
|
30
30
|
|
data/lib/lws/apps/ticket.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
#
|
2
|
-
# Copyright © 2016–
|
2
|
+
# Copyright © 2016–2021 LeftClick Web Services B.V.
|
3
3
|
#
|
4
|
-
# This software is property of LeftClick B.V. and cannot be
|
5
|
-
# and/or modified without permission. The software or any
|
6
|
-
# cannot be used for any other purposes than the LeftClick
|
7
|
-
# only during a valid license subscription. For more
|
8
|
-
# contact LeftClick B.V. at:
|
9
|
-
#
|
4
|
+
# This software is property of LeftClick Web Services B.V. and cannot be
|
5
|
+
# redistributed and/or modified without permission. The software or any
|
6
|
+
# of its parts cannot be used for any other purposes than the LeftClick
|
7
|
+
# services and only during a valid license subscription. For more
|
8
|
+
# information, please contact LeftClick Web Services B.V. at:
|
9
|
+
# Schootense Dreef 20A, 5708 HZ Helmond, The Netherlands,
|
10
|
+
# info@leftclick.eu, +3185-4444-004.
|
10
11
|
|
11
12
|
|
12
13
|
# = The ticket app module
|
@@ -14,17 +15,16 @@ module LWS::Ticket
|
|
14
15
|
|
15
16
|
# :nocov:
|
16
17
|
unless defined? ENDPOINT
|
17
|
-
#
|
18
|
+
# @!method self.endpoint
|
19
|
+
# @return [String] the actual API endpoint used to reach the app
|
20
|
+
|
21
|
+
# The API endpoint environment mapping for the Ticket app
|
18
22
|
ENDPOINT = { production: "https://ticket.leftclick.cloud/",
|
19
23
|
development: "https://ticket-dev.leftclick.cloud/" }
|
20
24
|
end
|
21
25
|
# :nocov:
|
22
26
|
|
23
|
-
|
24
|
-
def self.api
|
25
|
-
LWS.setup_api(LWS.config.endpoints[:ticket] ||
|
26
|
-
ENDPOINT[LWS.config.environment])
|
27
|
-
end
|
27
|
+
include LWS::Generic
|
28
28
|
|
29
29
|
### Generic classes
|
30
30
|
|
data/lib/lws/config.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
#
|
2
|
-
# Copyright © 2016–
|
2
|
+
# Copyright © 2016–2021 LeftClick Web Services B.V.
|
3
3
|
#
|
4
|
-
# This software is property of LeftClick B.V. and cannot be
|
5
|
-
# and/or modified without permission. The software or any
|
6
|
-
# cannot be used for any other purposes than the LeftClick
|
7
|
-
# only during a valid license subscription. For more
|
8
|
-
# contact LeftClick B.V. at:
|
9
|
-
#
|
10
|
-
|
4
|
+
# This software is property of LeftClick Web Services B.V. and cannot be
|
5
|
+
# redistributed and/or modified without permission. The software or any
|
6
|
+
# of its parts cannot be used for any other purposes than the LeftClick
|
7
|
+
# services and only during a valid license subscription. For more
|
8
|
+
# information, please contact LeftClick Web Services B.V. at:
|
9
|
+
# Schootense Dreef 20A, 5708 HZ Helmond, The Netherlands,
|
10
|
+
# info@leftclick.eu, +3185-4444-004.
|
11
11
|
|
12
12
|
module LWS
|
13
13
|
|
@@ -20,7 +20,9 @@ module LWS
|
|
20
20
|
# configured for the library to work properly!
|
21
21
|
class Config < Hashie::Dash
|
22
22
|
# The list of properties that can be set using a config file.
|
23
|
-
VALID_FILE_PROPERTIES =
|
23
|
+
VALID_FILE_PROPERTIES =
|
24
|
+
[:api_token, :endpoints, :environment, :http_debug, :http_debug_headers,
|
25
|
+
:json_debug, :proxy]
|
24
26
|
|
25
27
|
#@!attribute api_token
|
26
28
|
# @return [String, nil] the API token necessary to gain access
|
@@ -76,13 +78,42 @@ module LWS
|
|
76
78
|
# (Rails logger, Logger, etc.)
|
77
79
|
property :logger
|
78
80
|
|
81
|
+
#@!attribute proxy
|
82
|
+
# When passing a Hash, it should at least contain +:uri+ as key with
|
83
|
+
# a String or URI as value and optionally the +:user+ and +:password+
|
84
|
+
# keys with appropriate values.
|
85
|
+
# @return [Hash, String, URI] the proxy configuration, either as URL or
|
86
|
+
# as a Hash
|
87
|
+
property :proxy
|
88
|
+
|
79
89
|
#@!attribute stubbing
|
80
90
|
# @return [String] the path to a directory with stubbing fixtures
|
81
91
|
# (setting this enables the default stubs)
|
82
92
|
property :stubbing
|
83
93
|
|
84
|
-
#
|
94
|
+
# Sets the environment for the config.
|
95
|
+
#
|
96
|
+
# The provided environment can be a string in short and long format as well
|
97
|
+
# as a symbol.
|
98
|
+
#
|
99
|
+
# @param new_env [Symbol, String] the new environment to use
|
100
|
+
# @return [Symbol] the new environment
|
101
|
+
# @raise when an invalid environment is provided
|
102
|
+
def environment=(new_env)
|
103
|
+
real_env =
|
104
|
+
case new_env
|
105
|
+
when "prod", "production", :prod, :production
|
106
|
+
:production
|
107
|
+
when "dev", "development", :dev, :development
|
108
|
+
:development
|
109
|
+
else
|
110
|
+
raise "unsupported environment: #{new_env}"
|
111
|
+
end
|
112
|
+
self[:environment] = real_env
|
113
|
+
end
|
85
114
|
|
115
|
+
# Supplements the configuration with settings from a config file.
|
116
|
+
#
|
86
117
|
# The configuration file has a section per environment that indicates
|
87
118
|
# per property what to use if it is unset.
|
88
119
|
#
|
@@ -100,9 +131,10 @@ module LWS
|
|
100
131
|
# an environment key that selects the default environment (unless
|
101
132
|
# overriden by the +LC_LWS_ENV+ environment variable).
|
102
133
|
#
|
103
|
-
# @example A elaborate configuration that sets the development environment as default, enables debugging and overrides an endpoint
|
134
|
+
# @example A elaborate configuration that sets the proxy and the development environment as default, enables debugging and overrides an endpoint
|
104
135
|
# default:
|
105
136
|
# environment: "development"
|
137
|
+
# proxy: "http://proxyserver:8080"
|
106
138
|
#
|
107
139
|
# production:
|
108
140
|
# api_token: "my-prod-api-token"
|
@@ -123,12 +155,13 @@ module LWS
|
|
123
155
|
def load_config_file(config_file, force_environment = nil)
|
124
156
|
return false unless File.exist? config_file
|
125
157
|
config_data = YAML.load_file(config_file)
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
158
|
+
default_config = config_data["default"] || {}
|
159
|
+
|
160
|
+
self.environment = force_environment ||
|
161
|
+
ENV["LC_LWS_ENV"] ||
|
162
|
+
config_data.dig("default", "environment") ||
|
163
|
+
self.environment
|
164
|
+
config = default_config.merge(config_data[self.environment.to_s] || {})
|
132
165
|
|
133
166
|
config.each_pair do |key, value|
|
134
167
|
unless VALID_FILE_PROPERTIES.include? key.to_sym
|
data/lib/lws/errors.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
#
|
2
|
-
# Copyright © 2016–
|
2
|
+
# Copyright © 2016–2021 LeftClick Web Services B.V.
|
3
3
|
#
|
4
|
-
# This software is property of LeftClick B.V. and cannot be
|
5
|
-
# and/or modified without permission. The software or any
|
6
|
-
# cannot be used for any other purposes than the LeftClick
|
7
|
-
# only during a valid license subscription. For more
|
8
|
-
# contact LeftClick B.V. at:
|
9
|
-
#
|
4
|
+
# This software is property of LeftClick Web Services B.V. and cannot be
|
5
|
+
# redistributed and/or modified without permission. The software or any
|
6
|
+
# of its parts cannot be used for any other purposes than the LeftClick
|
7
|
+
# services and only during a valid license subscription. For more
|
8
|
+
# information, please contact LeftClick Web Services B.V. at:
|
9
|
+
# Schootense Dreef 20A, 5708 HZ Helmond, The Netherlands,
|
10
|
+
# info@leftclick.eu, +3185-4444-004.
|
10
11
|
|
11
12
|
|
12
13
|
module LWS
|
@@ -1,12 +1,13 @@
|
|
1
1
|
#
|
2
|
-
# Copyright © 2016–
|
2
|
+
# Copyright © 2016–2021 LeftClick Web Services B.V.
|
3
3
|
#
|
4
|
-
# This software is property of LeftClick B.V. and cannot be
|
5
|
-
# and/or modified without permission. The software or any
|
6
|
-
# cannot be used for any other purposes than the LeftClick
|
7
|
-
# only during a valid license subscription. For more
|
8
|
-
# contact LeftClick B.V. at:
|
9
|
-
#
|
4
|
+
# This software is property of LeftClick Web Services B.V. and cannot be
|
5
|
+
# redistributed and/or modified without permission. The software or any
|
6
|
+
# of its parts cannot be used for any other purposes than the LeftClick
|
7
|
+
# services and only during a valid license subscription. For more
|
8
|
+
# information, please contact LeftClick Web Services B.V. at:
|
9
|
+
# Schootense Dreef 20A, 5708 HZ Helmond, The Netherlands,
|
10
|
+
# info@leftclick.eu, +3185-4444-004.
|
10
11
|
|
11
12
|
|
12
13
|
module LWS
|
@@ -1,12 +1,13 @@
|
|
1
1
|
#
|
2
|
-
# Copyright © 2016–
|
2
|
+
# Copyright © 2016–2021 LeftClick Web Services B.V.
|
3
3
|
#
|
4
|
-
# This software is property of LeftClick B.V. and cannot be
|
5
|
-
# and/or modified without permission. The software or any
|
6
|
-
# cannot be used for any other purposes than the LeftClick
|
7
|
-
# only during a valid license subscription. For more
|
8
|
-
# contact LeftClick B.V. at:
|
9
|
-
#
|
4
|
+
# This software is property of LeftClick Web Services B.V. and cannot be
|
5
|
+
# redistributed and/or modified without permission. The software or any
|
6
|
+
# of its parts cannot be used for any other purposes than the LeftClick
|
7
|
+
# services and only during a valid license subscription. For more
|
8
|
+
# information, please contact LeftClick Web Services B.V. at:
|
9
|
+
# Schootense Dreef 20A, 5708 HZ Helmond, The Netherlands,
|
10
|
+
# info@leftclick.eu, +3185-4444-004.
|
10
11
|
|
11
12
|
|
12
13
|
module LWS
|
@@ -1,12 +1,13 @@
|
|
1
1
|
#
|
2
|
-
# Copyright © 2016–
|
2
|
+
# Copyright © 2016–2021 LeftClick Web Services B.V.
|
3
3
|
#
|
4
|
-
# This software is property of LeftClick B.V. and cannot be
|
5
|
-
# and/or modified without permission. The software or any
|
6
|
-
# cannot be used for any other purposes than the LeftClick
|
7
|
-
# only during a valid license subscription. For more
|
8
|
-
# contact LeftClick B.V. at:
|
9
|
-
#
|
4
|
+
# This software is property of LeftClick Web Services B.V. and cannot be
|
5
|
+
# redistributed and/or modified without permission. The software or any
|
6
|
+
# of its parts cannot be used for any other purposes than the LeftClick
|
7
|
+
# services and only during a valid license subscription. For more
|
8
|
+
# information, please contact LeftClick Web Services B.V. at:
|
9
|
+
# Schootense Dreef 20A, 5708 HZ Helmond, The Netherlands,
|
10
|
+
# info@leftclick.eu, +3185-4444-004.
|
10
11
|
|
11
12
|
|
12
13
|
module LWS
|