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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzhlNzIxNWY4ZjkzNjBlOGZhNDk3OTliOWExYThlZTk4ZDIzM2FlMw==
4
+ YzgxNzEzZTYxMzNjMGQ2YjNjZGQ3NmExMWRiY2IxMzVkM2M1OTExMA==
5
5
  data.tar.gz: !binary |-
6
- Zjc2YWZlZjVmYTQzOWU0OWJjNTU0OTQ4OTMxZGYyMTg0NDU2YzkyYQ==
6
+ MWY4ZDNiY2NhMDkxZTQ3OWQwMjg0ZmRjYmVkYTJhYjIzMDlkMDZkNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjNkODQyMjk5NWM0NWIxM2ZlODkxZTY0ZWE2ZTI3ZGYyODIzYjUzM2IyOTEz
10
- NTAxZmMyODJmODgwMGQwZDJhZGU2NmI2MzE2MGRhZTQ2Zjg1YjUwNjVkMmFl
11
- OTBiZDY4MWU1YzU0ZjcwYTZhMTI3MDIxN2NmMmE5YzI0YTRmMzk=
9
+ MmVmMWIxNDEyZmUyMWUyN2Q1Njg5Y2RlNzZiOTU0NzM3YzA4NWU3N2QyZTRi
10
+ ZmUyMTYzZWRkM2YzZThkNmU5M2I3YTUwNWJjNzkzNDgzNWUxYTdkYjllMDhk
11
+ ZGQ4OWIwZTM3MzVkZGJlMzIzMzYzY2E2NWMzMmYzMzFkNDJkNjg=
12
12
  data.tar.gz: !binary |-
13
- YWExYzYzZTIxYzc4YzkzMzkwNWQ2NzkyZDU3MGE2NTExNWJjYTdlZmUzMjll
14
- NTc3MzkzMjYyNWFiYmVhNzc5M2IzNjU3ZmRlNjU1MTc5MDAzMTE2MjFhMDg4
15
- OTBmZjc3ZDQzMDNjNzgyYTE2OTUxODRmODg5OTFiMzMzMGM1ZGI=
13
+ YTRmN2I1ZDUzMDM0YzNiZDA3NDliZjc5ZjRhMmM3ZWJlN2JiNzg5OGI1NmFm
14
+ ZjA1MDY2MjAyZTc0NzNmMjRkMDQxOGRkMTdmNTI4MDYzZWVjMzBkZTAxYjI3
15
+ ZWZkMzgzZTA3MTE4YmYyNmJlNjJiMzg5YjkxZmJlNGY3ZmI5ZDU=
@@ -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
- raw_fights = fetch.body['fights'].select {|f| f['boss'] != 0}
22
- @fights = []
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 << OpenStruct.new(id: raw_fight['boss'],
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
@@ -1,3 +1,3 @@
1
1
  module NerdLog
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.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-01 00:00:00.000000000 Z
11
+ date: 2015-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday