lws 6.1.1 → 6.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 208979361cc45a960b3e244066fdbc66379585d8
4
- data.tar.gz: f1745c97f3315d1a33d23d8e0e5dd760c7e09822
3
+ metadata.gz: 6c28a47576f5116e961f09171fffaa9ce938ac66
4
+ data.tar.gz: 1da0aa547debc76bd41de01e5adf1a4c3f1c4e9c
5
5
  SHA512:
6
- metadata.gz: 203e6d4dca711def56ff2305e206334540a04d5d481cc6ed6c92d3a57a1f4a9e4ecc3149eba5b5c99a0c8b7218b4758a4ac36a48cf3107b5795efabe8593717c
7
- data.tar.gz: f271a3e7dea0da2c2e791fe3d85df6d8cdbcccd231baf0ecd03ac65df38408436d6bde759cfa568e01b9d86e418b11f103e5bc4f664028623bbb4d57b3b8df5c
6
+ metadata.gz: 427a6172d9968b9137ac68ae67be607ac5277dc2a961332e1dd8b48c3544d34996d4e91c4b465443fd0c858481413dd74ea61e2472c041f96e5c7a37deba112f
7
+ data.tar.gz: 165cba8de10e722a3786c9bedc032fb6f64f818b88da6940be9fde35837478c02b461d8e16cabedc46c747405724b3001c435f7f89be9e81d1c1b06d7b0c1cb9
data/.yardopts ADDED
@@ -0,0 +1,8 @@
1
+ --hide-void-return
2
+ --no-private
3
+ --protected
4
+ --readme README.md
5
+ --title 'LeftClick Web Services Documentation'
6
+ 'lib/**/*.rb'
7
+ -
8
+ '*.md'
data/CHANGELOG.md CHANGED
@@ -1,13 +1,23 @@
1
- # LWS Changelog
1
+ # LeftClick Web Services Changelog
2
2
 
3
3
  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.2
8
+
9
+ * Small tweaks to LWS Console
10
+ * Add LWS Console documentation (in the README)
11
+ * Documentation improvements
12
+
13
+ ### Development
14
+
15
+ * Fix caching tests not tearing down the specific setup
16
+
7
17
  ## v6.1.1
8
18
 
9
- * Support a global and user-specific config file for LWS console
10
- * Use a separate history and specific prompt for LWS console
19
+ * Support a global and user-specific config file for LWS Console
20
+ * Use a separate history and specific prompt for LWS Console
11
21
  * Small documentation fixes
12
22
  * Speed up the tests
13
23
 
@@ -19,9 +29,9 @@ part of te version.
19
29
  * Use JSON as the wire format for sending data to LWS
20
30
  * Switch to using our own exceptions (see LWS::Errors)
21
31
  * Add support for setting the LWS API token in the environment
22
- * Switch to Pry as the REPL used by the LWS console
23
- * Add commands to the LWS console to toggle debug options
24
- * Add option parsing and app/environment/debug mode selection to LWS console
32
+ * Switch to Pry as the REPL used by the LWS Console
33
+ * Add commands to the LWS Console to toggle debug options
34
+ * Add option parsing and app/environment/debug mode selection to LWS Console
25
35
 
26
36
  ### Apps
27
37
 
data/README.md CHANGED
@@ -83,3 +83,72 @@ The `LC_LWS_ENV` environment variable is supported to override the LWS
83
83
  environment. Allowed values are "production" (default) and "development".
84
84
  The `LC_LWS_API_TOKEN` is supported to set the LWS API token default.
85
85
  This only works if a custom API token middleware is not used.
