lws 6.1.3 → 6.1.4
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/CHANGELOG.md +10 -0
- data/bin/lwsconsole +26 -2
- data/lib/lws/apps/auth.rb +9 -4
- data/lib/lws/apps/digital_signage.rb +21 -0
- data/lib/lws/config.rb +1 -1
- data/lib/lws/version.rb +1 -1
- data/test/auth_test.rb +47 -51
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f30071c15667079a8cf84888f5259e3ead55071c
|
4
|
+
data.tar.gz: e85e421087a695a3f37c95ff07f5a570b79a380a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8422afa62c6f038824aa10d0c92a41b7c43ba516ee4e8684f480e5cfb6efa0bbae61ff1ee9e8c85edb8c2a6b5070c28d484601824828c7aecc537624120cbc9
|
7
|
+
data.tar.gz: 8ff70bddabe627aa3e4f14f5f5562ffee150aeb936322f3af460e73e5601598a9caba77087ba1800ae613dce0b2e8584dfcee65763bd31e1fcf8d6e4bf7c4c13
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,16 @@ 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.1.4
|
8
|
+
|
9
|
+
* Fix LWS Console environment command-line parameter not overriding the config
|
10
|
+
* Print LWS setup on LWS Console start
|
11
|
+
|
12
|
+
### Apps
|
13
|
+
|
14
|
+
* Add some fields to the DigitalSignage app (closes: #12001)
|
15
|
+
* Fix some relations in the Auth app (closes: #12026)
|
16
|
+
|
7
17
|
## v6.1.3
|
8
18
|
|
9
19
|
* Fix `#find` on has many-associations not working
|
data/bin/lwsconsole
CHANGED
@@ -16,6 +16,7 @@ USER_CONFIG_FILE = "#{ENV['HOME']}/.config/LeftClick/lws.yml"
|
|
16
16
|
|
17
17
|
# Parse the command-line arguments
|
18
18
|
PROG_NAME = File.basename($0)
|
19
|
+
APP_NAME = "LWS Console"
|
19
20
|
@options = {}
|
20
21
|
opt_parser = OptionParser.new do |opts|
|
21
22
|
opts.banner = <<EOB
|
@@ -45,7 +46,7 @@ EOB
|
|
45
46
|
exit
|
46
47
|
end
|
47
48
|
opts.on("--version", "display the LWS library version and exit") do
|
48
|
-
puts "
|
49
|
+
puts "#{APP_NAME} v#{LWS::VERSION}"
|
49
50
|
exit
|
50
51
|
end
|
51
52
|
end
|
@@ -78,7 +79,6 @@ logger.formatter =
|
|
78
79
|
begin
|
79
80
|
LWS.setup do |config|
|
80
81
|
config.api_token = @options[:token] if @options[:token]
|
81
|
-
config.environment = @options[:environment] if @options[:environment]
|
82
82
|
config.endpoints = @endpoints
|
83
83
|
config.http_debug = @options[:debug]
|
84
84
|
config.json_debug = @options[:debug]
|
@@ -92,6 +92,8 @@ begin
|
|
92
92
|
config.load_config_file(GLOBAL_CONFIG_FILE)
|
93
93
|
config.load_config_file(USER_CONFIG_FILE)
|
94
94
|
end
|
95
|
+
|
96
|
+
config.environment = @options[:environment] if @options[:environment]
|
95
97
|
end
|
96
98
|
if @options[:app]
|
97
99
|
@app_module = LWS.app_module(@options[:app].downcase)
|
@@ -135,5 +137,27 @@ FileUtils.mkdir_p("#{ENV['HOME']}/.local/share/LeftClick")
|
|
135
137
|
Pry.config.history.file = "#{ENV['HOME']}/.local/share/LeftClick/lws_history"
|
136
138
|
Pry.config.prompt_name = PROG_NAME
|
137
139
|
|
140
|
+
# Print an LWS setup summary
|
141
|
+
puts "#{APP_NAME} v#{LWS::VERSION} started!"
|
142
|
+
puts
|
143
|
+
puts "- Environment: #{LWS.config.environment}"
|
144
|
+
puts "- API token: #{LWS.config.api_token[0...-4].gsub(/\w/, '*')}#{LWS.config.api_token[-4..-1]}"
|
145
|
+
if @app_module
|
146
|
+
puts "- App endpoint: #{@app_module.api.url_prefix}"
|
147
|
+
end
|
148
|
+
debug_outputs = []
|
149
|
+
if LWS.config.http_debug
|
150
|
+
if LWS.config.http_debug_headers
|
151
|
+
debug_outputs << "HTTP (with headers)"
|
152
|
+
else
|
153
|
+
debug_outputs << "HTTP"
|
154
|
+
end
|
155
|
+
end
|
156
|
+
debug_outputs << "JSON" if LWS.config.json_debug
|
157
|
+
unless debug_outputs.present?
|
158
|
+
puts "- Debug output: #{debug_outputs.join(', ')}"
|
159
|
+
end
|
160
|
+
puts
|
161
|
+
|
138
162
|
# Use the LWS module or the selected app module as the default namespace
|
139
163
|
(@app_module || LWS).pry
|
data/lib/lws/apps/auth.rb
CHANGED
@@ -76,7 +76,9 @@ module LWS::Auth
|
|
76
76
|
|
77
77
|
# @!attribute start_app
|
78
78
|
# @return [App, nil] the app to start with/open when logging in
|
79
|
-
belongs_to :start_app, class_name: "LWS::Auth::App"
|
79
|
+
belongs_to :start_app, class_name: "LWS::Auth::App",
|
80
|
+
foreign_key: :start_app_id,
|
81
|
+
uri: "apps/:id"
|
80
82
|
|
81
83
|
# @!attribute start_app_id
|
82
84
|
# @return [Fixnum, nil] the ID of the app to start with/open when logging in
|
@@ -196,7 +198,7 @@ module LWS::Auth
|
|
196
198
|
|
197
199
|
# @!attribute contracts
|
198
200
|
# @return [Array<Contract>] the contracts of the company
|
199
|
-
has_many :contracts
|
201
|
+
has_many :contracts, uri: "companies/:company_id/contracts/(:id)"
|
200
202
|
|
201
203
|
# @!attribute country
|
202
204
|
# @return [String] the country of the company
|
@@ -210,7 +212,7 @@ module LWS::Auth
|
|
210
212
|
|
211
213
|
# @!attribute licenses
|
212
214
|
# @return [Array<License>] the licenses of the company
|
213
|
-
has_many :licenses
|
215
|
+
has_many :licenses, uri: "companies/:company_id/licenses/(:id)"
|
214
216
|
|
215
217
|
# @!attribute name
|
216
218
|
# @return [String] the name of the company
|
@@ -240,7 +242,7 @@ module LWS::Auth
|
|
240
242
|
# @!attribute usage_reports
|
241
243
|
# @return [Array<UsageReport>] the usage reports available/generated
|
242
244
|
# for the company
|
243
|
-
has_many :usage_reports, uri: "
|
245
|
+
has_many :usage_reports, uri: "companies/:company_id/reports/(:id)"
|
244
246
|
|
245
247
|
# @!attribute uuid
|
246
248
|
# @return [String] the UUID of the company
|
@@ -263,6 +265,7 @@ module LWS::Auth
|
|
263
265
|
# = The contract class
|
264
266
|
class Contract < LWS::Generic::Model
|
265
267
|
use_api LWS::Auth.api
|
268
|
+
uri "companies/:company_id/contracts/(:id)"
|
266
269
|
|
267
270
|
# @!attribute id [r]
|
268
271
|
# @return [Fixnum] the (unique) ID of the contract
|
@@ -333,6 +336,7 @@ module LWS::Auth
|
|
333
336
|
# = The license class
|
334
337
|
class License < LWS::Generic::Model
|
335
338
|
use_api LWS::Auth.api
|
339
|
+
uri "companies/:company_id/licenses/(:id)"
|
336
340
|
|
337
341
|
# @!attribute id [r]
|
338
342
|
# @return [Fixnum] the (unique) ID of the license
|
@@ -465,6 +469,7 @@ module LWS::Auth
|
|
465
469
|
# = The usage report class
|
466
470
|
class UsageReport < LWS::Generic::Model
|
467
471
|
use_api LWS::Auth.api
|
472
|
+
uri "companies/:company_id/reports/(:id)"
|
468
473
|
|
469
474
|
# @!attribute id [r]
|
470
475
|
# @return [Fixnum] the (unique) ID of the usage report
|
@@ -43,6 +43,10 @@ module LWS::DigitalSignage
|
|
43
43
|
# @return [Fixnum] the (unique) ID of the channel
|
44
44
|
attribute :id
|
45
45
|
|
46
|
+
# @!attribute bandwidth
|
47
|
+
# @return [Fixnum] the bandwidth limit for the channel (bytes per second)
|
48
|
+
attribute :bandwidth
|
49
|
+
|
46
50
|
# @!attribute company
|
47
51
|
# @return [LWS::Auth::Company] the company the channel belongs to
|
48
52
|
belongs_to :company, class_name: "LWS::Auth::Company"
|
@@ -51,6 +55,10 @@ module LWS::DigitalSignage
|
|
51
55
|
# @return [Fixnum] the ID of the company the channel belongs to
|
52
56
|
attribute :company_id
|
53
57
|
|
58
|
+
# @!attribute daily_reboot_time
|
59
|
+
# @return [String] the daily reboot time of the channel
|
60
|
+
attribute :daily_reboot_time
|
61
|
+
|
54
62
|
# @!attribute display
|
55
63
|
# @return [Display] the display of the channel
|
56
64
|
belongs_to :display, class_name: "LWS::DigitalSignage::Display"
|
@@ -78,10 +86,19 @@ module LWS::DigitalSignage
|
|
78
86
|
# the channel
|
79
87
|
attribute :orientation
|
80
88
|
|
89
|
+
# @!attribute persistent_connection
|
90
|
+
# @return [Boolean] whether the channel is considered to have a persistent
|
91
|
+
# network connection
|
92
|
+
attribute :persistent_connection
|
93
|
+
|
81
94
|
# @!attribute players
|
82
95
|
# @return [Array<Player>] the players linked to the channel
|
83
96
|
has_many :players, class_name: "LWS::DigitalSignage::Player"
|
84
97
|
|
98
|
+
# @!attribute remote_control
|
99
|
+
# @return [Boolean] whether remote control is enabled for the channel
|
100
|
+
attribute :remote_control
|
101
|
+
|
85
102
|
# @!attribute tags
|
86
103
|
# @return [Array<Channel::Tag>] the tags of the channel
|
87
104
|
has_many :tags, class_name: "LWS::DigitalSignage::Channel::Tag"
|
@@ -104,6 +121,10 @@ module LWS::DigitalSignage
|
|
104
121
|
# @return [String] the time zone for the channel
|
105
122
|
attribute :time_zone
|
106
123
|
|
124
|
+
# @!attribute volume
|
125
|
+
# @return [Fixnum] the audio volume setting of the channel (percentage)
|
126
|
+
attribute :volume
|
127
|
+
|
107
128
|
# @!attribute created_at [r]
|
108
129
|
# @return [String] the timestamp of when the channel was created
|
109
130
|
attribute :created_at
|
data/lib/lws/config.rb
CHANGED
@@ -85,7 +85,7 @@ module LWS
|
|
85
85
|
#
|
86
86
|
# The configuration file can optionally have a "default" section with
|
87
87
|
# an environment key that selects the default environment (unless
|
88
|
-
# overriden by the +LC_LWS_ENV+ environment variable.
|
88
|
+
# overriden by the +LC_LWS_ENV+ environment variable).
|
89
89
|
#
|
90
90
|
# @example A elaborate configuration that sets the development environment as default, enables debugging and overrides an endpoint
|
91
91
|
# default:
|
data/lib/lws/version.rb
CHANGED
data/test/auth_test.rb
CHANGED
@@ -34,8 +34,7 @@ class TestAuthAccount < MiniTest::Test
|
|
34
34
|
if @account.devices.present?
|
35
35
|
assert_instance_of(Device, @account.devices.first)
|
36
36
|
end
|
37
|
-
|
38
|
-
#assert_instance_of(App, @account.start_app)
|
37
|
+
assert_instance_of(App, @account.start_app)
|
39
38
|
end
|
40
39
|
|
41
40
|
end
|
@@ -82,39 +81,36 @@ class TestAuthCompany < MiniTest::Test
|
|
82
81
|
assert_instance_of(Account, @company.accounts.first)
|
83
82
|
assert_instance_of(App, @company.apps.first)
|
84
83
|
assert_instance_of(Account, @company.contact_person)
|
85
|
-
|
86
|
-
#assert_instance_of(Contract, @company.contracts.first)
|
84
|
+
assert_instance_of(Contract, @company.contracts.first)
|
87
85
|
assert_instance_of(License, @company.licenses.first)
|
88
86
|
assert_instance_of(Company, @child_company.parent)
|
89
|
-
|
90
|
-
#assert_instance_of(UsageReport, @company.usage_reports.first)
|
87
|
+
assert_instance_of(UsageReport, @company.usage_reports.first)
|
91
88
|
end
|
92
89
|
|
93
90
|
end
|
94
91
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
#
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
#end
|
92
|
+
class TestAuthContract < MiniTest::Test
|
93
|
+
|
94
|
+
include LWS::Auth
|
95
|
+
|
96
|
+
def setup
|
97
|
+
@company = Company.find(1)
|
98
|
+
# Contracts only exist as child objects of companies
|
99
|
+
@contract = @company.contracts.first
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_valid
|
103
|
+
refute_nil(@contract)
|
104
|
+
assert_instance_of(Contract, @contract)
|
105
|
+
refute_nil(@contract.id)
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_valid_associations
|
109
|
+
assert_instance_of(Company, @contract.company)
|
110
|
+
assert_equal(@company, @contract.company)
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
118
114
|
|
119
115
|
class TestAuthLicense < MiniTest::Test
|
120
116
|
|
@@ -170,25 +166,25 @@ class TestAuthToken < MiniTest::Test
|
|
170
166
|
|
171
167
|
end
|
172
168
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
#
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
169
|
+
class TestAuthUsageReport < MiniTest::Test
|
170
|
+
|
171
|
+
include LWS::Auth
|
172
|
+
|
173
|
+
def setup
|
174
|
+
@company = Company.find(1)
|
175
|
+
# Contracts only exist as child objects of companies
|
176
|
+
@usage_report = @company.usage_reports.first
|
177
|
+
end
|
178
|
+
|
179
|
+
def test_valid
|
180
|
+
refute_nil(@usage_report)
|
181
|
+
assert_instance_of(UsageReport, @usage_report)
|
182
|
+
refute_nil(@usage_report.id)
|
183
|
+
end
|
184
|
+
|
185
|
+
def test_valid_associations
|
186
|
+
assert_instance_of(Company, @usage_report.company)
|
187
|
+
assert_equal(@company, @usage_report.company)
|
188
|
+
end
|
189
|
+
|
190
|
+
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.1.
|
4
|
+
version: 6.1.4
|
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-03-
|
11
|
+
date: 2018-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday_middleware
|