onetime 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +6 -0
- data/README.md +28 -0
- data/Rakefile +2 -1
- data/VERSION.yml +1 -1
- data/bin/onetime +2 -2
- data/lib/onetime/api.rb +16 -15
- metadata +16 -3
data/CHANGES.txt
CHANGED
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# One-Time Secret #
|
2
|
+
|
3
|
+
**Keep sensitive info out of your chat logs & email.**
|
4
|
+
|
5
|
+
### Usage ###
|
6
|
+
|
7
|
+
$ echo "I STILL WATCH NIGHT COURT." | onetime
|
8
|
+
|
9
|
+
$ onetime
|
10
|
+
Paste secret here (hit control-D to continue):
|
11
|
+
I STILL WATCH NIGHT COURT.
|
12
|
+
https://onetimesecret.com/secret/3djys3b7tridrcvbiprqjejz0c2g07x
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
### Installation ###
|
17
|
+
|
18
|
+
$ [sudo] gem install onetime
|
19
|
+
|
20
|
+
### More Info ###
|
21
|
+
|
22
|
+
* [API docs](https://onetimesecret.com/docs/api)
|
23
|
+
* [Codes](https://github.com/onetimesecret/onetime-ruby)
|
24
|
+
* [Rubgems](https://rubygems.org/gems/onetime)
|
25
|
+
|
26
|
+
### License ###
|
27
|
+
|
28
|
+
See LICENSE.txt
|
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require "rake"
|
|
3
3
|
require "rake/clean"
|
4
4
|
require 'yaml'
|
5
5
|
|
6
|
-
require '
|
6
|
+
require 'hanna/rdoctask'
|
7
7
|
|
8
8
|
config = YAML.load_file("VERSION.yml")
|
9
9
|
task :default => ["build"]
|
@@ -23,6 +23,7 @@ begin
|
|
23
23
|
gem.homepage = "https://github.com/onetimesecret/onetime-ruby"
|
24
24
|
gem.authors = ["Delano Mandelbaum"]
|
25
25
|
gem.add_dependency('drydock', '>= 0.6.9')
|
26
|
+
gem.add_dependency('httparty', '>= 0.7.7')
|
26
27
|
gem.add_dependency('json', '>= 1.6.4')
|
27
28
|
end
|
28
29
|
Jeweler::GemcutterTasks.new
|
data/VERSION.yml
CHANGED
data/bin/onetime
CHANGED
@@ -102,11 +102,11 @@ class Onetime::CLI
|
|
102
102
|
command :generate do |obj|
|
103
103
|
@ret = @api.post '/generate'
|
104
104
|
uri, secret_value = OT::API.web_uri('secret', @ret[:secret_key]), @ret[:value]
|
105
|
-
STDERR.puts ret.inspect if obj.global.debug
|
105
|
+
STDERR.puts @ret.inspect if obj.global.debug
|
106
106
|
if obj.global.format == 'csv'
|
107
107
|
puts [secret_value,uri].join ','
|
108
108
|
elsif obj.global.format.nil?
|
109
|
-
msg =
|
109
|
+
msg = 'Your secret (hit return to continue): %s' % secret_value
|
110
110
|
eraser = "\e[K\r%s" % [uri] # \e[K\r
|
111
111
|
print msg
|
112
112
|
begin
|
data/lib/onetime/api.rb
CHANGED
@@ -30,11 +30,27 @@ end
|
|
30
30
|
# # => {'value' => '3Rg8R2sfD3?a', 'metadata_key' => '...', 'secret_key' => '...'}
|
31
31
|
#
|
32
32
|
module Onetime
|
33
|
+
class API
|
34
|
+
module VERSION
|
35
|
+
def self.to_s
|
36
|
+
load_config
|
37
|
+
[@version[:MAJOR], @version[:MINOR], @version[:PATCH]].join('.')
|
38
|
+
end
|
39
|
+
def self.inspect
|
40
|
+
to_s
|
41
|
+
end
|
42
|
+
def self.load_config
|
43
|
+
require 'yaml'
|
44
|
+
@version ||= YAML.load_file(File.join(LIB_HOME, '..', '..', 'VERSION.yml'))
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
33
48
|
class API
|
34
49
|
include HTTParty
|
35
50
|
LIB_HOME = File.expand_path File.dirname(__FILE__) unless defined?(Onetime::API::LIB_HOME)
|
36
51
|
base_uri 'https://onetimesecret.com/api'
|
37
52
|
format :json
|
53
|
+
headers 'X-Onetime-Client' => Onetime::API::VERSION.to_s
|
38
54
|
attr_reader :opts, :response, :custid, :key, :default_params
|
39
55
|
attr_accessor :apiversion
|
40
56
|
def initialize custid=nil, key=nil, opts={}
|
@@ -103,21 +119,6 @@ module Onetime
|
|
103
119
|
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
|
104
120
|
end
|
105
121
|
end
|
106
|
-
|
107
|
-
module VERSION
|
108
|
-
def self.to_s
|
109
|
-
load_config
|
110
|
-
[@version[:MAJOR], @version[:MINOR], @version[:PATCH]].join('.')
|
111
|
-
end
|
112
|
-
def self.inspect
|
113
|
-
to_s
|
114
|
-
end
|
115
|
-
def self.load_config
|
116
|
-
require 'yaml'
|
117
|
-
@version ||= YAML.load_file(File.join(LIB_HOME, '..', '..', 'VERSION.yml'))
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
122
|
end
|
122
123
|
end
|
123
124
|
OT = Onetime unless defined?(OT)
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: onetime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.3.
|
5
|
+
version: 0.3.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Delano Mandelbaum
|
@@ -24,16 +24,27 @@ dependencies:
|
|
24
24
|
type: :runtime
|
25
25
|
version_requirements: *id001
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
|
-
name:
|
27
|
+
name: httparty
|
28
28
|
prerelease: false
|
29
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 0.7.7
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: json
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.6.4
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id003
|
37
48
|
description: CLI tool and Ruby library for onetimesecret.com
|
38
49
|
email: delano@onetimesecret.com
|
39
50
|
executables:
|
@@ -42,9 +53,11 @@ extensions: []
|
|
42
53
|
|
43
54
|
extra_rdoc_files:
|
44
55
|
- LICENSE.txt
|
56
|
+
- README.md
|
45
57
|
files:
|
46
58
|
- CHANGES.txt
|
47
59
|
- LICENSE.txt
|
60
|
+
- README.md
|
48
61
|
- Rakefile
|
49
62
|
- VERSION.yml
|
50
63
|
- bin/onetime
|