uptrends_extended 0.7.0 → 0.7.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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjM1MTE1NWJkOGE5ZmI3N2U4N2FjNzFjNWUzYmMyNjFlMjQzZTQ4Nw==
4
+ MzQ4Y2E4MWQzMmY1MTZjMTNiNjU3OTM4NjkzZTYxY2YyOTlkYTgyZg==
5
5
  data.tar.gz: !binary |-
6
- ZDE4ZmZiNGEwMjMxMTU4NDdhNmE0ZDBiOTEzYjAzMjI3NDY3MjBlMA==
6
+ ZDc2YjY4ZGVlNmY1ZDU1MzJiNDU2ZGZiODllZjcxNTRjOTIwZGU2NQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTZmNjZkMGJmZTIxNDAxN2E5NzM3NDJjZDk3OGI2NzU3YTQ3ZTA0YzBiZDQy
10
- YjY0ZDM4ZWY2MGQxMTA5MTIxZWM0YjgyNTI2YmY4YWE3YzMwOGFhNjQ5Nzhi
11
- NGFjMThmYzkwYWRhZWY0MTIyNzJmZGFhZWI0NGNiMmYyNjRlNWY=
9
+ MzYyNDNjODUzZDczOGI4ZWMzNGYxOWZjODNhZTk3YWVmNGIwMGQzMmEwODYz
10
+ M2NjNzg1OTVkNmFiYjRlMjU3NTM4ZjE3Zjk1ZDNmYzhlMjRiNGIzZjJhMTcy
11
+ MjM1YmY1MGQwMGYzMTJiNTk0YTk3YjE0MmE4OTA5ODg0ODI0OTY=
12
12
  data.tar.gz: !binary |-
13
- ZTBiYTgwYjk0NGY1NmZhZGU0NzIzYjgzNThhN2IwNmE0NWU1ZDJjMzczZDEw
14
- YjFlZjhhN2M2NTJhZWQ0ODNmZjg4YzJkZDU1YmUxMWRmNDg1YzBhMzdiNzUx
15
- Yjg0OTc0ZTIyNjg1ODVmNDZlN2I5MzEwZWUyZDkwYWIzYjAyNjM=
13
+ ODQzYzVmNjIyMmJiNWM4ZjU3MDY5NjQ4MDQyZGI1ZDY4OWRhY2ZlYjExN2I0
14
+ ZmNlMzJjMjEzNGY0ODA5YjVlMTU3MTYxNjY1ZTk1MzUwOGE5NWUyOGE3ODVj
15
+ ZWE4YzQ3ZWIyYmFmZGQyYjQ2MzM1NTllN2E4NzVjMzE3OTUxMDc=
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # UptrendsExtended Gem Changelog
2
2
 
3
+ ## 0.7.1
4
+ - Handling the case where the probe has been created but no data have yet been collected
5
+
3
6
  ## 0.7.0
4
7
  - Added the statistics part, so you are able to get statistics about probes and probegroups
5
8
  - Minor syntax fixes for rails 3 and up
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Uptrends RESTful API Client
2
2
 
3
- [![Code Climate](https://codeclimate.com/github/microting/uptrends-gem/badges/gpa.svg)](https://codeclimate.com/github/microting/uptrends-gem) [![Test Coverage](https://codeclimate.com/github/microting/uptrends-gem/badges/coverage.svg)](https://codeclimate.com/github/microting/uptrends-gem/coverage) [![Build Status](https://travis-ci.org/microting/uptrends-gem.svg)](https://travis-ci.org/microting/uptrends-gem) [![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/microting/uptrends-gem/blob/master/LICENSE.txt)
3
+ [![Code Climate](https://codeclimate.com/github/microting/uptrends-gem/badges/gpa.svg)](https://codeclimate.com/github/microting/uptrends-gem) [![Test Coverage](https://codeclimate.com/github/microting/uptrends-gem/badges/coverage.svg)](https://codeclimate.com/github/microting/uptrends-gem/coverage) [![Build Status](https://travis-ci.org/microting/uptrends-gem.svg)](https://travis-ci.org/microting/uptrends-gem) [![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/microting/uptrends-gem/blob/master/LICENSE.txt) [![Gem Version](https://badge.fury.io/rb/uptrends_extended.svg)](http://badge.fury.io/rb/uptrends_extended)
4
4
 
5
5
  This is a ruby wrapper around the [Uptrends API][2]. Uptrends is a monitoring service that let's you monitor Web pages, Web services, Mail servers, Database servers, DNS, SSL certificates, FTP and more.
6
6
 
@@ -48,13 +48,21 @@ module UptrendsExtended
48
48
 
49
49
  def uptime_this_year
50
50
  stats = statistics("#{Time.now.year}/01/01", "#{Time.now.year}/12/31", 'Year')
51
- {sla: stats[0]['SLAPercentage'], uptime: stats[0]['PercentageUptime']}
51
+ if stats.blank?
52
+ {sla: 0, uptime: 0} # We return this because the probe has not been tested yet.
53
+ else
54
+ {sla: stats[0]['SLAPercentage'], uptime: stats[0]['PercentageUptime']}
55
+ end
52
56
  end
53
57
 
54
58
  def uptime_last_12_months
55
59
  start_period = Time.now - 12.months
56
60
  stats = statistics(start_period.strftime('%Y/%m/%d'), Time.now.strftime('%Y/%m/%d'), 'Year')
57
- {sla: stats[0]['SLAPercentage'], uptime: stats[0]['PercentageUptime']}
61
+ if stats.blank?
62
+ {sla: 0, uptime: 0} # We return this because the probe has not been tested yet.
63
+ else
64
+ {sla: stats[0]['SLAPercentage'], uptime: stats[0]['PercentageUptime']}
65
+ end
58
66
  end
59
67
 
60
68
  def self.parse(client, response)
@@ -1,3 +1,3 @@
1
1
  module UptrendsExtended
2
- VERSION = '0.7.0'
2
+ VERSION = '0.7.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uptrends_extended
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Barnett