nerd_log 0.2.0 → 0.3.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 +39 -0
- data/lib/nerd_log/version.rb +1 -1
- data/lib/nerd_log.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzhlNzIxNWY4ZjkzNjBlOGZhNDk3OTliOWExYThlZTk4ZDIzM2FlMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Zjc2YWZlZjVmYTQzOWU0OWJjNTU0OTQ4OTMxZGYyMTg0NDU2YzkyYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjNkODQyMjk5NWM0NWIxM2ZlODkxZTY0ZWE2ZTI3ZGYyODIzYjUzM2IyOTEz
|
10
|
+
NTAxZmMyODJmODgwMGQwZDJhZGU2NmI2MzE2MGRhZTQ2Zjg1YjUwNjVkMmFl
|
11
|
+
OTBiZDY4MWU1YzU0ZjcwYTZhMTI3MDIxN2NmMmE5YzI0YTRmMzk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YWExYzYzZTIxYzc4YzkzMzkwNWQ2NzkyZDU3MGE2NTExNWJjYTdlZmUzMjll
|
14
|
+
NTc3MzkzMjYyNWFiYmVhNzc5M2IzNjU3ZmRlNjU1MTc5MDAzMTE2MjFhMDg4
|
15
|
+
OTBmZjc3ZDQzMDNjNzgyYTE2OTUxODRmODg5OTFiMzMzMGM1ZGI=
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
|
3
|
+
module NerdLog
|
4
|
+
class Fight
|
5
|
+
attr_reader :report_id, :http_connection
|
6
|
+
def initialize(options = {})
|
7
|
+
@report_id = options.fetch(:report_id)
|
8
|
+
@http_connection = options.fetch(:http_connection, NerdLog.configuration.http_connection)
|
9
|
+
end
|
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
|
+
def fights
|
20
|
+
unless @fights
|
21
|
+
raw_fights = fetch.body['fights'].select {|f| f['boss'] != 0}
|
22
|
+
@fights = []
|
23
|
+
|
24
|
+
raw_fights.each do |raw_fight|
|
25
|
+
@fights << OpenStruct.new(id: raw_fight['boss'],
|
26
|
+
kill: raw_fight['kill'],
|
27
|
+
difficulty: raw_fight['difficulty'])
|
28
|
+
end
|
29
|
+
end
|
30
|
+
@fights
|
31
|
+
end
|
32
|
+
|
33
|
+
def fetch
|
34
|
+
response = http_connection.get("report/fights/#{report_id}")
|
35
|
+
|
36
|
+
response
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/nerd_log/version.rb
CHANGED
data/lib/nerd_log.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nerd_log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Robertson
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- Rakefile
|
81
81
|
- lib/nerd_log.rb
|
82
82
|
- lib/nerd_log/encounter.rb
|
83
|
+
- lib/nerd_log/fight.rb
|
83
84
|
- lib/nerd_log/report.rb
|
84
85
|
- lib/nerd_log/version.rb
|
85
86
|
- nerd_log.gemspec
|