sumo-search 2.0.1 → 2.0.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/.rspec +2 -0
- data/lib/sumo.rb +3 -8
- data/lib/sumo/version.rb +1 -1
- data/spec/lib/sumo_spec.rb +66 -1
- data/spec/spec_helper.rb +0 -8
- data/spec/vcr/Sumo/_search/creates_a_new_Sumo_Search.yml +42 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d9076840ea716f6b4c15687d12300c5d484b975
|
4
|
+
data.tar.gz: d6e883050a57e5f1d026bb8080746442b6d16b71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8320042419cabc9fb813c4abb57c486128f9f49eaca6892169ea747fa501fc84a332fac39d676d8f366450af8df90a3ee1058cf547b318f04670ec124d19820e
|
7
|
+
data.tar.gz: 090ab6fb6f9c8420cb37e41034f946128126891dbae763eefbed1b4827e94302c2d1167e0eb302c82fc70b9f6e6a2fdc30ff462cfb5894ded72f87d5e2646f09
|
data/.rspec
ADDED
data/lib/sumo.rb
CHANGED
@@ -21,43 +21,38 @@ module Sumo
|
|
21
21
|
|
22
22
|
# Define top-level functions.
|
23
23
|
|
24
|
+
module_function
|
25
|
+
|
24
26
|
def creds
|
25
27
|
@creds ||= config.load_creds!
|
26
28
|
end
|
27
|
-
module_function :creds
|
28
29
|
|
29
30
|
def creds=(new_creds)
|
30
31
|
@creds = new_creds
|
31
32
|
end
|
32
|
-
module_function :creds=
|
33
33
|
|
34
34
|
# The default config for the gem.
|
35
35
|
def config
|
36
36
|
@config ||= Sumo::Config.new
|
37
37
|
end
|
38
|
-
module_function :config
|
39
38
|
|
40
39
|
# Reset the default config for the gem.
|
41
40
|
def config=(new_config)
|
42
41
|
@config = new_config
|
43
42
|
end
|
44
|
-
module_function :config=
|
45
43
|
|
46
44
|
# The default client for the gem.
|
47
45
|
def client
|
48
46
|
@client ||= Sumo::Client.new
|
49
47
|
end
|
50
|
-
module_function :client
|
51
48
|
|
52
49
|
# Reset the default client for the gem.
|
53
50
|
def client=(new_client)
|
54
51
|
@client = new_client
|
55
52
|
end
|
56
|
-
module_function :client=
|
57
53
|
|
58
54
|
# Create a new search.
|
59
55
|
def search(*args)
|
60
|
-
Sumo::Search.
|
56
|
+
Sumo::Search.create(*args)
|
61
57
|
end
|
62
|
-
module_function :search
|
63
58
|
end
|
data/lib/sumo/version.rb
CHANGED
data/spec/lib/sumo_spec.rb
CHANGED
@@ -1,5 +1,70 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Sumo do
|
4
|
-
|
4
|
+
describe '.config' do
|
5
|
+
subject { Sumo.config }
|
6
|
+
|
7
|
+
it { should be_a(Sumo::Config) }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '.config=' do
|
11
|
+
let(:test_config) { double(:test_config) }
|
12
|
+
|
13
|
+
it 'changes the config' do
|
14
|
+
expect { Sumo.config = test_config }
|
15
|
+
.to change { Sumo.config }
|
16
|
+
.to(test_config)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '.creds' do
|
21
|
+
subject { Sumo.creds }
|
22
|
+
|
23
|
+
it { should_not be_nil }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '.creds=' do
|
27
|
+
let(:test_creds) { double(:creds) }
|
28
|
+
|
29
|
+
it 'sets the creds' do
|
30
|
+
expect { Sumo.creds = test_creds }
|
31
|
+
.to change { Sumo.creds }
|
32
|
+
.to(test_creds)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '.client' do
|
37
|
+
subject { Sumo.client }
|
38
|
+
|
39
|
+
it { should be_a(Sumo::Client) }
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '.client=' do
|
43
|
+
let!(:original) { Sumo.client }
|
44
|
+
let(:test_client) { double(:client) }
|
45
|
+
|
46
|
+
after { Sumo.client = original }
|
47
|
+
|
48
|
+
it 'sets the client' do
|
49
|
+
expect { Sumo.client = test_client }
|
50
|
+
.to change { Sumo.client }
|
51
|
+
.to(test_client)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe '.search' do
|
56
|
+
let(:params) {
|
57
|
+
{
|
58
|
+
:query => '| count _sourceCategory',
|
59
|
+
:from => '2014-01-01T00:00:00',
|
60
|
+
:to => '2014-01-04T00:00:00',
|
61
|
+
:time_zone => 'EST'
|
62
|
+
}
|
63
|
+
}
|
64
|
+
subject { Sumo.search(params) }
|
65
|
+
|
66
|
+
it 'creates a new Sumo::Search', :vcr do
|
67
|
+
expect(subject).to be_a(Sumo::Search)
|
68
|
+
end
|
69
|
+
end
|
5
70
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -8,11 +8,3 @@ require 'pry'
|
|
8
8
|
require 'sumo'
|
9
9
|
|
10
10
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |file| require file }
|
11
|
-
|
12
|
-
RSpec.configure do |config|
|
13
|
-
config.color_enabled = true
|
14
|
-
config.formatter = :documentation
|
15
|
-
config.mock_with :rspec
|
16
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
17
|
-
config.tty = true
|
18
|
-
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.sumologic.com/api/v1/search/jobs
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"query":"| count _sourceCategory","from":"2014-01-01T00:00:00","to":"2014-01-04T00:00:00","timeZone":"EST"}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- excon/0.39.5
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Accept:
|
15
|
+
- application/json
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 202
|
19
|
+
message:
|
20
|
+
headers:
|
21
|
+
Cache-control:
|
22
|
+
- no-cache="set-cookie"
|
23
|
+
Content-Type:
|
24
|
+
- application/json
|
25
|
+
Date:
|
26
|
+
- Mon, 08 Sep 2014 16:53:32 GMT
|
27
|
+
Expires:
|
28
|
+
- Thu, 01-Jan-1970 00:00:00 GMT
|
29
|
+
Location:
|
30
|
+
- http://api.sumologic.com/api/v1/search/jobs/190E3CAB831B33E3
|
31
|
+
Strict-Transport-Security:
|
32
|
+
- max-age=15552000
|
33
|
+
Content-Length:
|
34
|
+
- '117'
|
35
|
+
Connection:
|
36
|
+
- keep-alive
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"id":"190E3CAB831B33E3","link":{"rel":"filtered","href":"filtered"}}'
|
40
|
+
http_version:
|
41
|
+
recorded_at: Mon, 08 Sep 2014 16:53:37 GMT
|
42
|
+
recorded_with: VCR 2.9.0
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sumo-search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Swipely, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -146,6 +146,7 @@ extra_rdoc_files: []
|
|
146
146
|
files:
|
147
147
|
- ".cane"
|
148
148
|
- ".gitignore"
|
149
|
+
- ".rspec"
|
149
150
|
- ".travis.yml"
|
150
151
|
- Gemfile
|
151
152
|
- README.md
|
@@ -168,6 +169,7 @@ files:
|
|
168
169
|
- spec/lib/sumo_spec.rb
|
169
170
|
- spec/spec_helper.rb
|
170
171
|
- spec/support/vcr.rb
|
172
|
+
- spec/vcr/Sumo/_search/creates_a_new_Sumo_Search.yml
|
171
173
|
- spec/vcr/Sumo_Search/_create/sets_the_id_and_client.yml
|
172
174
|
- spec/vcr/Sumo_Search/_delete_/deletes_the_search.yml
|
173
175
|
- spec/vcr/Sumo_Search/_messages/returns_an_Enumerator_of_each_message_in_the_search.yml
|
@@ -194,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
196
|
version: '0'
|
195
197
|
requirements: []
|
196
198
|
rubyforge_project:
|
197
|
-
rubygems_version: 2.2.
|
199
|
+
rubygems_version: 2.2.2
|
198
200
|
signing_key:
|
199
201
|
specification_version: 4
|
200
202
|
summary: A simple REST client for the Sumo Search Job API
|
@@ -208,9 +210,9 @@ test_files:
|
|
208
210
|
- spec/lib/sumo_spec.rb
|
209
211
|
- spec/spec_helper.rb
|
210
212
|
- spec/support/vcr.rb
|
213
|
+
- spec/vcr/Sumo/_search/creates_a_new_Sumo_Search.yml
|
211
214
|
- spec/vcr/Sumo_Search/_create/sets_the_id_and_client.yml
|
212
215
|
- spec/vcr/Sumo_Search/_delete_/deletes_the_search.yml
|
213
216
|
- spec/vcr/Sumo_Search/_messages/returns_an_Enumerator_of_each_message_in_the_search.yml
|
214
217
|
- spec/vcr/Sumo_Search/_records/returns_an_Enumerator_of_each_record_in_the_search.yml
|
215
218
|
- spec/vcr/Sumo_Search/_status/returns_the_status_of_the_search.yml
|
216
|
-
has_rdoc:
|