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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4dfed794d59202349e5075a77d9c2221475e452
4
- data.tar.gz: eb1f0802e899e60db31ebeb38ded8caf7f732c18
3
+ metadata.gz: e6dc2f0e30f2f8ffd7c0d48f7ff3aad15f776a53
4
+ data.tar.gz: e49f995539141dca2207705a67ca2f041247c790
5
5
  SHA512:
6
- metadata.gz: 20ea39b0bec19e0767654ee620c4968253faeee93f345bad04d5044cd5f8ae16207c6e5a9c35741783ef5dd8302fcad70954f1db92dd31d66f13f81572ec2152
7
- data.tar.gz: ddcae24799fc9e1b97de51001c286add6a7458ebac82a1fcbc6bf49bf1c80f7c78c99f4d726274f052ccbb58b8e31a5eeefa38d17f51b0805902382145be4b76
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
- Specify query parameters by passing them in as a hash:
39
+ # List recent items:
40
+ items = project.get("/api/1/items/")
42
41
 
43
- ```ruby
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 its status
63
+ # Check job status
65
64
  rql_job = project.get("/api/1/rql/job/#{rql_job.result.id}")
66
65
 
67
- # If it succeeded, get the RQL result
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 [user.username, user.email]
11
+ users.result.users.first(5).each do |user|
12
+ p user
14
13
  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,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
- pp item
15
+ p item
17
16
  puts "=" * 80
18
17
  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
 
@@ -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
- pp rql_job
17
+ p rql_job
19
18
 
20
19
  if rql_job.result.status == "success"
21
20
  # Print out succeeded job result
22
- pp project.get("/api/1/rql/job/#{rql_job.result.id}/result")
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
- pp i, item
15
+ top_active_items.result.first(5).each_with_index do |item, i|
16
+ p i, item
18
17
  puts "=" * 80
19
18
  end
@@ -9,8 +9,9 @@ module RollbarApi
9
9
  else
10
10
  response
11
11
  end
12
- @struct = RecursiveOpenStruct.new(@response_json, {recurse_over_arrays: true})
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
@@ -1,3 +1,3 @@
1
1
  module RollbarApi
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
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.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Graham