telemetry 1.2.9 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0adfb853a8c5a7ee7168775d61da216bc604efc
4
- data.tar.gz: 6921fbedf6141e840f2f4a7e169c2d78f1d5d70c
3
+ metadata.gz: 6c98e75fc39aa3ebcae9ed124b8b2b3366e4adea
4
+ data.tar.gz: 53c03dc0d606009ccb7fe941fdf611360ffec775
5
5
  SHA512:
6
- metadata.gz: 9ecd01f584da3a07349fc8bdd816b2a920348b93a739c785654302c6ca75ff8cda44de3c4b704e366dfd06699a3b1a55b6fa4cc3bac453167bffba24b27aacd3
7
- data.tar.gz: ec2ae564ba372158673a2cc233db3f25af521c3e992163c1c8449477d759987b493d1802bb1848064da21bf49f8c6037353e85fdc9bad92f0975a094f9a46c10
6
+ metadata.gz: 36d91f5cf6c7237ee8852760c47cbba36b01368cb90d54053dfebb55d79dee9134369e41853f6104bc9a4a12cb7a8ef75fdb426b8a593b9a92cc3565cf6e22b4
7
+ data.tar.gz: 1e3babe9a3570158646e3687deafe68ffab9825af11c9b07efa54d62ae5220e9f5562412c0893483b18f3589f26e109f0ab4884761186e763da70bdc6cfefd79
data/README.md CHANGED
@@ -24,27 +24,59 @@ Where __path__ is the path for the resource (for instance "/boards/:board_id") a
24
24
  require 'telemetry'
25
25
 
26
26
  Telemetry.token = $YOUR_API_TOKEN
27
-
28
27
  @board = Telemetry::Api.get("/boards/#{@board_id}")
29
28
 
30
-
31
- ## Sending Data To Flows
29
+ ## Sending Data To a Flow
32
30
 
