rolltools 0.0.2 → 0.0.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 +4 -4
- data/README.md +18 -10
- data/lib/rolltools/settings.rb +4 -3
- data/lib/rolltools/utils.rb +2 -2
- data/lib/rolltools/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: e47da2b23abe00b47c2cfa05b5e7ca7b690806a5
|
4
|
+
data.tar.gz: 0f28d010f9b936456b1f2109c4db7a8336ae5a0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff01445374b4a45cf0714a14c5380577c3ce439c51218c9a26860602bfa1028f83f1bc6b6e20847f077be2646bb62633fc6e26e4812196d47768f4f457bf5508
|
7
|
+
data.tar.gz: 8fde3ae058518eea725d024c800f0fde7cb9e5d5855413d33e2b4d6e2b97984188e006d6b3abc4d8fa62cc51045b42df9077438624c00f01f44b078ee9b2c4c8
|
data/README.md
CHANGED
@@ -1,24 +1,22 @@
|
|
1
1
|
# Rolltools
|
2
2
|
|
3
|
-
Just a simple gem that gives you command line tools to display info from the Rollbar API.
|
3
|
+
Just a simple gem that gives you ruby methods and command line tools to display info from the Rollbar API.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
8
|
-
cd rolltools
|
9
|
-
rake install
|
7
|
+
$ gem install rolltools
|
10
8
|
|
11
|
-
|
9
|
+
Or in your Gemfile:
|
12
10
|
|
13
|
-
|
11
|
+
gem 'rolltools'
|
14
12
|
|
15
|
-
## Usage
|
13
|
+
## Usage - Command Line
|
16
14
|
|
17
15
|
Run 'rolltools' to get a list of commands.
|
18
16
|
|
19
|
-
Typical usage:
|
17
|
+
Typical usage from command line:
|
20
18
|
|
21
|
-
rolltools set_config read_token abc123...
|
19
|
+
rolltools set_config read_token abc123... # will set token in ~/.rolltools.yml
|
22
20
|
|
23
21
|
rolltools user_agents 2269 -l 2 # user agents for #2269 TypeError: no implicit conversion of nil into String, limit 2
|
24
22
|
|
@@ -29,7 +27,17 @@ Typical usage:
|
|
29
27
|
|
30
28
|
> TypeError no implicit conversion of nil into String
|
31
29
|
> TypeError no implicit conversion of nil into String
|
32
|
-
|
30
|
+
|
31
|
+
_The default limit is 20, which is one page of items. If you specify a limit > 20 it will result in more requests to Rollbar._
|
32
|
+
|
33
|
+
## Usage - Ruby
|
34
|
+
|
35
|
+
require 'rolltools'
|
36
|
+
|
37
|
+
Rolltools::Settings.settings = { 'read_token' => '7c77ab1524a14a5dbd7efbc45b6802db'}
|
38
|
+
puts Rolltools::Utils.get_items('3002').first(10).map{|i|i[:user_agent]}.inspect
|
39
|
+
|
40
|
+
_Similarly, if you get > 20 items it will result in more requests to Rollbar._
|
33
41
|
|
34
42
|
## Contributing
|
35
43
|
|
data/lib/rolltools/settings.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
require 'yaml'
|
2
|
+
require 'pry'
|
2
3
|
|
3
4
|
module Rolltools::Settings
|
4
5
|
|
5
6
|
def self.settings=(settings)
|
6
|
-
|
7
|
+
@@settings = settings
|
7
8
|
end
|
8
9
|
|
9
10
|
def self.settings
|
10
|
-
|
11
|
-
|
11
|
+
@@settings ||= YAML::load_file "#{Dir.home}/.rolltools.yml" rescue nil
|
12
|
+
@@settings ||= {}
|
12
13
|
end
|
13
14
|
|
14
15
|
def self.set(key, value)
|
data/lib/rolltools/utils.rb
CHANGED
@@ -8,14 +8,14 @@ module Rolltools::Utils
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.get_item_for_counter(counter)
|
11
|
-
token = Rolltools::Settings.
|
11
|
+
token = Rolltools::Settings.get('read_token')
|
12
12
|
raise "token is not set, use 'rolltools set_config token VALUE'" if token.nil?
|
13
13
|
get_item_id_res = conn.get "/api/1/item_by_counter/#{counter}", access_token: token
|
14
14
|
JSON.parse(get_item_id_res.body)['result']['itemId']
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.get_items(counter)
|
18
|
-
token = Rolltools::Settings.
|
18
|
+
token = Rolltools::Settings.get('read_token')
|
19
19
|
raise "token is not set, use 'rolltools set_config token VALUE'" if token.nil?
|
20
20
|
item_id = get_item_for_counter(counter)
|
21
21
|
|
data/lib/rolltools/version.rb
CHANGED