rollbar-api 0.2.2 → 0.2.3

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: e6dc2f0e30f2f8ffd7c0d48f7ff3aad15f776a53
4
- data.tar.gz: e49f995539141dca2207705a67ca2f041247c790
3
+ metadata.gz: 87c19bc2e9b0ae90c07d36e50d07bca9b41293bc
4
+ data.tar.gz: 424c9a30b3f9b25c84eef41d40f840c5fbf4ed96
5
5
  SHA512:
6
- metadata.gz: 73e4fced89132a55b03710d7777756e239e077320f77a5831267eca2c5349b3d86e05c289b79de44bd5cfaedcf6d02382a4a75c427758b5da0547d55f80620f9
7
- data.tar.gz: 061988885040354200ab0211800c6a7ed7002d6962169513702a0ba432c143a97cda2c80b21d4e03c3c2614f4ccc4afd5a679d0b3ca1f774432cdd49f796adb9
6
+ metadata.gz: 5c5600791ed96b9920dd7241f2a3e77d565d88e1fabf6d62ec61156aebe55c8a7cb12920ccaa132fd14894f16a741c134d7fcfd739378e76b6fac486dad81a56
7
+ data.tar.gz: 1b17c52d06df3a2e4060d77127c178ed52f562aaebfc65ecd6b3662f09d1cb1f2aee088a66c091b39f4dfac37b947267a9dfa8511486a3ed9264b0e66527d035
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # rollbar-api [![CircleCI](https://circleci.com/gh/wealthsimple/rollbar-api.svg?style=svg)](https://circleci.com/gh/wealthsimple/rollbar-api) [![](https://img.shields.io/gem/v/rollbar-api.svg)](https://rubygems.org/gems/rollbar-api)
1
+ # rollbar-api [![CircleCI](https://circleci.com/gh/wealthsimple/rollbar-api.svg?style=svg)](https://circleci.com/gh/wealthsimple/rollbar-api) [![Gem Version](https://badge.fury.io/rb/rollbar-api.svg)](https://rubygems.org/gems/rollbar-api)
2
2
 
3
3
  Rubygem for accessing Rollbar's full REST and RQL APIs.
4
4
 
@@ -93,6 +93,18 @@ account = RollbarApi::Account.find("my-organization")
93
93
  users = account.get("/api/1/users")
94
94
  ```
95
95
 
96
+ ## Logging
97
+
98
+ You can optionally override the logger with:
99
+
100
+ ```ruby
101
+ # Set it to your own custom logger
102
+ RollbarApi.logger = Rails.logger
103
+
104
+ # Disable logging altogether
105
+ RollbarApi.logger = Logger.new(nil)
106
+ ```
107
+
96
108
  ## Development
97
109
 
98
110
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -5,6 +5,8 @@ require "rollbar-api"
5
5
  account_name = ENV["ROLLBAR_ACCOUNT_NAME"] or raise "Must specify ROLLBAR_ACCOUNT_NAME in .env"
6
6
  account_access_token = ENV["ROLLBAR_ACCOUNT_ACCESS_TOKEN"] or raise "Must specify ROLLBAR_ACCOUNT_ACCESS_TOKEN in .env"
7
7
 
8
+ RollbarApi.logger = Logger.new(nil)
9
+
8
10
  account = RollbarApi::Account.configure(account_name, account_access_token)
9
11
 
10
12
  users = account.get("/api/1/users")
@@ -5,6 +5,7 @@ require "json"
5
5
  require "recursive-open-struct"
6
6
 
7
7
  require "rollbar-api/account"
8
+ require "rollbar-api/logger"
8
9
  require "rollbar-api/project"
9
10
  require "rollbar-api/request"
10
11
  require "rollbar-api/resource"
@@ -0,0 +1,10 @@
1
+ module RollbarApi
2
+ @@logger = Logger.new(STDOUT)
3
+ def self.logger=(logger)
4
+ @@logger = logger
5
+ end
6
+
7
+ def self.logger
8
+ @@logger
9
+ end
10
+ end
@@ -16,7 +16,7 @@ module RollbarApi
16
16
  request.url(path)
17
17
  request.body = body_to_json(params) if params.present?
18
18
  end
19
-
19
+
20
20
  request.headers.merge!({
21
21
  "Accept" => "application/json",
22
22
  "Content-Type" => "application/json",
@@ -29,7 +29,7 @@ module RollbarApi
29
29
 
30
30
  def connection
31
31
  Faraday.new(url: "https://api.rollbar.com") do |faraday|
32
- faraday.response :logger, ::Logger.new(STDOUT), bodies: false
32
+ faraday.response :logger, RollbarApi.logger, bodies: false
33
33
  faraday.adapter Faraday.default_adapter
34
34
  faraday.use Faraday::Response::RaiseError
35
35
  end
@@ -1,3 +1,3 @@
1
1
  module RollbarApi
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rollbar-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Graham
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-06 00:00:00.000000000 Z
11
+ date: 2017-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -184,6 +184,7 @@ files:
184
184
  - examples/top_active_items.rb
185
185
  - lib/rollbar-api.rb
186
186
  - lib/rollbar-api/account.rb
187
+ - lib/rollbar-api/logger.rb
187
188
  - lib/rollbar-api/project.rb
188
189
  - lib/rollbar-api/request.rb
189
190
  - lib/rollbar-api/resource.rb