lws 7.2.4 → 7.3.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.
- checksums.yaml +4 -4
- data/lib/lws/apps/auth.rb +13 -14
- data/lib/lws/apps/corporate_website.rb +13 -13
- data/lib/lws/apps/digital_signage.rb +26 -17
- data/lib/lws/apps/generic.rb +29 -9
- data/lib/lws/apps/maps.rb +13 -13
- data/lib/lws/apps/presence.rb +23 -13
- data/lib/lws/apps/resource.rb +14 -14
- data/lib/lws/apps/ticket.rb +13 -13
- data/lib/lws/config.rb +24 -11
- 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 +9 -9
- 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 +35 -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 +18 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 584cf2af81ea2c838fc084ef6ce4bc7b95970491cd88c8b93168cfc2649d8c9f
|
4
|
+
data.tar.gz: efda07eca2af74024f69ba3bd8439044010c0977e51547de2df461fccf0155a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 926f2d6dcdca21e5b61e9c7e09e35d1838b446821fcfe2e0fa7722d1561dfd31a5a236d00070d04dbad182136130a3e8c95fb8c486a4b5f1b711cc533abc7041
|
7
|
+
data.tar.gz: 49b3b7cbf19e8c6844bab2fccd46f4a6c8d1c00697f4bcf45ea06725e7a2dc4b51afe3cff361e182ea133351687d7dc5fd6faa4824132ef8fd6f0c014cf559c0
|
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
|
@@ -507,7 +512,7 @@ module LWS::DigitalSignage
|
|
507
512
|
# the layout
|
508
513
|
# FIXME: Missing endpoint in LWS
|
509
514
|
has_many :categories, class_name: "LWS::DigitalSignage::Layout::Category",
|
510
|
-
uri: "
|
515
|
+
uri: "layouts/:layout_id/categories(/:id)"
|
511
516
|
|
512
517
|
# @!attribute company_owner
|
513
518
|
# @return [LWS::Auth::Company] the company that owns the layout
|
@@ -765,7 +770,7 @@ module LWS::DigitalSignage
|
|
765
770
|
# This class is only used within the context of the {Layout} class.
|
766
771
|
class Layout::Version < LWS::Generic::Model
|
767
772
|
use_api LWS::DigitalSignage.api
|
768
|
-
uri "
|
773
|
+
uri "layouts/:layout_id/versions(/:id)"
|
769
774
|
|
770
775
|
# @!attribute archive_storage_id
|
771
776
|
# @return [String, nil] sthe storage ID of the archive/layout pack of the
|
@@ -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.
|
@@ -205,7 +225,7 @@ module LWS::Generic
|
|
205
225
|
|
206
226
|
# An API connection to Active Storage (with JSON request/response, but
|
207
227
|
# without caching).
|
208
|
-
@as_connection = Faraday.new(url: api.url_prefix) do |c|
|
228
|
+
@as_connection = Faraday.new(url: api.url_prefix, proxy: config.proxy) do |c|
|
209
229
|
# Request
|
210
230
|
c.request :json
|
211
231
|
c.use LWS::Middleware::RequestHeaders, config.api_token
|
@@ -225,7 +245,7 @@ module LWS::Generic
|
|
225
245
|
|
226
246
|
# A plain file connection to LWS (with token autnentication and caching but without
|
227
247
|
# JSON request/response).
|
228
|
-
@lws_connection = Faraday.new(url: api.url_prefix) do |c|
|
248
|
+
@lws_connection = Faraday.new(url: api.url_prefix, proxy: config.proxy) do |c|
|
229
249
|
# Request
|
230
250
|
if config.caching_object
|
231
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
|
|
@@ -406,7 +406,7 @@ module LWS::Resource
|
|
406
406
|
# @return [Forecast] the forecasts for the weather location
|
407
407
|
has_many :forecasts,
|
408
408
|
class_name: "LWS::Resource::Collection::WeatherLocation::Forecast",
|
409
|
-
uri: "collections/:collection_id/
|
409
|
+
uri: "collections/:collection_id/weather_locations/:weather_location_id/forecasts(/:id)"
|
410
410
|
|
411
411
|
# @!attribute kind
|
412
412
|
# @return ["unknown", "yahoo"] the kind of the weather location
|
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,6 +78,14 @@ 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)
|
@@ -121,9 +131,10 @@ module LWS
|
|
121
131
|
# an environment key that selects the default environment (unless
|
122
132
|
# overriden by the +LC_LWS_ENV+ environment variable).
|
123
133
|
#
|
124
|
-
# @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
|
125
135
|
# default:
|
126
136
|
# environment: "development"
|
137
|
+
# proxy: "http://proxyserver:8080"
|
127
138
|
#
|
128
139
|
# production:
|
129
140
|
# api_token: "my-prod-api-token"
|
@@ -144,11 +155,13 @@ module LWS
|
|
144
155
|
def load_config_file(config_file, force_environment = nil)
|
145
156
|
return false unless File.exist? config_file
|
146
157
|
config_data = YAML.load_file(config_file)
|
158
|
+
default_config = config_data["default"] || {}
|
159
|
+
|
147
160
|
self.environment = force_environment ||
|
148
161
|
ENV["LC_LWS_ENV"] ||
|
149
162
|
config_data.dig("default", "environment") ||
|
150
163
|
self.environment
|
151
|
-
config = config_data[self.environment.to_s] || {}
|
164
|
+
config = default_config.merge(config_data[self.environment.to_s] || {})
|
152
165
|
|
153
166
|
config.each_pair do |key, value|
|
154
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
|
@@ -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
|