rollbar-api 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -8
- data/examples/list_account_users.rb +2 -3
- data/examples/list_items.rb +1 -2
- data/examples/rql_query.rb +2 -3
- data/examples/top_active_items.rb +2 -3
- data/lib/rollbar-api/resource.rb +8 -1
- data/lib/rollbar-api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6dc2f0e30f2f8ffd7c0d48f7ff3aad15f776a53
|
4
|
+
data.tar.gz: e49f995539141dca2207705a67ca2f041247c790
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73e4fced89132a55b03710d7777756e239e077320f77a5831267eca2c5349b3d86e05c289b79de44bd5cfaedcf6d02382a4a75c427758b5da0547d55f80620f9
|
7
|
+
data.tar.gz: 061988885040354200ab0211800c6a7ed7002d6962169513702a0ba432c143a97cda2c80b21d4e03c3c2614f4ccc4afd5a679d0b3ca1f774432cdd49f796adb9
|
data/README.md
CHANGED
@@ -35,13 +35,11 @@ You can make HTTP `GET` calls to fetch items, deploys, occurrences, and so on by
|
|
35
35
|
|
36
36
|
```ruby
|
37
37
|
project = RollbarApi::Project.find("my-project")
|
38
|
-
items = project.get("/api/1/items/")
|
39
|
-
```
|
40
38
|
|
41
|
-
|
39
|
+
# List recent items:
|
40
|
+
items = project.get("/api/1/items/")
|
42
41
|
|
43
|
-
|
44
|
-
project = RollbarApi::Project.find("my-project")
|
42
|
+
# Specify query parameters by passing them in as a hash:
|
45
43
|
top_items = project.get("/api/1/reports/top_active_items", {
|
46
44
|
hours: "24",
|
47
45
|
environments: "production,staging",
|
@@ -55,16 +53,17 @@ If you need to make an HTTP `POST`, `DELETE`, and so on, just replace `.get` wit
|
|
55
53
|
You can also run RQL queries:
|
56
54
|
|
57
55
|
```ruby
|
58
|
-
# Create a job
|
59
56
|
project = RollbarApi::Project.find("my-project")
|
57
|
+
|
58
|
+
# Create a job
|
60
59
|
rql_job = project.post("/api/1/rql/jobs", {
|
61
60
|
query_string: "select * from item_occurrence where item.counter=1",
|
62
61
|
})
|
63
62
|
|
64
|
-
# Check
|
63
|
+
# Check job status
|
65
64
|
rql_job = project.get("/api/1/rql/job/#{rql_job.result.id}")
|
66
65
|
|
67
|
-
# If
|
66
|
+
# If job succeeded, get the RQL result
|
68
67
|
if rql_job.result.status == "success"
|
69
68
|
rql_result = project.get("/api/1/rql/job/#{rql_job.result.id}/result")
|
70
69
|
p rql_result
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require "dotenv/load"
|
2
|
-
require "pp"
|
3
2
|
require "bundler/setup"
|
4
3
|
require "rollbar-api"
|
5
4
|
|
@@ -9,6 +8,6 @@ account_access_token = ENV["ROLLBAR_ACCOUNT_ACCESS_TOKEN"] or raise "Must specif
|
|
9
8
|
account = RollbarApi::Account.configure(account_name, account_access_token)
|
10
9
|
|
11
10
|
users = account.get("/api/1/users")
|
12
|
-
users.result.users.each do |user|
|
13
|
-
p
|
11
|
+
users.result.users.first(5).each do |user|
|
12
|
+
p user
|
14
13
|
end
|
data/examples/list_items.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require "dotenv/load"
|
2
|
-
require "pp"
|
3
2
|
require "bundler/setup"
|
4
3
|
require "rollbar-api"
|
5
4
|
|
@@ -13,6 +12,6 @@ items = project.get("/api/1/items")
|
|
13
12
|
|
14
13
|
# Print out the first 5 items
|
15
14
|
items.result.items.first(5).each do |item|
|
16
|
-
|
15
|
+
p item
|
17
16
|
puts "=" * 80
|
18
17
|
end
|
data/examples/rql_query.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require "dotenv/load"
|
2
|
-
require "pp"
|
3
2
|
require "bundler/setup"
|
4
3
|
require "rollbar-api"
|
5
4
|
|
@@ -15,9 +14,9 @@ rql_job = project.post("/api/1/rql/jobs", {
|
|
15
14
|
|
16
15
|
# Fetch job status
|
17
16
|
rql_job = project.get("/api/1/rql/job/#{rql_job.result.id}")
|
18
|
-
|
17
|
+
p rql_job
|
19
18
|
|
20
19
|
if rql_job.result.status == "success"
|
21
20
|
# Print out succeeded job result
|
22
|
-
|
21
|
+
p project.get("/api/1/rql/job/#{rql_job.result.id}/result")
|
23
22
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require "dotenv/load"
|
2
|
-
require "pp"
|
3
2
|
require "bundler/setup"
|
4
3
|
require "rollbar-api"
|
5
4
|
|
@@ -13,7 +12,7 @@ top_active_items = project.get("/api/1/reports/top_active_items", {
|
|
13
12
|
environments: "production,staging",
|
14
13
|
})
|
15
14
|
|
16
|
-
top_active_items.result.each_with_index do |item, i|
|
17
|
-
|
15
|
+
top_active_items.result.first(5).each_with_index do |item, i|
|
16
|
+
p i, item
|
18
17
|
puts "=" * 80
|
19
18
|
end
|
data/lib/rollbar-api/resource.rb
CHANGED
@@ -9,8 +9,9 @@ module RollbarApi
|
|
9
9
|
else
|
10
10
|
response
|
11
11
|
end
|
12
|
-
@struct =
|
12
|
+
@struct = ResourceStruct.new(@response_json, {recurse_over_arrays: true})
|
13
13
|
end
|
14
|
+
delegate :inspect, to: :@struct
|
14
15
|
|
15
16
|
def as_json(options = {})
|
16
17
|
@response_json
|
@@ -20,4 +21,10 @@ module RollbarApi
|
|
20
21
|
@struct.send(name, *args)
|
21
22
|
end
|
22
23
|
end
|
24
|
+
|
25
|
+
class ResourceStruct < RecursiveOpenStruct
|
26
|
+
def inspect
|
27
|
+
%{#<RollbarApi::Resource: #{JSON.pretty_generate(@table)}>}
|
28
|
+
end
|
29
|
+
end
|
23
30
|
end
|
data/lib/rollbar-api/version.rb
CHANGED