86
+
87
+ ## LWS Console
88
+
89
+ This library comes with the program `lwsconsole`, which is a command-line
90
+ tool that can be used to interactively use the library. (This is similar
91
+ to the Rails console.) See `lwsconsole --help` for the supported
92
+ command-line arguments.
93
+
94
+ LWS Console will perform the setup for you and give you a prompt in the
95
+ `LWS` module namespace or the module of an app if this is selected via the
96
+ arguments. It uses the production environment per default using the token
97
+ provided by a command-line argument. These defaults can be overriden using
98
+ the configuration. For example, to rename a map:
99
+
100
+ ```
101
+ $ lwsconsole -t "my_token" -a maps
102
+ [1] lwsconsole(LWS::Maps)> Map.all.map(&:name)
103
+ => ["Gebouw 1",
104
+ "Gebouw 3"]
105
+ [2] lwsconsole(LWS::Maps)> map = Map.find(2)
106
+ => #<LWS::Maps::Map(maps/(:id)) id: 2 name: "Gebouw 3" ... markers: []>
107
+ [3] lwsconsole(LWS::Maps)> map.name = "Gebouw 2"
108
+ "Gebouw 2"
109
+ [4] lwsconsole(LWS::Maps)> map.save
110
+ nil
111
+ ```
112
+
113
+ Besides the API calls, LWS console supports a few commands to change its
114
+ behaviour:
115
+
116
+ * `http_debug true|false`: Toggles HTTP debugging for API calls
117
+ * `http_debug_headers true|false`: Toggles logging of HTTP headers in the HTTP debug output
118
+ * `json_debug true|false`: Toggles JSON debug output for API calls
119
+ * `reload!`: Reloads all apps
120
+
121
+ ```
122
+ [5] lwsconsole(LWS::Maps)> http_debug true
123
+ true
124
+ ```
125
+
126
+ LWS Console keeps a history of all calls and commands, use the command
127
+ `history --all` to seem them. Use the command `help` to see all other
128
+ available commands (provided by Pry).
129
+
130
+ ### Configuration files
131
+
132
+ LWS Console will look for the configuration files first in
133
+ `/etc/LeftClick/lws.yml` and then `~/.config/LeftClick/lws.yml`; they are
134
+ in the YAML format.
135
+
136
+ The configuration file can set defaults per environment. It is possible to
137
+ set the API key, endpoints and debug modes.
138
+
139
+ ```yaml
140
+ development:
141
+ api_token: "my_token"
142
+ endpoints:
143
+ maps: "https://maps.leftclick.cloud
144
+ http_debug: true
145
+ http_debug_headers: true
146
+ json_debug: true
147
+ ```
148
+
149
+ To override the default environment, use the default section. For example:
150
+
151
+ ```yaml
152
+ default:
153
+ environment: "development"
154
+ ```
data/Rakefile CHANGED
@@ -21,11 +21,7 @@ Rake::TestTask.new do |t|
21
21
  t.pattern = "test/*_test.rb"
22
22
  end
23
23
 
24
- YARD::Rake::YardocTask.new do |t|
25
- t.files = ["lib/**/*.rb", "-", "README.md", "CHANGELOG.md"]
26
- t.options = ["--no-private",
27
- "--title", "LeftClick Web Services Documentation"]
28
- end
24
+ YARD::Rake::YardocTask.new
29
25
 
30
26
  task doc: :yard
31
27
 
data/bin/lwsconsole CHANGED
@@ -45,7 +45,7 @@ EOB
45
45
  exit
46
46
  end
47
47
  opts.on("--version", "display the LWS library version and exit") do
48
- puts LWS::VERSION
48
+ puts "LWS Console v#{LWS::VERSION}"
49
49
  exit
50
50
  end
51
51
  end
data/lib/lws/version.rb CHANGED
@@ -13,6 +13,6 @@ module LWS
13
13
 
14
14
  # The LWS library version.
15
15
  # @note The major and minor version parts match the LWS API version!
16
- VERSION = '6.1.1'
16
+ VERSION = '6.1.2'
17
17
 
18
18
  end
data/test/auth_test.rb CHANGED
@@ -152,7 +152,7 @@ class TestAuthToken < MiniTest::Test
152
152
  refute_nil(@token)
153
153
  assert_instance_of(Token, @token)
154
154
  refute_nil(@token.id)
155
- assert_equal(@token.token, LWS.config.api_token)
155
+ assert_equal(LWS.config.api_token, @token.token)
156
156
  end
157
157
 
158
158
  def test_valid_associations
data/test/caching_test.rb CHANGED
@@ -46,13 +46,18 @@ class TestCaching < MiniTest::Test
46
46
  end
47
47
  end
48
48
 
49
+ def teardown
50
+ # Restore the configuration
51
+ reconfigure
52
+ end
53
+
49
54
  def test_working_cache
50
55
  assert_nil(@cache_mock.last_read_key)
51
56
  assert_nil(@cache_mock.last_written_key)
52
57
  assert_nil(@cache_mock.last_written_value)
53
58
  config = LWS::Auth::Configuration.all.first
54
- assert_equal(@cache_mock.last_read_key, "/configurations")
55
- assert_equal(@cache_mock.last_written_key, "/configurations")
59
+ assert_equal("/configurations", @cache_mock.last_read_key)
60
+ assert_equal("/configurations", @cache_mock.last_written_key)
56
61
  refute_nil(@cache_mock.last_written_value)
57
62
  end
58
63
 
@@ -420,7 +420,7 @@ class TestDigitalSignagePlayerFeedbackResult < MiniTest::Test
420
420
  # FIXME: Chained associations don't work yet in Spyke (#89)
421
421
  #def test_valid_associations
422
422
  # assert_instance_of(Player, @player_feedback_result.player)
423
- # assert_equal(@player_feedback, @player_feedback_result.player)
423
+ # assert_equal(@player, @player_feedback_result.player)
424
424
  # assert_instance_of(Player::Feedback, @player_feedback_result.feedback)
425
425
  # assert_equal(@player_feedback, @player_feedback_result.feedback)
426
426
  #end
data/test/generic_test.rb CHANGED
@@ -28,7 +28,7 @@ class TestGenericConfiguration < MiniTest::Test
28
28
 
29
29
  def test_her_compatibility
30
30
  @configuration.assign_attributes("value" => "other_value")
31
- assert_equal "other_value", @configuration.value
31
+ assert_equal("other_value", @configuration.value)
32
32
  end
33
33
 
