uptrends 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: 426774d940c7a3c534c80b75f7177c7868e14c80
4
- data.tar.gz: c53a2f0f3c6eeb737f344c41be2c4d1699e450a1
3
+ metadata.gz: 63e0d2b7ad081a62966062a0f10be4a37b1f2990
4
+ data.tar.gz: a9680e84d9c634a9dfaacdc9935968b6f080b846
5
5
  SHA512:
6
- metadata.gz: a1bee1bdc2c100c601a141edab90c60c5440bf25f847a6658e99ea7c6352a2e612590f1c8449ca800fb6c8b845c984c6223a5e6729bd04b98cf75a37f95d8145
7
- data.tar.gz: 3137144b530527f684a9c9f94cc1726f9fc9fefd60e6e75ccb0546c457590894f8594cf409ab4be2c9e3c648a7793786aef365090019fa025b57c6518b815a1f
6
+ metadata.gz: 9d871f61e0b342f7ceba9ccc91b2ba540000023d4acee35d761d8039ad4f6296aa1a959bc0839b73a6e0e0ba60a501b5dddba88ffaf8c7ad80c718919e22a917
7
+ data.tar.gz: 275568a6050f301ce8113d843185a1313322dd16ac01082ce44b0f7c2fa1754f80e3aaace5696d32ee4aa8d20b00069c1e179c8da1e8033093182ec9748a94d6
data/README.md CHANGED
@@ -24,15 +24,20 @@ First initialize an instance of the API Client and then we play with it:
24
24
  u = Uptrends::ApiClient.new(username: 'my@email.com', password: 'MyP@sswo0rd')
25
25
  # => #<Uptrends::ApiClient:0x00000101309e48 @username="my@email.com">
26
26
 
27
- Then you can query your account for all probes:
27
+ Query your account for all probes:
28
28
 
29
29
  probes = u.probes # Returns an array of probes
30
- # => [#<Uptrends::Probe:0x0000010336cac8...>, #<Uptrends::Probe:0x0000010336cac9...>, ... ]
30
+ # => [#<Uptrends::Probe:0x0000010336cac8 ...>, #<Uptrends::Probe:0x0000010336cac9 ...>, ... ]
31
31
 
32
- Let's select the first one and look at it's attributes
32
+ Query your account for all probe __groups__:
33
+
34
+ probe_groups = u.probe_groups # Returns an array of probe groups
35
+ # => [#<Uptrends::ProbeGroup:0x000001021594f8 ...>, #<Uptrends::ProbeGroup:0x000001021592f0 ...>, ... ]
36
+
37
+ Let's select the first probe and look at it's attributes
33
38
 
34
39
  p = probes.first
35
- # => #<Uptrends::Probe:0x0000010336cac8...>
40
+ # => #<Uptrends::Probe:0x0000010336cac8 ...>
36
41
 
37
42
  p.attributes
38
43
  # => [:guid, :name, :url, :port, :checkfrequency, :probetype, :isactive, :generatealert, :notes, :performancelimit1, :performancelimit2, :erroronlimit1, :erroronlimit2, :minbytes, :erroronminbytes, :timeout, :tcpconnecttimeout, :matchpattern, :dnslookupmode, :useragent, :username, :password, :iscompetitor, :checkpoints, :httpmethod, :postdata]
@@ -43,7 +48,21 @@ Let's select the first one and look at it's attributes
43
48
  p.name
44
49
  # => "My Probe's Name"
45
50
 
46
- If you wanted to update the probe, all you need to do is change it's attributes and then update, e.g.
51
+ Let's select the first probe __group__ and look at it's attributes
52
+
53
+ pg = probe_groups.first
54
+ # => #<Uptrends::ProbeGroup:0x000001021594f8 ...>
55
+
56
+ pg.attributes
57
+ # => [:guid, :name, :isall, :isclientprobegroup]
58
+
59
+ pg.guid
60
+ # => "c8d6a0f704494c37823850f3d4fd4273"
61
+
62
+ pg.name
63
+ # => "All probes"
64
+
65
+ If you wanted to update the probe, all you need to do is change as many attributes as you want and then update, e.g.
47
66
 
48
67
  # Let's change the name of the probe:
49
68
 
@@ -54,6 +73,12 @@ If you wanted to update the probe, all you need to do is change it's attributes
54
73
  response.response
55
74
  # => #<Net::HTTPOK 200 OK readbody=true>
56
75
 
76
+ Let's add our probe to a probe group
77
+
78
+ response = u.add_probe_to_group(probe: p, group: pg)
79
+ response.response
80
+ # => #<Net::HTTPCreated 201 Created readbody=true>
81
+
57
82
  ## Contributing
58
83
 
59
84
  1. Fork it ( https://github.com/jasonwbarnett/uptrends-gem/fork )
@@ -26,6 +26,10 @@ module Uptrends
26
26
  @probes ||= get_probes
27
27
  end
28
28
 
29
+ def probe_groups
30
+ @probe_groups ||= get_probe_groups
31
+ end
32
+
29
33
  def get_probes
30
34
  parsed_response = self.class.get('/probes').parsed_response
31
35
  @probes = parsed_response.inject([]) do |memo, x|
@@ -53,7 +57,6 @@ module Uptrends
53
57
 
54
58
 
55
59
  post_body = JSON.dump({"ProbeGuid" => probe_guid})
56
- puts "post_body: #{post_body}"
57
60
  self.class.post("/probegroups/#{group_guid}/members", body: post_body)
58
61
  end
59
62
 
@@ -1,3 +1,3 @@
1
1
  module Uptrends
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uptrends
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
  - Jason Barnett