nexus_mods 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b99b3c80e3d45a5bde54394040517dc6e7c3cb803dfa4b3be263a0283bdf5606
4
- data.tar.gz: cae008f32c14745db775d1791c631f15cab5071e3dcd0ac0d4d0c0ce5ba1a1c8
3
+ metadata.gz: a6490bd894c40f7806bb126cb70ade888ab5121499b86ff2cc959ee663dd223d
4
+ data.tar.gz: d9fdeb53c88c27ce9503e328a261ddb31a0facbbe0b6c35c304628c6e9580790
5
5
  SHA512:
6
- metadata.gz: 8c0bf7800a21880cf748a0733d14483e3326d939671a5aa41b3e0076d3ef9ea46ff2e4d498078c95990a729542dd23ca15d229726e70b63eba139abd53ed828e
7
- data.tar.gz: 754f2778855552657f7977d03fd8b84e58fc291b85b21f12dd6ee0d6a9baa6ade16670acc97244a043320f09d8b93e638b0ac4f680725b558b748c10bfcf99ba
6
+ metadata.gz: 7c8f9576edd38dab0076f24ad1d396973c9d1ab8542ff4eef548d9b49758f85b6da465465b10b1e53dbb2db6d8312f31e9b88649916f654e7b8c1a12092aaadb
7
+ data.tar.gz: 1b2d1e915594af39c9bd793a8f216fc2796024e2729a2b5596c35b546e04c8e2bb96dce77aa35e11f5d7a98fba1652c79f77f01648a363cfdf9b93ec40ee7602
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # [v1.1.0](https://github.com/Muriel-Salvan/nexus_mods/compare/v1.0.0...v1.1.0) (2023-04-10 19:19:16)
2
+
3
+ ### Features
4
+
5
+ * [[Feature] Add log_level parameter while creating nexus_mods instance](https://github.com/Muriel-Salvan/nexus_mods/commit/1b6215be2d9b3a97076bb6b7bf665f8ec8e900ca)
6
+
1
7
  # [v1.0.0](https://github.com/Muriel-Salvan/nexus_mods/compare/v0.6.0...v1.0.0) (2023-04-10 19:03:51)
2
8
 
3
9
  ### Breaking changes
@@ -1,5 +1,5 @@
1
1
  class NexusMods
2
2
 
3
- VERSION = '1.0.0'
3
+ VERSION = '1.1.0'
4
4
 
5
5
  end
data/lib/nexus_mods.rb CHANGED
@@ -46,6 +46,7 @@ class NexusMods
46
46
  # * *mod_files*: Expiry associated to queries on mod files [default: 1 day]
47
47
  # * *api_cache_file* (String): File used to store the NexusMods API cache, or nil for no cache [default: "#{Dir.tmpdir}/nexus_mods_api_cache.json"]
48
48
  # * *logger* (Logger): The logger to be used for log messages [default: Logger.new(STDOUT)]
49
+ # * *log_level* (Symbol): The logger level to be set [default: :info]
49
50
  def initialize(
50
51
  api_key: nil,
51
52
  game_domain_name: 'skyrimspecialedition',
@@ -54,12 +55,14 @@ class NexusMods
54
55
  http_cache_file: "#{Dir.tmpdir}/nexus_mods_http_cache.json",
55
56
  api_cache_expiry: {},
56
57
  api_cache_file: "#{Dir.tmpdir}/nexus_mods_api_cache.json",
57
- logger: Logger.new($stdout)
58
+ logger: Logger.new($stdout),
59
+ log_level: :info
58
60
  )
59
61
  @game_domain_name = game_domain_name
60
62
  @mod_id = mod_id
61
63
  @file_id = file_id
62
64
  @logger = logger
65
+ @logger.level = log_level
63
66
  @premium = false
64
67
  @api_client = ApiClient.new(
65
68
  api_key:,
@@ -66,12 +66,20 @@ module NexusModsTest
66
66
  @nexus_mods
67
67
  end
68
68
 
69
+ # Get NexusMods logs
70
+ #
71
+ # Result::
72
+ # * String: The NexusMods logs
73
+ def nexus_mods_logs
74
+ @nexus_mods_logger.string
75
+ end
76
+
69
77
  # Reset the NexusMods instance.
70
78
  # Dump the output if needed for debugging purposes.
71
79
  def reset_nexus_mods
72
80
  if @nexus_mods && test_debug?
73
81
  puts '===== NexusMods output BEGIN ====='
74
- puts @nexus_mods_logger.string
82
+ puts nexus_mods_logs
75
83
  puts '===== NexusMods output END ====='
76
84
  end
77
85
  @nexus_mods = nil
@@ -6,14 +6,6 @@ describe NexusMods::Api::Mod do
6
6
  expect_validate_user
7
7
  end
8
8
 
9
- it 'returns the default game domain name' do
10
- expect(nexus_mods(game_domain_name: 'skyrimspecialedition').game_domain_name).to eq 'skyrimspecialedition'
11
- end
12
-
13
- it 'returns the default game mod id' do
14
- expect(nexus_mods(mod_id: 2014).mod_id).to eq 2014
15
- end
16
-
17
9
  it 'returns a mod complete information' do
18
10
  expect_http_call_to(
19
11
  path: '/v1/games/skyrimspecialedition/mods/2014.json',
@@ -0,0 +1,32 @@
1
+ describe NexusMods do
2
+
3
+ context 'when testing authentication and access' do
4
+
5
+ it 'returns the default game domain name' do
6
+ expect_validate_user
7
+ expect(nexus_mods(game_domain_name: 'skyrimspecialedition').game_domain_name).to eq 'skyrimspecialedition'
8
+ end
9
+
10
+ it 'returns the default game mod id' do
11
+ expect_validate_user
12
+ expect(nexus_mods(mod_id: 2014).mod_id).to eq 2014
13
+ end
14
+
15
+ it 'accepts the log level' do
16
+ expect_validate_user(times: 2)
17
+ expect_http_call_to(
18
+ path: '/v1/games.json',
19
+ json: [],
20
+ times: 2
21
+ )
22
+ nexus_mods(log_level: :debug).games
23
+ log_debug = nexus_mods_logs
24
+ reset_nexus_mods
25
+ nexus_mods(log_level: :info).games
26
+ log_info = nexus_mods_logs
27
+ expect(log_debug.size).to be > log_info.size
28
+ end
29
+
30
+ end
31
+
32
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexus_mods
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muriel Salvan
@@ -157,8 +157,9 @@ files:
157
157
  - spec/nexus_mods_test/scenarios/nexus_mods/api/game_spec.rb
158
158
  - spec/nexus_mods_test/scenarios/nexus_mods/api/mod_file_spec.rb
159
159
  - spec/nexus_mods_test/scenarios/nexus_mods/api/mod_spec.rb
160
- - spec/nexus_mods_test/scenarios/nexus_mods_access_spec.rb
161
- - spec/nexus_mods_test/scenarios/nexus_mods_caching_spec.rb
160
+ - spec/nexus_mods_test/scenarios/nexus_mods/nexus_mods_access_spec.rb
161
+ - spec/nexus_mods_test/scenarios/nexus_mods/nexus_mods_caching_spec.rb
162
+ - spec/nexus_mods_test/scenarios/nexus_mods/nexus_mods_common_spec.rb
162
163
  - spec/nexus_mods_test/scenarios/rubocop_spec.rb
163
164
  - spec/spec_helper.rb
164
165
  homepage: https://github.com/Muriel-Salvan/nexus_mods