34
34
  def test_lifecycle
data/test/maps_test.rb CHANGED
@@ -50,7 +50,7 @@ class TestMapsMarker < MiniTest::Test
50
50
 
51
51
  def test_valid_map_associations
52
52
  assert_instance_of(Map, @marker.map)
53
- assert_equal(@marker.map, @map)
53
+ assert_equal(@map, @marker.map)
54
54
  end
55
55
 
56
56
  end
data/test/setup_test.rb CHANGED
@@ -32,19 +32,19 @@ class TestSetup < MiniTest::Test
32
32
  with_env("LC_LWS_ENV" => "production") do
33
33
  reconfigure
34
34
  end
35
- assert_equal(LWS.config.environment, :production)
35
+ assert_equal(:production, LWS.config.environment)
36
36
 
37
37
  with_env("LC_LWS_ENV" => "production") do
38
38
  LWS.setup do |config|
39
39
  config.api_token = ENV["LC_LWS_TEST_TOKEN"]
40
40
  end
41
41
  end
42
- assert_equal(LWS.config.environment, :production)
42
+ assert_equal(:production, LWS.config.environment)
43
43
 
44
44
  with_env("LC_LWS_API_TOKEN" => "test-token") do
45
45
  reconfigure
46
46
  end
47
- assert_equal(LWS.config.api_token, "test-token")
47
+ assert_equal("test-token", LWS.config.api_token)
48
48
  end
49
49
 
50
50
  def test_http_logging_without_logger
@@ -75,7 +75,7 @@ class TestSetup < MiniTest::Test
75
75
  reconfigure do |config|
76
76
  assert config.load_config_file(File.join(@test_config_dir, "empty.yml"))
77
77
  end
78
- assert_equal LWS.config, orig_config
78
+ assert_equal(orig_config, LWS.config)
79
79
 
80
80
  reconfigure do |config|
81
81
  refute config.load_config_file(File.join(@test_config_dir, "does_not_exist.yml"))
@@ -85,17 +85,17 @@ class TestSetup < MiniTest::Test
85
85
  config.api_token = nil
86
86
  assert config.load_config_file(File.join(@test_config_dir, "tokens.yml"))
87
87
  end
88
- assert_equal LWS.config.api_token, "dev-token"
88
+ assert_equal("dev-token", LWS.config.api_token)
89
89
 
90
90
  reconfigure do |config|
91
91
  assert config.load_config_file(File.join(@test_config_dir, "switch_env.yml"))
92
92
  end
93
- assert_equal LWS.config.environment, :production
93
+ assert_equal(:production, LWS.config.environment)
94
94
 
95
95
  reconfigure do |config|
96
96
  assert config.load_config_file(File.join(@test_config_dir, "endpoints.yml"))
97
97
  end
98
- assert_equal LWS.config.endpoints, { maps: "http://maps.leftclick.cloud" }
98
+ assert_equal({ maps: "http://maps.leftclick.cloud" }, LWS.config.endpoints)
99
99
 
100
100
  assert_raises do
101
101
  reconfigure do |config|
@@ -107,12 +107,12 @@ class TestSetup < MiniTest::Test
107
107
  config.api_token = nil
108
108
  assert config.load_config_file(File.join(@test_config_dir, "full.yml"))
109
109
  end
110
- assert_equal LWS.config.api_token, "dev-token"
111
- assert_equal LWS.config.endpoints, { maps: "http://maps.leftclick.cloud" }
112
- assert_equal LWS.config.environment, :development
113
- assert_equal LWS.config.http_debug, true
114
- assert_equal LWS.config.http_debug_headers, true
115
- assert_equal LWS.config.json_debug, true
110
+ assert_equal("dev-token", LWS.config.api_token)
111
+ assert_equal({ maps: "http://maps.leftclick.cloud" }, LWS.config.endpoints)
112
+ assert_equal(:development, LWS.config.environment)
113
+ assert_equal(true, LWS.config.http_debug)
114
+ assert_equal(true, LWS.config.http_debug_headers)
115
+ assert_equal(true, LWS.config.json_debug)
116
116
  end
117
117
 
118
118
  end
data/test/ticket_test.rb CHANGED
@@ -78,7 +78,7 @@ class TestTicketMessage < MiniTest::Test
78
78
  #assert_instance_of(Attachment, @message.attachments.first)
79
79
  assert_instance_of(LWS::Auth::Company, @message.company)
80
80
  assert_instance_of(Ticket, @message.ticket)
81
- assert_equal(@message.ticket, @ticket)
81
+ assert_equal(@ticket, @message.ticket)
82
82
  end
83
83
 
84
84
  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.1
4
+ version: 6.1.2
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-02-28 00:00:00.000000000 Z
11
+ date: 2018-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday_middleware
@@ -230,6 +230,7 @@ extensions: []
230
230
  extra_rdoc_files: []
231
231
  files:
232
232
  - ".gitignore"
233
+ - ".yardopts"
233
234
  - CHANGELOG.md
234
235
  - Gemfile
235
236
  - README.md