beatr 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/beatr.rb +17 -4
- data/lib/beatr/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8474368a1d4223777896fcc0c8e2e6b9daac0e99
|
4
|
+
data.tar.gz: cafc88372006b5de425ad68ac2505deee4a0dde5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bdbe45509477e17882f0cb25be991e602edd86303325dc16eb612fe7f4a8defa763e574a4444fac74276b55a5feb64fb6df408fb2f18f4327bd0729022770d7
|
7
|
+
data.tar.gz: 1f4918b08946d0f7d430bb702501fbad82da7224f9d78b1c48364bcd6d54fcb934ea04173aac91d8d8fad2b35f7b8c219fd22820cbe7d3e5341898fff47c8d34
|
data/lib/beatr.rb
CHANGED
@@ -2,6 +2,7 @@ require 'beatr/version'
|
|
2
2
|
|
3
3
|
module Beatr
|
4
4
|
require 'net/http'
|
5
|
+
require 'json'
|
5
6
|
|
6
7
|
def self.configure
|
7
8
|
yield config
|
@@ -12,13 +13,21 @@ module Beatr
|
|
12
13
|
@@config ||= Config.new
|
13
14
|
end
|
14
15
|
|
15
|
-
def self.beat name
|
16
|
+
def self.beat name
|
16
17
|
raise ArgumentError, 'please supply a beat name' if name.nil? || name == ''
|
18
|
+
raise 'Please configure with an api key' if config.api_key.nil?
|
17
19
|
|
18
|
-
uri = URI.parse "#{config.host}
|
20
|
+
uri = URI.parse "#{config.host}#{config.endpoint}"
|
21
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
22
|
+
|
23
|
+
request = Net::HTTP::Post.new uri.request_uri
|
24
|
+
request.body = { 'beat' => name }.to_json
|
25
|
+
|
26
|
+
request['Content-Type'] = 'application/json'
|
27
|
+
request['X-API-KEY' ] = config.api_key
|
19
28
|
|
20
29
|
Thread.new do
|
21
|
-
|
30
|
+
http.request request
|
22
31
|
end
|
23
32
|
|
24
33
|
true
|
@@ -27,10 +36,11 @@ module Beatr
|
|
27
36
|
class Config
|
28
37
|
|
29
38
|
attr_accessor :name
|
39
|
+
attr_accessor :api_key
|
30
40
|
attr_reader :host
|
31
41
|
|
32
42
|
def initialize
|
33
|
-
@host = '
|
43
|
+
@host = 'https://pulse.crevalle.io'
|
34
44
|
end
|
35
45
|
|
36
46
|
def host= url
|
@@ -41,6 +51,9 @@ module Beatr
|
|
41
51
|
end
|
42
52
|
end
|
43
53
|
|
54
|
+
def endpoint
|
55
|
+
'/beats'
|
56
|
+
end
|
44
57
|
end
|
45
58
|
end
|
46
59
|
|
data/lib/beatr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beatr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Desmond Bowe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -73,9 +73,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
75
|
rubyforge_project:
|
76
|
-
rubygems_version: 2.
|
76
|
+
rubygems_version: 2.4.5.1
|
77
77
|
signing_key:
|
78
78
|
specification_version: 4
|
79
79
|
summary: Gem for hitting your beats.
|
80
80
|
test_files: []
|
81
|
-
has_rdoc:
|