itch_rewards 0.1.3 → 0.1.4

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: b692518ae6391102d89d5b4fe6f13a378553eba7db5686cfeab7071f7ea5c614
4
- data.tar.gz: 9b3b5e7dd6bf52733ec24bffcf2590bf1368ab0f2a0737e3656cbe54b493b228
3
+ metadata.gz: 28124fd296c0c6919d5a5bf9aa01fe4b0165f310f61bcb78133126fbc6becc9c
4
+ data.tar.gz: c865c1beff954f19277914f9ad33413eb29a02509a38fd37187fde48ff284f64
5
5
  SHA512:
6
- metadata.gz: d0cada09e0bdac62f5fe23e9c98daa7e90b9a2d79940667e1425ca507b945fda71dd8d0e3df30bdddaf0158362b155038b89d860df03b16b2855ee4cda734158
7
- data.tar.gz: e8f02d9624f426c0d78c9f575657b25ad87d766ddf02033233f9920ff570ad735ea90dd148ef05a5e3e6c173f595fba92a0db967e94e64e84ba27b7848e170c0
6
+ metadata.gz: e77fe5877e20855f24b4b1dc2a3a0e6ba8bca40dbd1d0bdcab7574c115821e4c09f11c3e8be2f9af4796af8c1d1744d4e34ee869e547451b1f4a913e2f95f45e
7
+ data.tar.gz: 29db46393f880c338ab51c1bcaffbd2e4327e315a306564709ffa1a3efd291b0a9f26e3e9144980aa27fd59d15aee9665c0be2b898e17b84b286910239693176
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- itch_rewards (0.1.3)
4
+ itch_rewards (0.1.4)
5
5
  dry-cli (~> 0.7.0)
6
6
  itch_client (~> 0.2.0)
7
7
  pastel (~> 0.8.0)
@@ -77,6 +77,12 @@ module ItchRewards
77
77
 
78
78
  table.render(:unicode, multiline: true, padding: [0,1], resize: false, border: { style: :green })
79
79
  end
80
+
81
+ def show_rewards(game)
82
+ cli.say "Rewards for #{game.name} (id: #{game.id})"
83
+ table = objects_to_table(game.rewards.list)
84
+ cli.say render_table(table)
85
+ end
80
86
  end
81
87
 
82
88
  module Commands
@@ -150,21 +156,6 @@ module ItchRewards
150
156
  end
151
157
 
152
158
  module Rewards
153
- extend self
154
- include Helper
155
- def self.show_rewards(game)
156
- cli.say "Rewards for #{game.name} (id: #{game.id})"
157
- table = objects_to_table(game.rewards.list)
158
- cli.say render_table(table)
159
- end
160
-
161
- def self.load_config(path)
162
- YAML.load_file(path)
163
- rescue YAML::ParseError => e
164
- cli.error("Config file (#{path}) is not valid yaml")
165
- exit 1
166
- end
167
-
168
159
  class List < Dry::CLI::Command
169
160
  include AuthOptions
170
161
  include Helper
@@ -187,7 +178,7 @@ module ItchRewards
187
178
  client = authenticated_client!(options)
188
179
  game = options[:id] ? client.game(options[:id]) : client.game(name: options[:name])
189
180
 
190
- Rewards.show_rewards(game)
181
+ show_rewards(game)
191
182
  end
192
183
  end
193
184
 
@@ -238,7 +229,7 @@ module ItchRewards
238
229
 
239
230
  rewards.save reward_list
240
231
 
241
- Rewards.show_rewards(game)
232
+ show_rewards(game)
242
233
  end
243
234
  end
244
235
 
@@ -246,11 +237,18 @@ module ItchRewards
246
237
  include Helper
247
238
  include AuthOptions
248
239
 
240
+ def load_config(path)
241
+ YAML.load_file(path)
242
+ rescue YAML::ParseError => e
243
+ cli.error("Config file (#{path}) is not valid yaml")
244
+ exit 1
245
+ end
246
+
249
247
  desc "Update reward quantity and description from configuration file"
250
248
 
251
249
  option :config, required: true, desc: "Path to config file", default: "itch-reward-config.yml"
252
250
  option :save, type: :boolean, desc: "Saves changes when enabled. Otherwise, dry-run and show result", default: false
253
-
251
+
254
252
  def call(**options)
255
253
  client = authenticated_client!(options)
256
254
 
@@ -259,7 +257,7 @@ module ItchRewards
259
257
  exit 1
260
258
  end
261
259
 
262
- config = Rewards.load_config(options[:config])
260
+ config = load_config(options[:config])
263
261
  unless config["games"].is_a? Hash
264
262
  cli.error("No games configured for rewards updates in config file")
265
263
  exit 1
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ItchRewards
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itch_rewards
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Billiam