dashing-contrib 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d7c4e4ad2170d67c910a352eddd02538f6a84e0b
4
- data.tar.gz: 5cfd6158e6e8be951ce1414419834ea2dfa5580e
3
+ metadata.gz: 37a8674ad3b2e5e50c9ab3b330df38b55e2feaca
4
+ data.tar.gz: 30504dd79ba7be3437f49cbf05459f7d85fbf6da
5
5
  SHA512:
6
- metadata.gz: 59e4833eeef48765bc87cdb45bcd312461901214938b0bf985c4e8292e650c2d739d2cd49f6e88fbfd61878c5f4fdcab37d128fb0dd07ad5ff487c582b6022dc
7
- data.tar.gz: c4ca13ab3bfc906460cc672c81c9f2d3e166886868697412991a77d508301e2a30e6ca346acd882fa36569e2b61a629824adf506dce806de73eecfded2f39c19
6
+ metadata.gz: 753c30b10a6ef1c14767e61af86f5101eda9ee749e6ce52bf50538cb546045645cea675c374178a225259b82ebc5aefec5aec40506c1dcb3afbebb84c2f4f359
7
+ data.tar.gz: 11967c410e35ad4634127115b6243b453dd772b5dbed6d1990e0a9490ed60a6616d1ca4509df22f73cd16956c79b10f62e0bc5bfccb3146d0a99f9b53a497213
data/README.md CHANGED
@@ -18,7 +18,7 @@ Read each individual widget documentation to use dashing-contrib built-in widget
18
18
  ## Installation
19
19
  Requires Ruby >= 1.9.3. Add this line to your Dashing's dashboard Gemfile:
20
20
 
21
- gem 'dashing-contrib', '~> 0.1.14'
21
+ gem 'dashing-contrib', '~> 0.2.1'
22
22
 
23
23
  Update dependencies:
24
24
 
@@ -37,7 +37,9 @@ module DashingContrib
37
37
  else
38
38
  request_url = "https://#{credentials.username}:#{credentials.password}@api.pingdom.com/api/2.0/checks/#{id}"
39
39
  end
40
- response = RestClient.get(request_url, { 'App-Key' => credentials.api_key })
40
+ headers = { 'App-Key' => credentials.api_key }
41
+ headers['Account-Email'] = credentials.team_account unless credentials.team_account.empty?
42
+ response = RestClient.get(request_url, headers)
41
43
  MultiJson.load response.body, { symbolize_keys: true }
42
44
  end
43
45
  end
@@ -3,13 +3,14 @@ require 'cgi'
3
3
  module DashingContrib
4
4
  module Pingdom
5
5
  class Credentials
6
- attr_accessor :api_key, :username, :password
6
+ attr_accessor :api_key, :username, :password, :team_account
7
7
 
8
8
  def initialize(options = {})
9
9
  user_options = default_options.merge(options)
10
10
  @api_key = user_options[:api_key] || missing_args(:api_key)
11
11
  @password = CGI.escape(user_options[:password]) || missing_args(:password)
12
12
  @username = CGI.escape(user_options[:username]) || missing_args(:username)
13
+ @team_account = user_options[:team_account]
13
14
  end
14
15
 
15
16
  private
@@ -17,7 +18,8 @@ module DashingContrib
17
18
  {
18
19
  api_key: '',
19
20
  password: '',
20
- username: ''
21
+ username: '',
22
+ team_account: ''
21
23
  }
22
24
  end
23
25
 
@@ -29,7 +29,9 @@ module DashingContrib
29
29
  private
30
30
  def make_request(credentials, id, from_time, to_time)
31
31
  request_url = uptime_request_url(credentials, id, from_time, to_time)
32
- response = RestClient.get(request_url, { 'App-Key' => credentials.api_key })
32
+ headers = { 'App-Key' => credentials.api_key }
33
+ headers['Account-Email'] = credentials.team_account unless credentials.team_account.empty?
34
+ response = RestClient.get(request_url, headers)
33
35
  MultiJson.load(response.body, { symbolize_keys: true })
34
36
  end
35
37
 
@@ -9,7 +9,8 @@ module DashingContrib
9
9
  client = DashingContrib::Pingdom::Client.new(
10
10
  username: options[:username],
11
11
  password: options[:password],
12
- api_key: options[:api_key]
12
+ api_key: options[:api_key],
13
+ team_account: options[:team_account]
13
14
  )
14
15
 
15
16
  status = client.summary()
@@ -9,7 +9,8 @@ module DashingContrib
9
9
  client = DashingContrib::Pingdom::Client.new(
10
10
  username: options[:username],
11
11
  password: options[:password],
12
- api_key: options[:api_key]
12
+ api_key: options[:api_key],
13
+ team_account: options[:team_account]
13
14
  )
14
15
 
15
16
  user_opt = self.default_date_ranges.merge(options)
@@ -1,3 +1,3 @@
1
1
  module DashingContrib
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dashing-contrib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jing Dong
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-18 00:00:00.000000000 Z
11
+ date: 2015-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv