rollbar-api 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -6
- data/examples/list_account_users.rb +2 -2
- data/examples/list_items.rb +2 -2
- data/examples/rql_query.rb +4 -4
- data/examples/top_active_items.rb +2 -2
- data/lib/rollbar-api/account.rb +1 -0
- data/lib/rollbar-api/project.rb +1 -0
- 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: b4dfed794d59202349e5075a77d9c2221475e452
|
4
|
+
data.tar.gz: eb1f0802e899e60db31ebeb38ded8caf7f732c18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20ea39b0bec19e0767654ee620c4968253faeee93f345bad04d5044cd5f8ae16207c6e5a9c35741783ef5dd8302fcad70954f1db92dd31d66f13f81572ec2152
|
7
|
+
data.tar.gz: ddcae24799fc9e1b97de51001c286add6a7458ebac82a1fcbc6bf49bf1c80f7c78c99f4d726274f052ccbb58b8e31a5eeefa38d17f51b0805902382145be4b76
|
data/README.md
CHANGED
@@ -34,13 +34,15 @@ RollbarApi::Project.configure("other-project", ENV["OTHER_PROJECT_ACCESS_TOKEN"]
|
|
34
34
|
You can make HTTP `GET` calls to fetch items, deploys, occurrences, and so on by finding any project you added in the configuration and calling `.get` with the API endpoint:
|
35
35
|
|
36
36
|
```ruby
|
37
|
-
|
37
|
+
project = RollbarApi::Project.find("my-project")
|
38
|
+
items = project.get("/api/1/items/")
|
38
39
|
```
|
39
40
|
|
40
41
|
Specify query parameters by passing them in as a hash:
|
41
42
|
|
42
43
|
```ruby
|
43
|
-
|
44
|
+
project = RollbarApi::Project.find("my-project")
|
45
|
+
top_items = project.get("/api/1/reports/top_active_items", {
|
44
46
|
hours: "24",
|
45
47
|
environments: "production,staging",
|
46
48
|
})
|
@@ -54,16 +56,17 @@ You can also run RQL queries:
|
|
54
56
|
|
55
57
|
```ruby
|
56
58
|
# Create a job
|
57
|
-
|
59
|
+
project = RollbarApi::Project.find("my-project")
|
60
|
+
rql_job = project.post("/api/1/rql/jobs", {
|
58
61
|
query_string: "select * from item_occurrence where item.counter=1",
|
59
62
|
})
|
60
63
|
|
61
64
|
# Check its status
|
62
|
-
rql_job =
|
65
|
+
rql_job = project.get("/api/1/rql/job/#{rql_job.result.id}")
|
63
66
|
|
64
67
|
# If it succeeded, get the RQL result
|
65
68
|
if rql_job.result.status == "success"
|
66
|
-
rql_result =
|
69
|
+
rql_result = project.get("/api/1/rql/job/#{rql_job.result.id}/result")
|
67
70
|
p rql_result
|
68
71
|
end
|
69
72
|
```
|
@@ -87,7 +90,8 @@ RollbarApi::Account.configure("my-organization", ENV["ROLLBAR_ACCOUNT_ACCESS_TOK
|
|
87
90
|
Making API requests through Account-level APIs works similarly to project-level API. Here's an example that fetches all Rollbar user details for your account:
|
88
91
|
|
89
92
|
```ruby
|
90
|
-
|
93
|
+
account = RollbarApi::Account.find("my-organization")
|
94
|
+
users = account.get("/api/1/users")
|
91
95
|
```
|
92
96
|
|
93
97
|
## Development
|
@@ -6,9 +6,9 @@ require "rollbar-api"
|
|
6
6
|
account_name = ENV["ROLLBAR_ACCOUNT_NAME"] or raise "Must specify ROLLBAR_ACCOUNT_NAME in .env"
|
7
7
|
account_access_token = ENV["ROLLBAR_ACCOUNT_ACCESS_TOKEN"] or raise "Must specify ROLLBAR_ACCOUNT_ACCESS_TOKEN in .env"
|
8
8
|
|
9
|
-
RollbarApi::Account.configure(account_name, account_access_token)
|
9
|
+
account = RollbarApi::Account.configure(account_name, account_access_token)
|
10
10
|
|
11
|
-
users =
|
11
|
+
users = account.get("/api/1/users")
|
12
12
|
users.result.users.each do |user|
|
13
13
|
p [user.username, user.email]
|
14
14
|
end
|
data/examples/list_items.rb
CHANGED
@@ -6,10 +6,10 @@ require "rollbar-api"
|
|
6
6
|
project_name = ENV["ROLLBAR_PROJECT_NAME"] or raise "Must specify ROLLBAR_PROJECT_NAME in .env"
|
7
7
|
project_access_token = ENV["ROLLBAR_PROJECT_ACCESS_TOKEN"] or raise "Must specify ROLLBAR_PROJECT_ACCESS_TOKEN in .env"
|
8
8
|
|
9
|
-
RollbarApi::Project.configure(project_name, project_access_token)
|
9
|
+
project = RollbarApi::Project.configure(project_name, project_access_token)
|
10
10
|
|
11
11
|
# Fetch all items
|
12
|
-
items =
|
12
|
+
items = project.get("/api/1/items")
|
13
13
|
|
14
14
|
# Print out the first 5 items
|
15
15
|
items.result.items.first(5).each do |item|
|
data/examples/rql_query.rb
CHANGED
@@ -6,18 +6,18 @@ require "rollbar-api"
|
|
6
6
|
project_name = ENV["ROLLBAR_PROJECT_NAME"] or raise "Must specify ROLLBAR_PROJECT_NAME in .env"
|
7
7
|
project_access_token = ENV["ROLLBAR_PROJECT_ACCESS_TOKEN"] or raise "Must specify ROLLBAR_PROJECT_ACCESS_TOKEN in .env"
|
8
8
|
|
9
|
-
RollbarApi::Project.configure(project_name, project_access_token)
|
9
|
+
project = RollbarApi::Project.configure(project_name, project_access_token)
|
10
10
|
|
11
11
|
# Create the job
|
12
|
-
rql_job =
|
12
|
+
rql_job = project.post("/api/1/rql/jobs", {
|
13
13
|
query_string: "select * from item_occurrence where item.counter=1",
|
14
14
|
})
|
15
15
|
|
16
16
|
# Fetch job status
|
17
|
-
rql_job =
|
17
|
+
rql_job = project.get("/api/1/rql/job/#{rql_job.result.id}")
|
18
18
|
pp rql_job
|
19
19
|
|
20
20
|
if rql_job.result.status == "success"
|
21
21
|
# Print out succeeded job result
|
22
|
-
pp
|
22
|
+
pp project.get("/api/1/rql/job/#{rql_job.result.id}/result")
|
23
23
|
end
|
@@ -6,9 +6,9 @@ require "rollbar-api"
|
|
6
6
|
project_name = ENV["ROLLBAR_PROJECT_NAME"] or raise "Must specify ROLLBAR_PROJECT_NAME in .env"
|
7
7
|
project_access_token = ENV["ROLLBAR_PROJECT_ACCESS_TOKEN"] or raise "Must specify ROLLBAR_PROJECT_ACCESS_TOKEN in .env"
|
8
8
|
|
9
|
-
RollbarApi::Project.configure(project_name, project_access_token)
|
9
|
+
project = RollbarApi::Project.configure(project_name, project_access_token)
|
10
10
|
|
11
|
-
top_active_items =
|
11
|
+
top_active_items = project.get("/api/1/reports/top_active_items", {
|
12
12
|
hours: "24",
|
13
13
|
environments: "production,staging",
|
14
14
|
})
|
data/lib/rollbar-api/account.rb
CHANGED
data/lib/rollbar-api/project.rb
CHANGED
data/lib/rollbar-api/version.rb
CHANGED