restful_metrics 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +10 -6
- data/README.md +2 -0
- data/VERSION +1 -1
- data/lib/restful_metrics.rb +1 -2
- data/lib/restful_metrics/client.rb +2 -14
- data/lib/restful_metrics/endpoint.rb +2 -1
- data/spec/endpoint_spec.rb +28 -1
- metadata +42 -60
- data/.rvmrc +0 -1
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a87120f361df0b33c22f49d2a2706bfc5e4db523
|
4
|
+
data.tar.gz: dde139c1af427a6e76680bda29578cf3e8fdc0c4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 78ecbc502a47d8532acc9baa75681615745342760dd436fde052f904a1f5bb8a91240c3d392ccfb7569acbff062746c99f2c9b81678d09d9204c16763ab1072a
|
7
|
+
data.tar.gz: 49dc2a581bda4b66ca5e25c4063ad6d33bb109523833f4f0282f3f083dd5834864dfa21f9781f5fe9e23f0c6a9933c28c612314a10826add3e7b210167528d1b
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
restful_metrics (1.1.
|
4
|
+
restful_metrics (1.1.5)
|
5
5
|
rest-client (~> 1.6.0)
|
6
6
|
yajl-ruby (>= 0.8.1)
|
7
7
|
|
8
8
|
GEM
|
9
|
-
remote:
|
9
|
+
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
11
|
abstract (1.0.0)
|
12
12
|
actionpack (3.0.11)
|
@@ -31,8 +31,9 @@ GEM
|
|
31
31
|
erubis (2.6.6)
|
32
32
|
abstract (>= 1.0.0)
|
33
33
|
i18n (0.5.0)
|
34
|
+
json (1.8.2)
|
34
35
|
metaclass (0.0.1)
|
35
|
-
mime-types (1.
|
36
|
+
mime-types (1.25.1)
|
36
37
|
mocha (0.10.4)
|
37
38
|
metaclass (~> 0.0.1)
|
38
39
|
rack (1.2.5)
|
@@ -40,8 +41,11 @@ GEM
|
|
40
41
|
rack (>= 1.0.0)
|
41
42
|
rack-test (0.5.7)
|
42
43
|
rack (>= 1.0)
|
43
|
-
|
44
|
-
|
44
|
+
rdoc (4.2.0)
|
45
|
+
json (~> 1.4)
|
46
|
+
rest-client (1.6.8)
|
47
|
+
mime-types (~> 1.16)
|
48
|
+
rdoc (>= 2.4.2)
|
45
49
|
rspec (2.8.0)
|
46
50
|
rspec-core (~> 2.8.0)
|
47
51
|
rspec-expectations (~> 2.8.0)
|
@@ -51,7 +55,7 @@ GEM
|
|
51
55
|
diff-lcs (~> 1.1.2)
|
52
56
|
rspec-mocks (2.8.0)
|
53
57
|
tzinfo (0.3.31)
|
54
|
-
yajl-ruby (1.1
|
58
|
+
yajl-ruby (1.2.1)
|
55
59
|
|
56
60
|
PLATFORMS
|
57
61
|
ruby
|
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.5
|
data/lib/restful_metrics.rb
CHANGED
@@ -44,41 +44,29 @@ module RestfulMetrics
|
|
44
44
|
@@disabled
|
45
45
|
end
|
46
46
|
|
47
|
-
def add_metric(fqdn, name, value, distinct_id=
|
47
|
+
def add_metric(fqdn, name, value, distinct_id = nil)
|
48
48
|
params = Hash.new
|
49
49
|
params[:metric] = Hash.new
|
50
50
|
params[:metric][:fqdn] = fqdn
|
51
51
|
params[:metric][:name] = name
|
52
52
|
params[:metric][:value] = value
|
53
|
-
|
54
53
|
unless distinct_id.nil?
|
55
54
|
params[:metric][:distinct_id] = distinct_id
|
56
55
|
end
|
57
56
|
|
58
|
-
unless timestamp.nil?
|
59
|
-
raise InvalidTimestamp unless timestamp.respond_to?(:to_i)
|
60
|
-
params[:metric][:occurred_at] = timestamp.to_i
|
61
|
-
end
|
62
|
-
|
63
57
|
post(Endpoint.metrics, params)
|
64
58
|
end
|
65
59
|
|
66
|
-
def add_compound_metric(fqdn, name, values, distinct_id=
|
60
|
+
def add_compound_metric(fqdn, name, values, distinct_id = nil)
|
67
61
|
params = Hash.new
|
68
62
|
params[:compound_metric] = Hash.new
|
69
63
|
params[:compound_metric][:fqdn] = fqdn
|
70
64
|
params[:compound_metric][:name] = name
|
71
65
|
params[:compound_metric][:values] = values
|
72
|
-
|
73
66
|
unless distinct_id.nil?
|
74
67
|
params[:compound_metric][:distinct_id] = distinct_id
|
75
68
|
end
|
76
69
|
|
77
|
-
unless timestamp.nil?
|
78
|
-
raise InvalidTimestamp unless timestamp.respond_to?(:to_i)
|
79
|
-
params[:compound_metric][:occurred_at] = timestamp.to_i
|
80
|
-
end
|
81
|
-
|
82
70
|
post(Endpoint.compound_metrics, params)
|
83
71
|
end
|
84
72
|
|
data/spec/endpoint_spec.rb
CHANGED
@@ -9,5 +9,32 @@ describe "Endpoint generation" do
|
|
9
9
|
it "should generate endpoints for compound metrics" do
|
10
10
|
RestfulMetrics::Endpoint.compound_metrics.should =~ /compound_metrics.json/
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
|
+
|
14
|
+
describe '#endpoint_url' do
|
15
|
+
let(:endpoint_url) { RestfulMetrics::Endpoint.endpoint_url('') }
|
16
|
+
|
17
|
+
it 'generates URLs for track.restfulmetrics.com' do
|
18
|
+
endpoint_url.should include 'track.restfulmetrics.com'
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'when the RESTFUL_METRICS_REALM environment variable is set' do
|
22
|
+
let(:realm) { 'track.example.com' }
|
23
|
+
|
24
|
+
before do
|
25
|
+
@original_env = ENV.to_hash
|
26
|
+
ENV['RESTFUL_METRICS_REALM'] = 'https://track.example.com'
|
27
|
+
end
|
28
|
+
|
29
|
+
after do
|
30
|
+
ENV.replace(@original_env)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'generates URLs for the given realm' do
|
34
|
+
endpoint_url.should include realm
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
13
40
|
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restful_metrics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Mauricio Gomes
|
@@ -10,136 +9,120 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2015-02-11 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
|
-
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
16
|
requirements:
|
20
|
-
- -
|
17
|
+
- - '>='
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: 0.8.1
|
23
20
|
type: :runtime
|
24
|
-
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
21
|
+
requirement: !ruby/object:Gem::Requirement
|
27
22
|
requirements:
|
28
|
-
- -
|
23
|
+
- - '>='
|
29
24
|
- !ruby/object:Gem::Version
|
30
25
|
version: 0.8.1
|
26
|
+
prerelease: false
|
27
|
+
name: yajl-ruby
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
|
-
|
33
|
-
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
35
30
|
requirements:
|
36
31
|
- - ~>
|
37
32
|
- !ruby/object:Gem::Version
|
38
33
|
version: 1.6.0
|
39
34
|
type: :runtime
|
40
|
-
|
41
|
-
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
43
36
|
requirements:
|
44
37
|
- - ~>
|
45
38
|
- !ruby/object:Gem::Version
|
46
39
|
version: 1.6.0
|
40
|
+
prerelease: false
|
41
|
+
name: rest-client
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
|
-
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
44
|
requirements:
|
52
45
|
- - ~>
|
53
46
|
- !ruby/object:Gem::Version
|
54
47
|
version: 2.8.0
|
55
48
|
type: :development
|
56
|
-
|
57
|
-
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
59
50
|
requirements:
|
60
51
|
- - ~>
|
61
52
|
- !ruby/object:Gem::Version
|
62
53
|
version: 2.8.0
|
54
|
+
prerelease: false
|
55
|
+
name: rspec
|
63
56
|
- !ruby/object:Gem::Dependency
|
64
|
-
|
65
|
-
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
58
|
requirements:
|
68
59
|
- - ~>
|
69
60
|
- !ruby/object:Gem::Version
|
70
61
|
version: 0.10.4
|
71
62
|
type: :development
|
72
|
-
|
73
|
-
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
75
64
|
requirements:
|
76
65
|
- - ~>
|
77
66
|
- !ruby/object:Gem::Version
|
78
67
|
version: 0.10.4
|
68
|
+
prerelease: false
|
69
|
+
name: mocha
|
79
70
|
- !ruby/object:Gem::Dependency
|
80
|
-
|
81
|
-
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
83
72
|
requirements:
|
84
73
|
- - ~>
|
85
74
|
- !ruby/object:Gem::Version
|
86
75
|
version: 3.0.0
|
87
76
|
type: :development
|
88
|
-
|
89
|
-
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
91
78
|
requirements:
|
92
79
|
- - ~>
|
93
80
|
- !ruby/object:Gem::Version
|
94
81
|
version: 3.0.0
|
82
|
+
prerelease: false
|
83
|
+
name: actionpack
|
95
84
|
- !ruby/object:Gem::Dependency
|
96
|
-
|
97
|
-
requirement: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
86
|
requirements:
|
100
87
|
- - ~>
|
101
88
|
- !ruby/object:Gem::Version
|
102
89
|
version: 1.2.5
|
103
90
|
type: :development
|
104
|
-
|
105
|
-
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
107
92
|
requirements:
|
108
93
|
- - ~>
|
109
94
|
- !ruby/object:Gem::Version
|
110
95
|
version: 1.2.5
|
96
|
+
prerelease: false
|
97
|
+
name: rack
|
111
98
|
- !ruby/object:Gem::Dependency
|
112
|
-
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
115
100
|
requirements:
|
116
101
|
- - ~>
|
117
102
|
- !ruby/object:Gem::Version
|
118
103
|
version: 3.0.0
|
119
104
|
type: :development
|
120
|
-
|
121
|
-
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
123
106
|
requirements:
|
124
107
|
- - ~>
|
125
108
|
- !ruby/object:Gem::Version
|
126
109
|
version: 3.0.0
|
110
|
+
prerelease: false
|
111
|
+
name: activesupport
|
127
112
|
- !ruby/object:Gem::Dependency
|
128
|
-
|
129
|
-
requirement: !ruby/object:Gem::Requirement
|
130
|
-
none: false
|
113
|
+
version_requirements: !ruby/object:Gem::Requirement
|
131
114
|
requirements:
|
132
115
|
- - ~>
|
133
116
|
- !ruby/object:Gem::Version
|
134
117
|
version: 3.0.1
|
135
118
|
type: :development
|
136
|
-
|
137
|
-
version_requirements: !ruby/object:Gem::Requirement
|
138
|
-
none: false
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
139
120
|
requirements:
|
140
121
|
- - ~>
|
141
122
|
- !ruby/object:Gem::Version
|
142
123
|
version: 3.0.1
|
124
|
+
prerelease: false
|
125
|
+
name: delayed_job
|
143
126
|
description: Ruby client for the RESTful Metrics service.
|
144
127
|
email: mauricio@restful-labs.com
|
145
128
|
executables: []
|
@@ -149,7 +132,6 @@ files:
|
|
149
132
|
- .document
|
150
133
|
- .gitignore
|
151
134
|
- .rspec
|
152
|
-
- .rvmrc
|
153
135
|
- Gemfile
|
154
136
|
- Gemfile.lock
|
155
137
|
- LICENSE
|
@@ -171,27 +153,26 @@ files:
|
|
171
153
|
- spec/spec_helper.rb
|
172
154
|
homepage: http://github.com/restful-labs/resetful_metrics-ruby
|
173
155
|
licenses: []
|
156
|
+
metadata: {}
|
174
157
|
post_install_message:
|
175
158
|
rdoc_options: []
|
176
159
|
require_paths:
|
177
160
|
- lib
|
178
161
|
required_ruby_version: !ruby/object:Gem::Requirement
|
179
|
-
none: false
|
180
162
|
requirements:
|
181
|
-
- -
|
163
|
+
- - '>='
|
182
164
|
- !ruby/object:Gem::Version
|
183
165
|
version: '0'
|
184
166
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
|
-
none: false
|
186
167
|
requirements:
|
187
|
-
- -
|
168
|
+
- - '>='
|
188
169
|
- !ruby/object:Gem::Version
|
189
170
|
version: '0'
|
190
171
|
requirements: []
|
191
172
|
rubyforge_project:
|
192
|
-
rubygems_version:
|
173
|
+
rubygems_version: 2.4.5
|
193
174
|
signing_key:
|
194
|
-
specification_version:
|
175
|
+
specification_version: 4
|
195
176
|
summary: Ruby client for the RESTful Metrics service.
|
196
177
|
test_files:
|
197
178
|
- spec/client_spec.rb
|
@@ -200,3 +181,4 @@ test_files:
|
|
200
181
|
- spec/delayed/serialization/mock.rb
|
201
182
|
- spec/endpoint_spec.rb
|
202
183
|
- spec/spec_helper.rb
|
184
|
+
has_rdoc:
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm --create use 1.9.3-p125@restful_metrics-ruby
|