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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de7fea7977ca5a014746909d9e82d7da1130b91f
4
- data.tar.gz: 1af351ceaa9d3eb1589ad1d0ce79baf5548110ba
3
+ metadata.gz: b4dfed794d59202349e5075a77d9c2221475e452
4
+ data.tar.gz: eb1f0802e899e60db31ebeb38ded8caf7f732c18
5
5
  SHA512:
6
- metadata.gz: 650c9cddc0c41e6bcbd28786a28c034742149f18178bfa5c44af22f05948fdc916d87dc0d0e99126cd052d53ac5b91ffac663bb92c7aa0ab782b454b99d058db
7
- data.tar.gz: 2046181b08ebdbe7af9e562e31e381204433c99e6341c8c403e5aa0b6c1127c65f677f7df3a8293369ed8180eaba2cd0802d31b91b53347803af8f5bc1495dba
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
- items = RollbarApi::Project.find("my-project").get("/api/1/items/")
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
- top_items = RollbarApi::Project.find("my-project").get("/api/1/reports/top_active_items", {
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
- rql_job = RollbarApi::Project.find("my-project").post("/api/1/rql/jobs", {
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 = RollbarApi::Project.find("my-project").get("/api/1/rql/job/#{rql_job.result.id}")
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 = RollbarApi::Project.find("my-project").get("/api/1/rql/job/#{rql_job.result.id}/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
- users = RollbarApi::Account.find("my-organization").get("/api/1/users")
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 = RollbarApi::Account.find(account_name).get("/api/1/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
@@ -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 = RollbarApi::Project.find(project_name).get("/api/1/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|
@@ -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 = RollbarApi::Project.find(project_name).post("/api/1/rql/jobs", {
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 = RollbarApi::Project.find(project_name).get("/api/1/rql/job/#{rql_job.result.id}")
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 RollbarApi::Project.find(project_name).get("/api/1/rql/job/#{rql_job.result.id}/result")
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 = RollbarApi::Project.find(project_name).get("/api/1/reports/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
  })
@@ -4,6 +4,7 @@ module RollbarApi
4
4
 
5
5
  def self.configure(account_name, account_access_token)
6
6
  @@accounts[account_name] = account_access_token
7
+ find(account_name)
7
8
  end
8
9
 
9
10
  def self.find(account_name)
@@ -4,6 +4,7 @@ module RollbarApi
4
4
 
5
5
  def self.configure(project_name, project_access_token)
6
6
  @@projects[project_name] = project_access_token
7
+ find(project_name)
7
8
  end
8
9
 
9
10
  def self.find(project_name)
@@ -1,3 +1,3 @@
1
1
  module RollbarApi
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: rollbar-api
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
  - Peter Graham