sumologic 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 92212eafe916379768f0265df90b6999adb2ea5b
4
+ data.tar.gz: 62a4e2331c09cd0c46bc40fd25e9adb771241057
5
+ SHA512:
6
+ metadata.gz: 91d18df5f138d52177cb2ff5170cc3cbfa96700e6cebda30b20feb9dda373f67f47a947f0ac1a4313adf9e1f7da6d5dd8eb03ecaff20bf9b32f116e9fa91d8e1
7
+ data.tar.gz: 6dd094607a5e5c5954f029a7824c4e28a0db2c8bf6d2ef75cc9afb661252973fd89e77939e6daec90885f835d84cb2878ebdba79cb060f6db82c52e21a0a1696
@@ -0,0 +1,4 @@
1
+ CHANGELOG
2
+ ---------
3
+ - **2015-06-09**: 0.0.1
4
+ - Initial commit
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2015 John Wang
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,22 @@
1
+ Sumo Logic Ruby SDK
2
+ ===================
3
+
4
+ [![Build Status](https://img.shields.io/travis/grokify/sumologic-sdk-ruby/master.svg)](https://travis-ci.org/grokify/sumologic-sdk-ruby)
5
+ [![Code Climate](https://codeclimate.com/github/grokify/sumologic-sdk-ruby/badges/gpa.svg)](https://codeclimate.com/github/grokify/sumologic-sdk-ruby)
6
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/grokify/sumologic-sdk-ruby/master/LICENSE.txt)
7
+
8
+ Ruby interface to the Sumo Logic REST API.
9
+
10
+ Please add your scripts and programs to the `scripts` folder.
11
+
12
+ ## Usage
13
+
14
+ The interface for this SDK is still being built out but follows the structure in the
15
+ [Sumo Logic Python SDK](https://github.com/SumoLogic/sumologic-python-sdk).
16
+
17
+ Exampe scripts are located in the `scripts` director of the GitHub repo.
18
+
19
+ ## More Info
20
+
21
+ 1. [Sumo Logic API Documentation](https://github.com/SumoLogic/sumo-api-doc/wiki)
22
+ 2. [Sumo Logic Python SDK](https://github.com/SumoLogic/sumologic-python-sdk)
@@ -0,0 +1,19 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+
4
+ desc 'Default: run unit tests.'
5
+ task :default => :test
6
+
7
+ desc 'Test the library.'
8
+ Rake::TestTask.new do |t|
9
+ t.libs << 'lib'
10
+ t.pattern = 'test/**/test_*.rb'
11
+ t.verbose = false
12
+ end
13
+
14
+ desc 'Generate YARD documentation.'
15
+ task :gendoc do
16
+ # puts 'yard doc generation disabled until JRuby build native extensions for redcarpet or yard removes the dependency.'
17
+ system "yardoc"
18
+ system "yard stats --list-undoc"
19
+ end
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,49 @@
1
+ require 'faraday'
2
+ require 'faraday_middleware'
3
+ require 'faraday-cookie_jar'
4
+ require 'multi_json'
5
+
6
+ module SumoLogic
7
+
8
+ URL = 'https://api.sumologic.com/api/v1'
9
+
10
+ class Client
11
+
12
+ def initialize(accessId=nil, accessKey=nil, endpoint=SumoLogic::URL)
13
+ @endpoint = endpoint
14
+ @session = Faraday
15
+ headers = {'Content-Type' => 'application/json', 'Accept' => 'application/json'}
16
+ @session = Faraday.new(:url => @endpoint, :headers => headers) do |conn|
17
+ conn.basic_auth(accessId, accessKey)
18
+ conn.use :cookie_jar
19
+ conn.request :json
20
+ conn.response :json, :content_type => 'application/json'
21
+ conn.adapter Faraday.default_adapter
22
+ end
23
+ end
24
+
25
+ def search_job(query, fromTime=nil, toTime=nil, timeZone='UTC')
26
+ params = {:query => query, :from => fromTime, :to => toTime, :timeZone => timeZone}
27
+ r = @session.post do |req|
28
+ req.url 'search/jobs'
29
+ req.body = MultiJson.encode(params)
30
+ end
31
+ end
32
+
33
+ def search_job_status(search_job={})
34
+ r = @session.get do |req|
35
+ req.url 'search/jobs/' + search_job['id'].to_s
36
+ end
37
+ end
38
+
39
+ def search_job_records(search_job, limit=nil, offset=0)
40
+ params = {:limit => limit, :offset => offset}
41
+ r = @session.get do |req|
42
+ req.url 'search/jobs/' + search_job['id'].to_s + '/records'
43
+ req.params = params
44
+ end
45
+ end
46
+
47
+ end
48
+
49
+ end
@@ -0,0 +1,10 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
4
+ require 'test/unit'
5
+ require 'sumologic'
6
+
7
+ client = SumoLogic::Client.new(
8
+ 'myAccessId',
9
+ 'myAccessKey'
10
+ )
@@ -0,0 +1,16 @@
1
+ require './test/test_helper.rb'
2
+
3
+ require 'sumologic'
4
+
5
+ class SumoLogicTest < Test::Unit::TestCase
6
+ def testSetup
7
+
8
+ client = SumoLogic::Client.new(
9
+ 'myAccessId',
10
+ 'myAccessKey'
11
+ )
12
+
13
+ assert_equal "SumoLogic::Client", client.class.name
14
+
15
+ end
16
+ end
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sumologic
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - John Wang
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '0.9'
20
+ - - '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0.9'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '0.9'
30
+ - - '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0.9'
33
+ - !ruby/object:Gem::Dependency
34
+ name: faraday_middleware
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ - - '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ~>
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ - !ruby/object:Gem::Dependency
54
+ name: faraday-cookie_jar
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ type: :runtime
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ - !ruby/object:Gem::Dependency
68
+ name: multi_json
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ type: :runtime
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ - !ruby/object:Gem::Dependency
82
+ name: test-unit
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ description: An unofficial Ruby SDK for the Sumo Logic REST API
96
+ email: johncwang@gmail.com
97
+ executables: []
98
+ extensions: []
99
+ extra_rdoc_files: []
100
+ files:
101
+ - CHANGELOG.md
102
+ - LICENSE.txt
103
+ - README.md
104
+ - Rakefile
105
+ - VERSION.txt
106
+ - lib/sumologic.rb
107
+ - test/test_helper.rb
108
+ - test/test_setup.rb
109
+ homepage: https://github.com/grokify/
110
+ licenses: []
111
+ metadata: {}
112
+ post_install_message:
113
+ rdoc_options: []
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ requirements: []
127
+ rubyforge_project:
128
+ rubygems_version: 2.1.5
129
+ signing_key:
130
+ specification_version: 4
131
+ summary: Sumo Logic SDK - Unofficial Ruby SDK for the Sumo Logic REST API
132
+ test_files: []