33
31
  To use this gem you must require it in your file and specify your API Token that you can find on the [Telemetry API Token page](https://www.telemetryapp.com/account/api_token)
34
32
 
35
- Set a hash of values for the flow to update. Each hash must contain the tag of the flow that you want to update.
33
+ Create a new flow object of the variant that you want to use. Use its emit method to send the data to Telemetry.
36
34
 
37
35
  require 'telemetry'
38
36
 
39
37
  Telemetry.token = "test-api-token"
38
+ gauge = Telemetry::Gauge.new(tag: "test-flow-gauge", value: 3434)
39
+ gauge.emit
40
+
41
+ Supported flow object variants are as follows:
42
+
43
+ - Telemetry::Barchart
44
+ - Telemetry::Bulletchart
45
+ - Telemetry::Countdown
46
+ - Telemetry::Gauge
47
+ - Telemetry::Graph
48
+ - Telemetry::Grid
49
+ - Telemetry::Icon
50
+ - Telemetry::Image
51
+ - Telemetry::Log
52
+ - Telemetry::Multigauge
53
+ - Telemetry::Multivalue
54
+ - Telemetry::Piechart
55
+ - Telemetry::Scatterplot
56
+ - Telemetry::Servers
57
+ - Telemetry::Status
58
+ - Telemetry::Table
59
+ - Telemetry::Text
60
+ - Telemetry::Tickertape
61
+ - Telemetry::Timechart
62
+ - Telemetry::Timeline
63
+ - Telemetry::Upstatus
64
+ - Telemetry::Value
65
+ - Telemetry::Waterfall
66
+
67
+ For documentation on the different properties for the various data elements please see the [data documentation](https://www.telemetryapp.com/user/documentation/data) pages.
68
+
69
+ ## Batch Updating Multiple Flows at Once
70
+
71
+ You may send data to more than one flow in a single API call. To do this construct an array of flows and use the Telemetry::Api.flow_update_batch(flows) method. A code example follows:
40
72
 
41
- properties = {
42
- tag: "test-flow-value",
43
- value: 3434
44
- }
45
- Telemetry::Value.new(properties).emit
73
+ require 'telemetry'
46
74
 
47
- For documentation on flows and the properties they support please see the [flow documentation](https://www.telemetryapp.com/documentation/flows) pages.
75
+ Telemetry.token = "test-api-token"
76
+ flows = []
77
+ flows << Telemetry::Value.new({tag: "test-flow-value", value: 3432})
78
+ flows << Telemetry::Gauge.new({tag: "test-flow-gauge", value: 33})
79
+ Telemetry::Api.flow_update_batch(flows)
48
80
 
49
81
  ## Data Encryption
50
82
 
@@ -54,14 +86,9 @@ While Telemetry is SSL based and we protect our customers data with utmost cauti
54
86
 
55
87
  Telemetry.token = "test-api-token"
56
88
  ENCRYPTIONKEY = "Unique Random Password"
57
-
58
- properties = {
59
- tag: "test-flow-value",
60
- value: 3434
61
- }
62
- value = Telemetry::Value.new(properties)
63
- value.encrypt(ENCRYPTIONKEY)
64
- value.emit
89
+ flow = Telemetry::Value.new(tag: "test-flow-value", value: 3434)
90
+ flow.encrypt(ENCRYPTIONKEY)
91
+ flow.emit
65
92
 
66
93
  Please be careful that your data isn't able to be validated by the Telemetry API since it cannot see it. Therefore we suggest testing with dummy uncrypted data first. Additionally there will be performance implications for large amounts of changing data for some browsers.
67
94
 
@@ -71,26 +98,39 @@ In order to view encrypted data in your browser you will need to append the key
71
98
 
72
99
  Note that the # part will not be sent to the server, it's a local argument only visible to the local javascript running in the browser. Certain attributes like tags and priority will not be encrypted as they're needed by the system.
73
100
 
101
+ ## Virtual Channels
74
102
 
75
- ## Affiliates
103
+ This gem supports virtual channel sending. You must have a pro or higher account to use virtual channels. In order to use this you must call:
76
104
 
77
- This gem supports affiliate data sending. In order to use this capability call the Telemetry::Api.affiliate_send(unique-identifier, flows) method. You must have an enterprise account and get support to enable your account for affiliates first.
105
+ - Telemetry::Api.channel_send(unique-identifier, flow)
106
+ - Telemetry::Api.channel_send_batch(unique-identifier, flows)
107
+
108
+ An example of code to do this would be:
78
109
 
79
110
  require 'telemetry'
80
111
 
81
112
  Telemetry.token = "test-api-token"
113
+ flow = Telemetry::Value.new(tag: "test-flow-value", value: 3434)
114
+ Telemetry::Api.channel_send("channel-tag", flow)
82
115
 
83
- # Construct a hash with the flow tags as keys and the values as the hash to use to update the data
84
- flows = {
85
- value_tag: {
86
- value: 435
87
- }
88
- }
116
+ For more information see the [virtual channel documentation](https://www.telemetryapp.com/user/documentation/virtual_channels).
89
117
 
90
- # Send to the unique identifier for the affiliate as created by you on the affiliate page
91
- Telemetry::Api.affiliate_send("unique-identifier", flows)
118
+ ## Affiliates
119
+
120
+ This gem supports affiliate data sending. You must have an enterprise account and get support to enable your account for affiliates first. In order to use this capability call either:
121
+
122
+ - Telemetry::Api.affiliate_send(affiliate-identifier, flow)
123
+ - Telemetry::Api.affiliate_send_batch(affiliate-identifier, flows)
124
+
125
+ An example of code to do this would be:
126
+
127
+ require 'telemetry'
128
+
129
+ Telemetry.token = "test-api-token"
130
+ flow = Telemetry::Value.new(tag: "test-flow-value", value: 3434)
131
+ Telemetry::Api.affiliate_send("affiliate-identifier", flow)
92
132
 
93
- For more information see the [affiliate documentation](https://admin.telemetryapp.com/documentation/affiliate).
133
+ For more information see the [affiliate documentation](https://admin.telemetryapp.com/documentation/affiliates).
94
134
 
95
135
  ## Daemon
96
136
 
data/lib/telemetry/api.rb CHANGED
@@ -85,10 +85,47 @@ module Telemetry
85
85
  Telemetry::Api.send(:delete, "/flows/#{id}/data")
86
86
  end
87
87
 
88
- def self.affiliate_send(affiliate_identifier, data)
88
+ def self.channel_send_batch(channel_tag, flows)
89
89
  raise Telemetry::AuthenticationFailed, "Please set your Telemetry.token" unless Telemetry.token
90
- raise RuntimeError, "Must supply data to send" unless data
90
+ raise RuntimeError, "Must supply flows to send" unless flows
91
+ raise RuntimeError, "Must supply a channel_tag" unless channel_tag
92
+ data = {}
93
+ flows.each do |flow|
94
+ values = flow.to_hash
95
+ tag = values.delete('tag')
96
+ data[tag] = values
97
+ end
98
+ return Telemetry::Api.send(:post, "/channels/#{channel_tag}/data", {:data => data})
99
+ end
100
+
101
+ def self.channel_send(channel_tag, flow)
102
+ raise Telemetry::AuthenticationFailed, "Please set your Telemetry.token" unless Telemetry.token
103
+ raise RuntimeError, "Must supply flow to send" unless flow
104
+ raise RuntimeError, "Must supply a channel_tag" unless channel_tag
105
+ values = flow.to_hash
106
+ tag = values.delete('tag')
107
+ return Telemetry::Api.send(:put, "/channels/#{channel_tag}/flows/#{tag}/data", values)
108
+ end
109
+
110
+ def self.affiliate_send(affiliate_identifier, flow)
111
+ raise Telemetry::AuthenticationFailed, "Please set your Telemetry.token" unless Telemetry.token
112
+ raise RuntimeError, "Must supply flow to send" unless flow
113
+ raise RuntimeError, "Must supply a unique affiliate identifier" unless affiliate_identifier
114
+ values = flow.to_hash
115
+ tag = values.delete('tag')
116
+ return Telemetry::Api.send(:post, "/affiliates/#{affiliate_identifier}/flows/#{tag}/data", values)
117
+ end
118
+
119
+ def self.affiliate_send_batch(affiliate_identifier, flows)
120
+ raise Telemetry::AuthenticationFailed, "Please set your Telemetry.token" unless Telemetry.token
121
+ raise RuntimeError, "Must supply flows to send" unless flows
91
122
  raise RuntimeError, "Must supply a unique affiliate identifier" unless affiliate_identifier
123
+ data = {}
124
+ flows.each do |flow|
125
+ values = flow.to_hash
126
+ tag = values.delete('tag')
127
+ data[tag] = values
128
+ end
92
129
  return Telemetry::Api.send(:post, "/affiliates/#{affiliate_identifier}/data", {:data => data})
93
130
  end
94
131
 
@@ -114,7 +114,6 @@ module Telemetry
114
114
  property :icon
115
115
  property :link
116
116
  property :renderer
117
- property :baseline
118
117
  property :series, :default => []
119
118
  property :min_scale
120
119
  property :unstack
@@ -311,6 +310,7 @@ module Telemetry
311
310
  property :icon
312
311
  property :link
313
312
  property :table, :default => []
313
+ property :values, :default => []
314
314
  property :headers, :default => []
315
315
  property :colors, :default => []
316
316
  end
@@ -1,3 +1,3 @@
1
1
  module Telemetry
2
- TELEMETRY_VERSION = "1.2.9"
2
+ TELEMETRY_VERSION = "1.3.0"
3
3
  end
data/spec/flows_spec.rb CHANGED
@@ -54,14 +54,6 @@ describe "Flows" do
54
54
  Telemetry::Icon.new(properties).emit
55
55
  end
56
56
 
57
- it "should update a Iframe" do
58
- properties = {
59
- tag: "test-flow-iframe",
60
- url: "http://www.telemetryapp.com"
61
- }
62
- Telemetry::Iframe.new(properties).emit
63
- end
64
-
65
57
  it "should update a Log" do
66
58
  properties = {
67
59
  tag: "test-flow-log",
@@ -70,14 +62,6 @@ describe "Flows" do
70
62
  Telemetry::Log.new(properties).emit
71
63
  end
72
64
 
73
- it "should update a Map" do
74
- properties = {
75
- tag: "test-flow-map",
76
- map_type: "asia",
77
- points: [[34.344,129.344],[55.233,121.233]]
78
- }
79
- Telemetry::Map.new(properties).emit
80
- end
81
65
 
82
66
  it "should update a Multigauge" do
83
67
  properties = {
@@ -98,7 +82,7 @@ describe "Flows" do
98
82
  it "should update a Servers" do
99
83
  properties = {
100
84
  tag: "test-flow-servers",
101
- servers: [{values: [33,22,55], title: "Alpha"}]
85
+ servers: [{values: [33,22,55], name: "Alpha"}]
102
86
  }
103
87
  Telemetry::Servers.new(properties).emit
104
88
  end
@@ -135,15 +119,6 @@ describe "Flows" do
135
119
  Telemetry::Tickertape.new(properties).emit
136
120
  end
137
121
 
138
- it "should update a Timechart" do
139
- properties = {
140
- tag: "test-flow-timechart",
141
- type: "week",
142
- values: [34,123,76,43,45,16,48]
143
- }
144
- Telemetry::Timechart.new(properties).emit
145
- end
146
-
147
122
  it "should update a Timeline" do
148
123
  properties = {
149
124
  tag: "test-flow-timeline",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telemetry
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.9
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - W. Gersham Meharg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-07 00:00:00.000000000 Z
11
+ date: 2014-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj
@@ -143,8 +143,6 @@ files:
143
143
  - lib/telemetry/daemon_config_parser.rb
144
144
  - lib/telemetry/flows.rb
145
145
  - lib/telemetry/version.rb
146
- - spec/batch_spec.rb
147
- - spec/daemon_spec.rb
148
146
  - spec/flows_spec.rb
149
147
  - spec/spec_helper.rb
150
148
  - telemetry.gemspec
@@ -173,8 +171,6 @@ signing_key:
173
171
  specification_version: 4
174
172
  summary: Telemetry Data Submission API Gem
175
173
  test_files:
176
- - spec/batch_spec.rb
177
- - spec/daemon_spec.rb
178
174
  - spec/flows_spec.rb
179
175
  - spec/spec_helper.rb
180
176
  has_rdoc:
data/spec/batch_spec.rb DELETED
@@ -1,35 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Batch" do
4
- before(:all) do
5
- Telemetry.token = "test-api-token"
6
- end
7
-
8
- it "should perform a batch update" do
9
-
10
- flows = []
11
-
12
- barchart_properties = {
13
- tag: "test-flow-barchart",
14
- bars: [{value:1000, label:'test', color:'red'}]
15
- }
16
- flows << Telemetry::Barchart.new(barchart_properties)
17
-
18
- gauge_properties = {
19
- tag: "test-flow-gauge",
20
- value: 3434
21
- }
22
- flows << Telemetry::Gauge.new(gauge_properties)
23
-
24
- value_properties = {
25
- tag: "test-flow-value",
26
- value: 3434
27
- }
28
- flows << Telemetry::Value.new(value_properties)
29
-
30
- result = Telemetry::Api.flow_update_batch(flows)
31
-
32
- result["skipped"].should eql([])
33
- result["errors"].should eql([])
34
- end
35
- end
data/spec/daemon_spec.rb DELETED
@@ -1,12 +0,0 @@
1
- require 'spec_helper'
2
- require_relative "../lib/telemetry/daemon_config_parser"
3
-
4
- describe "Daemon" do
5
- before(:all) do
6
- Telemetry.token = "test-api-token"
7
- end
8
-
9
- it "should run the daemon" do
10
- `bin/telemetryd -c telemetryd_config.rb -o`
11
- end
12
- end