nerd_log 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/nerd_log/fight.rb +14 -13
- data/lib/nerd_log/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzgxNzEzZTYxMzNjMGQ2YjNjZGQ3NmExMWRiY2IxMzVkM2M1OTExMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MWY4ZDNiY2NhMDkxZTQ3OWQwMjg0ZmRjYmVkYTJhYjIzMDlkMDZkNw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmVmMWIxNDEyZmUyMWUyN2Q1Njg5Y2RlNzZiOTU0NzM3YzA4NWU3N2QyZTRi
|
10
|
+
ZmUyMTYzZWRkM2YzZThkNmU5M2I3YTUwNWJjNzkzNDgzNWUxYTdkYjllMDhk
|
11
|
+
ZGQ4OWIwZTM3MzVkZGJlMzIzMzYzY2E2NWMzMmYzMzFkNDJkNjg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTRmN2I1ZDUzMDM0YzNiZDA3NDliZjc5ZjRhMmM3ZWJlN2JiNzg5OGI1NmFm
|
14
|
+
ZjA1MDY2MjAyZTc0NzNmMjRkMDQxOGRkMTdmNTI4MDYzZWVjMzBkZTAxYjI3
|
15
|
+
ZWZkMzgzZTA3MTE4YmYyNmJlNjJiMzg5YjkxZmJlNGY3ZmI5ZDU=
|
data/lib/nerd_log/fight.rb
CHANGED
@@ -8,26 +8,27 @@ module NerdLog
|
|
8
8
|
@http_connection = options.fetch(:http_connection, NerdLog.configuration.http_connection)
|
9
9
|
end
|
10
10
|
|
11
|
-
def kills
|
12
|
-
@kills ||= fights.select {|f| f.kill == true }
|
13
|
-
end
|
14
|
-
|
15
|
-
def attempts
|
16
|
-
@attempts ||= fights.select {|f| f.kill == false }
|
17
|
-
end
|
18
|
-
|
19
11
|
def fights
|
20
12
|
unless @fights
|
21
|
-
|
22
|
-
|
13
|
+
body = fetch.body
|
14
|
+
raw_fights = body['fights'].select {|f| f['boss'] != 0}
|
15
|
+
friendlies = body['friendlies'].select {|f| f['type'] != 'NPC'}
|
16
|
+
@fights = {}
|
23
17
|
|
24
18
|
raw_fights.each do |raw_fight|
|
25
|
-
@fights
|
19
|
+
@fights[raw_fight['id']] = OpenStruct.new(id: raw_fight['boss'],
|
26
20
|
kill: raw_fight['kill'],
|
27
|
-
difficulty: raw_fight['difficulty'])
|
21
|
+
difficulty: raw_fight['difficulty'], players: [])
|
22
|
+
end
|
23
|
+
|
24
|
+
friendlies.each do |player|
|
25
|
+
player['fights'].each do |fight|
|
26
|
+
boss_fight = @fights[fight['id']]
|
27
|
+
boss_fight.players.push(player['name']) if boss_fight
|
28
|
+
end
|
28
29
|
end
|
29
30
|
end
|
30
|
-
@fights
|
31
|
+
@fights.values
|
31
32
|
end
|
32
33
|
|
33
34
|
def fetch
|
data/lib/nerd_log/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nerd_log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Robertson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|