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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d83d7fad7aa7890332a1bd6ce35ce569f49fba1d
4
- data.tar.gz: af6bcf94dd2c6e119ea6fdeba52bf67ffa0f040f
3
+ metadata.gz: e47da2b23abe00b47c2cfa05b5e7ca7b690806a5
4
+ data.tar.gz: 0f28d010f9b936456b1f2109c4db7a8336ae5a0f
5
5
  SHA512:
6
- metadata.gz: d4bf46499590a7a0b0d9e448aa9ffa0e040f80d8e983df20d13678d263d30a509ed2e17b41bbbafa9dab80a78e30164f91dd261857f9f4b488ff370fdadc753e
7
- data.tar.gz: b959548a26d415f2ec66545073ca922ac8265130ec4b93a859abdab3d1a2efad65fc09e3cad9b2e46c9d3bfaae25f54f46237ba98d246da8aa73f211d563ab11
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. Only has a couple of commands for now.
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
- git clone git@github.com:jslate/rolltools.git
8
- cd rolltools
9
- rake install
7
+ $ gem install rolltools
10
8
 
11
- If you are using rbenv, don't forget:
9
+ Or in your Gemfile:
12
10
 
13
- rbenv rehash
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
 
@@ -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
- @settings = settings
7
+ @@settings = settings
7
8
  end
8
9
 
9
10
  def self.settings
10
- @settings ||= YAML::load_file "#{Dir.home}/.rolltools.yml" rescue nil
11
- @settings ||= {}
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)
@@ -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.settings['read_token']
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.settings['read_token']
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
 
@@ -1,3 +1,3 @@
1
1
  module Rolltools
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rolltools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Slate