logpusher 0.1.0
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 +7 -0
- data/.gitignore +6 -0
- data/.travis.yml +1 -0
- data/Gemfile +7 -0
- data/LICENSE +21 -0
- data/README.md +55 -0
- data/lib/logpusher.rb +34 -0
- data/lib/logpusher/authkey.rb +26 -0
- data/lib/logpusher/constants.rb +5 -0
- data/lib/logpusher/email.rb +22 -0
- data/lib/logpusher/version.rb +3 -0
- data/logpusher.gemspec +21 -0
- metadata +69 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 33bf55492233ab367a6a5fc9db6ed464be6c87b5
|
|
4
|
+
data.tar.gz: 2fa9dce42478e59dbe1bf7c3925843a6559518c5
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: a246fe81b2b64ef5091ca0839a4c0010916a57a586e02ab4a21d27afa86eefe4c70591557a32d2691b19a3f446a8456ad4de32d79b00eb1d26fd352ea74dc64c
|
|
7
|
+
data.tar.gz: 5846e23397616ac897cd13daed0a88dd73a90dcef5feb0bf14ffebec847b154093c8980582efe468097d8c8ee26e1c31ded6fea52112cbf350d49bc355f72772
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
language: ruby
|
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 İzni Burak Demirtaş
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# LogPusher: Log tracking for Ruby
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.org/LogPusher/logpusher-ruby)
|
|
4
|
+
|
|
5
|
+
LogPusher is a system that allows you to receive notifications through your mobile on a single application. Apart from push notifications, you can also receive information without a mobile client via SMS and Mail service. You can integrate with any software through the API. Thanks to rapid API integration, you do not spend extra time for information and mail service.
|
|
6
|
+
|
|
7
|
+
LogPusher is easy to use on the client side thanks to its simple interface. Just generate API key trough our control panel and you are ready to go.
|
|
8
|
+
|
|
9
|
+
## Getting started
|
|
10
|
+
|
|
11
|
+
1. [Create a LogPusher account](http://logpusher.com/)
|
|
12
|
+
2. Create a new App and get API Token
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
gem install logpusher
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```ruby
|
|
23
|
+
require "logpusher"
|
|
24
|
+
|
|
25
|
+
client = LogPusher::Client.new("hello@logpusher.com", "PASSWORD", "API_KEY")
|
|
26
|
+
|
|
27
|
+
response = client.push(
|
|
28
|
+
"My awesome log message",
|
|
29
|
+
"myawesomesite.com",
|
|
30
|
+
"E-commerce",
|
|
31
|
+
"Notice",
|
|
32
|
+
Time.now.strftime("%H:%M"),
|
|
33
|
+
Time.now,
|
|
34
|
+
"1"
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
puts response.body
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Support
|
|
41
|
+
|
|
42
|
+
* [Search open and closed issues](https://github.com/LogPusher/logpusher-ruby/issues?utf8=✓&q=is%3Aissue) for similar problems
|
|
43
|
+
* [Report a bug or request a feature](https://github.com/LogPusher/logpusher-ruby/issues/new)
|
|
44
|
+
|
|
45
|
+
## Contributing
|
|
46
|
+
|
|
47
|
+
1. Fork it ( https://github.com/LogPusher/logpusher-ruby/fork )
|
|
48
|
+
2. Create your feature branch (git checkout -b my-new-feature)
|
|
49
|
+
3. Commit your changes (git commit -am 'Add some feature')
|
|
50
|
+
4. Push to the branch (git push origin my-new-feature)
|
|
51
|
+
5. Create a new Pull Request
|
|
52
|
+
|
|
53
|
+
## Contributors
|
|
54
|
+
|
|
55
|
+
- [izniburak](https://github.com/izniburak) İzni Burak Demirtaş - creator
|
data/lib/logpusher.rb
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
$LOAD_PATH << File.dirname(__FILE__)
|
|
2
|
+
|
|
3
|
+
require "logpusher/version"
|
|
4
|
+
require "logpusher/constants"
|
|
5
|
+
require "logpusher/authkey"
|
|
6
|
+
require "logpusher/email"
|
|
7
|
+
require "net/http"
|
|
8
|
+
require "uri"
|
|
9
|
+
|
|
10
|
+
module LogPusher
|
|
11
|
+
class Client
|
|
12
|
+
def initialize(email, password, api_key)
|
|
13
|
+
@auth_key = AuthKey.new(Email.new(email), password)
|
|
14
|
+
@api_key = api_key
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def push(
|
|
18
|
+
log_message = "", source = "", category = "", log_type = "", log_time = "",
|
|
19
|
+
created_date = Time.now, event_id = "")
|
|
20
|
+
response = Net::HTTP.post_form URI(API_URL), {
|
|
21
|
+
"AuthKey" => @auth_key.get_auth_key,
|
|
22
|
+
"ApiKey" => @api_key,
|
|
23
|
+
"LogMessage" => log_message,
|
|
24
|
+
"Source" => source,
|
|
25
|
+
"Category" => category,
|
|
26
|
+
"LogType" => log_type,
|
|
27
|
+
"LogTime" => log_time,
|
|
28
|
+
"CreatedDate" => created_date.strftime(DATE_FORMAT),
|
|
29
|
+
"EventId" => event_id
|
|
30
|
+
}
|
|
31
|
+
response
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require "base64"
|
|
2
|
+
require "digest"
|
|
3
|
+
|
|
4
|
+
module LogPusher
|
|
5
|
+
class AuthKey
|
|
6
|
+
@email = nil
|
|
7
|
+
@hashed_password = nil
|
|
8
|
+
|
|
9
|
+
def initialize(email, password)
|
|
10
|
+
raise "The type of email parameter must consist of the Email object." unless email.is_a?(Email)
|
|
11
|
+
@email = email.get
|
|
12
|
+
@hashed_password = Digest::MD5.hexdigest password
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def get_auth_key
|
|
16
|
+
auth_key = create_auth_key_string
|
|
17
|
+
Base64.strict_encode64 auth_key
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
def create_auth_key_string
|
|
23
|
+
"#{@email}#{SEPERATOR}#{@hashed_password}#{SEPERATOR}#{Time.now.strftime(DATE_FORMAT)}"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module LogPusher
|
|
2
|
+
class Email
|
|
3
|
+
@email = nil
|
|
4
|
+
|
|
5
|
+
def initialize(email)
|
|
6
|
+
ensure_is_valid_email(email)
|
|
7
|
+
@email = email
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def get
|
|
11
|
+
@email
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def ensure_is_valid_email(email)
|
|
17
|
+
control = email.match(/^[_]*([a-z0-9]+(\.|_*)?)+@([a-z][a-z0-9-]+(\.|-*\.))+[a-z]{2,6}$/)
|
|
18
|
+
raise "#{email} is not a valid email address." if control.nil?
|
|
19
|
+
true
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
data/logpusher.gemspec
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'logpusher/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |s|
|
|
7
|
+
s.name = 'logpusher'
|
|
8
|
+
s.version = LogPusher::VERSION
|
|
9
|
+
s.date = '2017-09-15'
|
|
10
|
+
s.summary = 'LogPusher: Log tracking for Ruby'
|
|
11
|
+
s.description = 'LogPusher: Log tracking for Ruby'
|
|
12
|
+
s.authors = ['İzni Burak Demirtaş']
|
|
13
|
+
s.email = ['info@burakdemirtas.org']
|
|
14
|
+
s.homepage = 'https://github.com/LogPusher/logpusher-ruby'
|
|
15
|
+
s.license = 'MIT'
|
|
16
|
+
|
|
17
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec)/}) }
|
|
18
|
+
s.require_paths = ['lib']
|
|
19
|
+
|
|
20
|
+
s.add_development_dependency 'rspec'
|
|
21
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: logpusher
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- İzni Burak Demirtaş
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2017-09-15 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rspec
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
description: 'LogPusher: Log tracking for Ruby'
|
|
28
|
+
email:
|
|
29
|
+
- info@burakdemirtas.org
|
|
30
|
+
executables: []
|
|
31
|
+
extensions: []
|
|
32
|
+
extra_rdoc_files: []
|
|
33
|
+
files:
|
|
34
|
+
- ".gitignore"
|
|
35
|
+
- ".travis.yml"
|
|
36
|
+
- Gemfile
|
|
37
|
+
- LICENSE
|
|
38
|
+
- README.md
|
|
39
|
+
- lib/logpusher.rb
|
|
40
|
+
- lib/logpusher/authkey.rb
|
|
41
|
+
- lib/logpusher/constants.rb
|
|
42
|
+
- lib/logpusher/email.rb
|
|
43
|
+
- lib/logpusher/version.rb
|
|
44
|
+
- logpusher.gemspec
|
|
45
|
+
homepage: https://github.com/LogPusher/logpusher-ruby
|
|
46
|
+
licenses:
|
|
47
|
+
- MIT
|
|
48
|
+
metadata: {}
|
|
49
|
+
post_install_message:
|
|
50
|
+
rdoc_options: []
|
|
51
|
+
require_paths:
|
|
52
|
+
- lib
|
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
|
+
requirements:
|
|
55
|
+
- - ">="
|
|
56
|
+
- !ruby/object:Gem::Version
|
|
57
|
+
version: '0'
|
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
|
+
requirements:
|
|
60
|
+
- - ">="
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: '0'
|
|
63
|
+
requirements: []
|
|
64
|
+
rubyforge_project:
|
|
65
|
+
rubygems_version: 2.6.13
|
|
66
|
+
signing_key:
|
|
67
|
+
specification_version: 4
|
|
68
|
+
summary: 'LogPusher: Log tracking for Ruby'
|
|
69
|
+
test_files: []
|