itch_client 0.4.1 → 0.4.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/itch/rewards.rb +9 -4
- data/lib/itch/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28084bebc328044fc8928868f6f60a44440709a1418068f64163472cc638b50a
|
4
|
+
data.tar.gz: 4cffdcd95aaf7f96e97f06ad805f6bf33b60d10e4ccde3e441f9221ca7c91dc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a94cdc6fafba609a95616b19fed6e372d47c75e40165fd6eed4c29383e2595bd04adb565f843ea51f36d869ed166bbabe93ef8d71d0876183288317c42c521a4
|
7
|
+
data.tar.gz: 144073e53b7209396d2fffb132cdfb27c7bd7648ffe545cfa6eecfd06a2c0ac4c82da5638538b5fb71fef739a6a124398c276ef67bd606a2e60b1049fa33919a
|
data/lib/itch/rewards.rb
CHANGED
@@ -15,7 +15,8 @@ module Itch
|
|
15
15
|
include RequireAuth
|
16
16
|
include Request
|
17
17
|
|
18
|
-
REWARD_DATA = /GameEdit\.EditRewards\(.*?
|
18
|
+
REWARD_DATA = /GameEdit\.EditRewards\(.*?"rewards":(\[.*?\])/.freeze
|
19
|
+
REWARD_NOUN_DATA = /GameEdit\.EditRewards\(.*?"reward_noun":"(.*?)(?<!\\)"/.freeze
|
19
20
|
|
20
21
|
def initialize(agent, game_id)
|
21
22
|
@agent = agent
|
@@ -95,10 +96,14 @@ module Itch
|
|
95
96
|
raise Error, "Could not find game id #{@game_id} rewards" unless page.code == "200"
|
96
97
|
|
97
98
|
script = page.css("script").find do |node|
|
98
|
-
node.text =~ REWARD_DATA
|
99
|
-
end
|
99
|
+
node.text =~ REWARD_DATA && node.text =~ REWARD_NOUN_DATA
|
100
|
+
end
|
101
|
+
return [] unless script
|
102
|
+
script = script.text
|
100
103
|
|
101
|
-
REWARD_DATA.match(script)[1
|
104
|
+
data = REWARD_DATA.match(script)[1]
|
105
|
+
noun = REWARD_NOUN_DATA.match(script)[1]
|
106
|
+
[data, noun]
|
102
107
|
end
|
103
108
|
|
104
109
|
def parse_row(row)
|
data/lib/itch/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itch_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Billiam
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|