logs_tf 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +3 -2
- data/Gemfile.lock +68 -47
- data/README.md +1 -1
- data/lib/logs_tf/upload.rb +2 -2
- data/lib/logs_tf/version.rb +1 -1
- data/logs_tf.gemspec +1 -1
- data/spec/logs_tf/upload_spec.rb +26 -25
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 30923ae1e7445c66b59097c54b9639f48f5b21a066e229fa674fb8ee12256ef7
|
4
|
+
data.tar.gz: 3ad1b46201a4a14f7c684d4ee133f5b46f11d3db24c58ce76e8c90b52fe77dea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c52eb061d1e5beb06541866e1582eae8c6b56510d2c53f7b3edf494a49028dde6a12724148a91057f3c943cc032af51ecd839223dbd87e992535ba14d5ba3f17
|
7
|
+
data.tar.gz: 4d885017a0e6328f2f923bc96fa820ef2a12d8ab33c6e1177b6d8963b7c700952ff5660c6726f36afecafb8864a8d8b35c59fcaa4b8620b5d6c098fb84901a27
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,57 +1,75 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
logs_tf (0.0.
|
5
|
-
faraday (~>
|
6
|
-
multipart-post (
|
4
|
+
logs_tf (0.0.5)
|
5
|
+
faraday (~> 1.0)
|
6
|
+
multipart-post (>= 1.2.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
coderay (1.1.
|
12
|
-
coveralls (0.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
diff-lcs (1.
|
19
|
-
docile (1.
|
20
|
-
faraday (
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
11
|
+
coderay (1.1.3)
|
12
|
+
coveralls (0.8.23)
|
13
|
+
json (>= 1.8, < 3)
|
14
|
+
simplecov (~> 0.16.1)
|
15
|
+
term-ansicolor (~> 1.3)
|
16
|
+
thor (>= 0.19.4, < 2.0)
|
17
|
+
tins (~> 1.6)
|
18
|
+
diff-lcs (1.4.4)
|
19
|
+
docile (1.4.0)
|
20
|
+
faraday (1.8.0)
|
21
|
+
faraday-em_http (~> 1.0)
|
22
|
+
faraday-em_synchrony (~> 1.0)
|
23
|
+
faraday-excon (~> 1.1)
|
24
|
+
faraday-httpclient (~> 1.0.1)
|
25
|
+
faraday-net_http (~> 1.0)
|
26
|
+
faraday-net_http_persistent (~> 1.1)
|
27
|
+
faraday-patron (~> 1.0)
|
28
|
+
faraday-rack (~> 1.0)
|
29
|
+
multipart-post (>= 1.2, < 3)
|
30
|
+
ruby2_keywords (>= 0.0.4)
|
31
|
+
faraday-em_http (1.0.0)
|
32
|
+
faraday-em_synchrony (1.0.0)
|
33
|
+
faraday-excon (1.1.0)
|
34
|
+
faraday-httpclient (1.0.1)
|
35
|
+
faraday-net_http (1.0.1)
|
36
|
+
faraday-net_http_persistent (1.2.0)
|
37
|
+
faraday-patron (1.0.0)
|
38
|
+
faraday-rack (1.0.0)
|
39
|
+
json (2.6.1)
|
40
|
+
method_source (1.0.0)
|
41
|
+
multipart-post (2.1.1)
|
42
|
+
pry (0.14.1)
|
43
|
+
coderay (~> 1.1)
|
44
|
+
method_source (~> 1.0)
|
45
|
+
pry-nav (1.0.0)
|
46
|
+
pry (>= 0.9.10, < 0.15)
|
47
|
+
rspec (3.10.0)
|
48
|
+
rspec-core (~> 3.10.0)
|
49
|
+
rspec-expectations (~> 3.10.0)
|
50
|
+
rspec-mocks (~> 3.10.0)
|
51
|
+
rspec-core (3.10.1)
|
52
|
+
rspec-support (~> 3.10.0)
|
53
|
+
rspec-expectations (3.10.1)
|
54
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
55
|
+
rspec-support (~> 3.10.0)
|
56
|
+
rspec-mocks (3.10.2)
|
57
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
58
|
+
rspec-support (~> 3.10.0)
|
59
|
+
rspec-support (3.10.3)
|
60
|
+
ruby2_keywords (0.0.5)
|
61
|
+
simplecov (0.16.1)
|
62
|
+
docile (~> 1.1)
|
63
|
+
json (>= 1.8, < 3)
|
64
|
+
simplecov-html (~> 0.10.0)
|
65
|
+
simplecov-html (0.10.2)
|
66
|
+
sync (0.5.0)
|
67
|
+
term-ansicolor (1.7.1)
|
68
|
+
tins (~> 1.0)
|
69
|
+
thor (1.1.0)
|
70
|
+
tins (1.29.1)
|
71
|
+
sync
|
72
|
+
vcr (6.0.0)
|
55
73
|
|
56
74
|
PLATFORMS
|
57
75
|
ruby
|
@@ -62,3 +80,6 @@ DEPENDENCIES
|
|
62
80
|
pry-nav
|
63
81
|
rspec
|
64
82
|
vcr
|
83
|
+
|
84
|
+
BUNDLED WITH
|
85
|
+
2.2.32
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Logs.tf interface [![Build Status](https://secure.travis-ci.org/Arie/logs_tf.png)](http://travis-ci.org/Arie/logs_tf) [![Dependencies](https://gemnasium.com/Arie/logs_tf.png)](https://gemnasium.com/Arie/logs_tf.png) [![Code Climate](https://codeclimate.com/github/Arie/logs_tf.png)](https://codeclimate.com/github/Arie/logs_tf) [![Coverage Status](https://coveralls.io/repos/Arie/logs_tf/badge.
|
1
|
+
# Logs.tf interface [![Build Status](https://secure.travis-ci.org/Arie/logs_tf.png)](http://travis-ci.org/Arie/logs_tf) [![Dependencies](https://gemnasium.com/Arie/logs_tf.png)](https://gemnasium.com/Arie/logs_tf.png) [![Code Climate](https://codeclimate.com/github/Arie/logs_tf.png)](https://codeclimate.com/github/Arie/logs_tf) [![Coverage Status](https://coveralls.io/repos/github/Arie/logs_tf/badge.svg?branch=master)](https://coveralls.io/r/Arie/logs_tf)
|
2
2
|
|
3
3
|
A gem for the logs.tf API
|
4
4
|
|
data/lib/logs_tf/upload.rb
CHANGED
@@ -60,8 +60,6 @@ module LogsTF
|
|
60
60
|
response_body["error"]
|
61
61
|
end
|
62
62
|
|
63
|
-
private
|
64
|
-
|
65
63
|
def response_body
|
66
64
|
@response_body ||= JSON.parse(response.body)
|
67
65
|
end
|
@@ -74,6 +72,8 @@ module LogsTF
|
|
74
72
|
response.status == 200
|
75
73
|
end
|
76
74
|
|
75
|
+
private
|
76
|
+
|
77
77
|
def post_options
|
78
78
|
{ :key => api_key,
|
79
79
|
:title => title,
|
data/lib/logs_tf/version.rb
CHANGED
data/logs_tf.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.require_paths = ["lib"]
|
15
15
|
gem.homepage = 'http://github.com/Arie/logs_tf'
|
16
16
|
|
17
|
-
gem.add_dependency "faraday", "~> 0
|
17
|
+
gem.add_dependency "faraday", "~> 1.0"
|
18
18
|
gem.add_dependency "multipart-post", ">= 1.2.0"
|
19
19
|
|
20
20
|
gem.add_development_dependency "vcr"
|
data/spec/logs_tf/upload_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'pry-nav'
|
2
3
|
|
3
4
|
module LogsTF
|
4
5
|
|
@@ -10,110 +11,110 @@ module LogsTF
|
|
10
11
|
let(:upload) { Upload.new(log, logs_tf_url ) }
|
11
12
|
|
12
13
|
|
13
|
-
vcr_options = { :cassette_name => "upload", :record => :
|
14
|
+
vcr_options = { :cassette_name => "upload", :record => :none, :match_requests_on => [:method, :uri] }
|
14
15
|
context "uploading logfiles", :vcr => vcr_options do
|
15
16
|
|
16
17
|
describe "#send" do
|
17
18
|
|
18
19
|
it "knows the status of the request" do
|
19
20
|
upload.send
|
20
|
-
upload.
|
21
|
+
expect(upload).to be_request_success
|
21
22
|
end
|
22
23
|
|
23
24
|
it "knows if tf.logs was able to parse the log" do
|
24
25
|
upload.send
|
25
|
-
upload.
|
26
|
+
expect(upload).to be_upload_success
|
26
27
|
end
|
27
28
|
|
28
29
|
it "knows the log's location after sending" do
|
29
30
|
upload.send
|
30
|
-
upload.url.
|
31
|
+
expect(upload.url).to eql "#{logs_tf_url}/91"
|
31
32
|
end
|
32
33
|
|
33
34
|
it "raises the appropriate error when upload was unsuccessful" do
|
34
|
-
upload.
|
35
|
-
upload.
|
36
|
-
upload.
|
37
|
-
upload.
|
35
|
+
expect(upload).to receive(:connection).and_return(double(:connection).as_null_object)
|
36
|
+
expect(upload).to receive(:request_success?).and_return(true)
|
37
|
+
expect(upload).to receive(:upload_success?).and_return(false)
|
38
|
+
expect(upload).to receive(:raise_logs_tf_error)
|
38
39
|
upload.send
|
39
40
|
end
|
40
41
|
|
41
42
|
it "raises an error when the response status is not 200" do
|
42
|
-
upload.
|
43
|
-
upload.
|
43
|
+
expect(upload).to receive(:connection).and_return(double(:connection).as_null_object)
|
44
|
+
expect(upload).to receive(:request_success?).and_return(false)
|
44
45
|
expect{upload.send}.to raise_error Upload::RequestError
|
45
46
|
end
|
46
47
|
|
47
48
|
end
|
48
49
|
|
49
50
|
describe '#error' do
|
50
|
-
before { upload.
|
51
|
+
before { expect(upload).to receive(:response).and_return(double(body: '{ "error": "foobar" }')) }
|
51
52
|
|
52
53
|
it "parses the JSON respone from logs.tf for the error message" do
|
53
|
-
upload.error.
|
54
|
+
expect(upload.error).to eql 'foobar'
|
54
55
|
end
|
55
56
|
|
56
57
|
end
|
57
58
|
|
58
59
|
describe '#raise_logs_tf_error' do
|
59
60
|
|
60
|
-
before { upload.
|
61
|
+
before { expect(upload).to receive(:response).and_return(double(body: '{ "error": "foobar" }')) }
|
61
62
|
|
62
63
|
it "raises InvalidLogError" do
|
63
|
-
upload.
|
64
|
+
expect(upload).to receive(:error).and_return("Invalid log file")
|
64
65
|
expect{upload.raise_logs_tf_error}.to raise_error Upload::InvalidLogError
|
65
66
|
end
|
66
67
|
|
67
68
|
it "raises MissingLogError" do
|
68
|
-
upload.
|
69
|
+
expect(upload).to receive(:error).and_return("No file")
|
69
70
|
expect{upload.raise_logs_tf_error}.to raise_error Upload::MissingLogError
|
70
71
|
end
|
71
72
|
|
72
73
|
it "raises NotAuthenticatedError" do
|
73
|
-
upload.
|
74
|
+
expect(upload).to receive(:error).and_return("Not authenticated")
|
74
75
|
expect{upload.raise_logs_tf_error}.to raise_error Upload::NotAuthenticatedError
|
75
76
|
end
|
76
77
|
|
77
78
|
it "raises InvalidAPIKeyError" do
|
78
|
-
upload.
|
79
|
+
expect(upload).to receive(:error).and_return("Invalid API key")
|
79
80
|
expect{upload.raise_logs_tf_error}.to raise_error Upload::InvalidAPIKeyError
|
80
81
|
end
|
81
82
|
|
82
83
|
it "raises NoValidRoundsError" do
|
83
|
-
upload.
|
84
|
+
expect(upload).to receive(:error).and_return("Log has no valid rounds (at least one needed)")
|
84
85
|
expect{upload.raise_logs_tf_error}.to raise_error Upload::NoValidRoundsError
|
85
86
|
end
|
86
87
|
|
87
88
|
it "raises NotEnoughPlayersError" do
|
88
|
-
upload.
|
89
|
+
expect(upload).to receive(:error).and_return("Not enough players (2 needed)")
|
89
90
|
expect{upload.raise_logs_tf_error}.to raise_error Upload::NotEnoughPlayersError
|
90
91
|
end
|
91
92
|
|
92
93
|
it "raises LogIsEmptyError" do
|
93
|
-
upload.
|
94
|
+
expect(upload).to receive(:error).and_return("Log is empty")
|
94
95
|
expect{upload.raise_logs_tf_error}.to raise_error Upload::LogIsEmptyError
|
95
96
|
end
|
96
97
|
|
97
98
|
it "raises ParsingFailedError" do
|
98
|
-
upload.
|
99
|
+
expect(upload).to receive(:error).and_return("Parsing failed in line 123")
|
99
100
|
expect{upload.raise_logs_tf_error}.to raise_error Upload::ParsingFailedError
|
100
101
|
|
101
|
-
upload.
|
102
|
+
expect(upload).to receive(:error).and_return("Parsing failed in line 456")
|
102
103
|
expect{upload.raise_logs_tf_error}.to raise_error Upload::ParsingFailedError
|
103
104
|
end
|
104
105
|
|
105
106
|
it "raises MissingAPIKeyOrLoginError" do
|
106
|
-
upload.
|
107
|
+
expect(upload).to receive(:error).and_return("Missing API key or login")
|
107
108
|
expect{upload.raise_logs_tf_error}.to raise_error Upload::MissingAPIKeyOrLoginError
|
108
109
|
end
|
109
110
|
|
110
111
|
it "raises GuruMeditationError" do
|
111
|
-
upload.
|
112
|
+
expect(upload).to receive(:error).and_return("Guru Meditation")
|
112
113
|
expect{upload.raise_logs_tf_error}.to raise_error Upload::GuruMeditationError
|
113
114
|
end
|
114
115
|
|
115
116
|
it "raises UnknownLogsTFError" do
|
116
|
-
upload.
|
117
|
+
expect(upload).to receive(:error).and_return("Foobar")
|
117
118
|
expect{upload.raise_logs_tf_error}.to raise_error Upload::UnknownLogsTfError
|
118
119
|
end
|
119
120
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logs_tf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arie
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: multipart-post
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,8 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0'
|
140
140
|
requirements: []
|
141
|
-
|
142
|
-
rubygems_version: 2.4.8
|
141
|
+
rubygems_version: 3.2.32
|
143
142
|
signing_key:
|
144
143
|
specification_version: 4
|
145
144
|
summary: Logs.tf
|