logcamp 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -8
- data/lib/logcamp.rb +1 -1
- data/lib/logcamp/version.rb +1 -1
- data/test/logcamp/event_test.rb +7 -6
- data/test/test_helper.rb +8 -7
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 156b9c4042d010bb133d4f9a72638f87dfb53db0
|
4
|
+
data.tar.gz: 55598d09d14a273a7ba14111cde9ae80255ab89f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f17cc790921d5466a525561491667c5571e02d0258d80a69ed1729dcfe8ab03b2b052669bda2186cb7b6f560f274890c101b8441d08ccebb789f19f16fe31e6
|
7
|
+
data.tar.gz: 21af2fbf45dff56c01f72d9fe76aabf07ddd26a4d9398736bb1a69089fffde68cae61ba4ed0042aa1cd87023d708a41348f4f60a6076dfe4e1fd3dd1ade6a193
|
data/README.md
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
# Logcamp
|
1
|
+
# Logcamp
|
2
2
|
|
3
3
|
[![Build Status](https://semaphoreapp.com/api/v1/projects/0d7ed887-f4de-410c-a678-eb47c9c66aa8/275246/shields_badge.svg)](https://semaphoreapp.com/olimart/logcamp-ruby)
|
4
4
|
|
5
|
-
Simple gem for communicating with external API. Heavily inspired by stripe gem.
|
5
|
+
Simple ruby gem for communicating with external API. Heavily inspired by stripe gem.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
9
|
Add this line to your application's Gemfile:
|
10
10
|
|
11
|
-
gem 'logcamp
|
11
|
+
gem 'logcamp'
|
12
12
|
|
13
13
|
And then execute:
|
14
14
|
|
@@ -16,19 +16,21 @@ And then execute:
|
|
16
16
|
|
17
17
|
Or install it yourself as:
|
18
18
|
|
19
|
-
$ gem install logcamp
|
19
|
+
$ gem install logcamp
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
|
23
|
+
1) Sign up and create an app.
|
24
24
|
|
25
|
-
|
25
|
+
In your project, initialize your app.
|
26
|
+
|
27
|
+
2) Set token
|
26
28
|
|
27
29
|
```ruby
|
28
30
|
Logcamp.token = ENV['LOGCAMP_TOKEN']
|
29
31
|
```
|
30
32
|
|
31
|
-
|
33
|
+
3) Send event
|
32
34
|
|
33
35
|
```ruby
|
34
36
|
Logcamp::Event.create(
|
@@ -44,7 +46,6 @@ Logcamp::Event.create(
|
|
44
46
|
|
45
47
|
**For Sinatra app** you may need to add `require 'bundler/setup'`
|
46
48
|
|
47
|
-
|
48
49
|
## Tests
|
49
50
|
|
50
51
|
```ruby
|
data/lib/logcamp.rb
CHANGED
@@ -26,7 +26,7 @@ require "logcamp/errors/invalid_metadata_error"
|
|
26
26
|
require "logcamp/errors/authentication_error"
|
27
27
|
|
28
28
|
module Logcamp
|
29
|
-
@api_base = "https://
|
29
|
+
@api_base = "https://log.camp/api"
|
30
30
|
|
31
31
|
class << self
|
32
32
|
attr_accessor :token, :api_base, :verify_ssl_certs, :api_version
|
data/lib/logcamp/version.rb
CHANGED
data/test/logcamp/event_test.rb
CHANGED
@@ -1,20 +1,21 @@
|
|
1
1
|
require File.expand_path("../../test_helper", __FILE__)
|
2
2
|
|
3
3
|
module Logcamp
|
4
|
-
class EventTest < Test
|
5
|
-
should
|
4
|
+
class EventTest < Minitest::Test
|
5
|
+
should 'create should return status 200' do
|
6
|
+
Logcamp.token = '111'
|
6
7
|
response = Logcamp::Event.create(status: 'success', message: 'Event occured',
|
7
|
-
alert:
|
8
|
+
alert: false,
|
8
9
|
metadata: { date: Time.now })
|
9
|
-
assert_equal
|
10
|
+
assert_equal '200', response.code
|
10
11
|
end
|
11
12
|
|
12
|
-
should
|
13
|
+
should 'raise Logcamp::AuthenticationError if no token provided' do
|
13
14
|
Logcamp.token = nil
|
14
15
|
assert_raises(Logcamp::AuthenticationError) { Logcamp::Event.create }
|
15
16
|
end
|
16
17
|
|
17
|
-
should
|
18
|
+
should 'raise Logcamp::InvalidRequestError if not enough parameters' do
|
18
19
|
begin
|
19
20
|
rescue JSON::ParserError
|
20
21
|
assert_raises(Logcamp::InvalidRequestError) { Logcamp::Event.create }
|
data/test/test_helper.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'logcamp'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'minitest/autorun'
|
4
|
+
require 'minitest/pride'
|
5
|
+
require 'shoulda'
|
4
6
|
|
5
|
-
class
|
6
|
-
|
7
|
-
setup do
|
7
|
+
class Setup
|
8
|
+
def setup
|
8
9
|
Logcamp.token = "111"
|
9
10
|
end
|
10
11
|
|
11
|
-
teardown
|
12
|
+
def teardown
|
12
13
|
Logcamp.token = nil
|
13
14
|
end
|
14
15
|
end
|
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logcamp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Olivier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.6'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: json
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 1.8.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.8.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: shoulda
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 3.4.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 3.4.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: test-unit
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 3.0.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 3.0.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: minitest
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 5.4.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 5.4.0
|
97
97
|
description: Aggregate app notifications in one place. Search events and share access
|
@@ -126,17 +126,17 @@ require_paths:
|
|
126
126
|
- lib
|
127
127
|
required_ruby_version: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
133
|
requirements:
|
134
|
-
- -
|
134
|
+
- - ">="
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
138
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.4.
|
139
|
+
rubygems_version: 2.4.4
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Gem to send app-generated event notifications to logcamp master application
|