bigbertha 0.0.4 → 0.0.5
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 +8 -8
- data/README.md +4 -1
- data/Rakefile +2 -0
- data/bigbertha.gemspec +1 -4
- data/bin/bb_auth_token +15 -5
- data/bin/bb_console +13 -0
- data/lib/bigbertha/action.rb +3 -2
- data/lib/bigbertha/version.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTY1ZmY3ZWVkY2E1NDc3YjI3ZDYyZjAwMWUxOTEwNTg5MmQzMjM1ZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MGJjNWU5ZGUxMDc2MzRkNjE2MjFhYmFiMzkwNDQ5YWZlYzUyODE5ZA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTA3YjhiYWZmZWM3MzA1MDQ0YzZjNDkwZTZiODFhOGJiZTYxODUwMDk3NTFi
|
10
|
+
NzBlOGQyZjJhNThkMzdhNGMwM2E1ODE0OTI3NjBiMTczOGU1NjU3MjVlMTFj
|
11
|
+
ZDE5ZTA5MGE0MTc5NjM4MzFiYjAzYTE2OGQyYzI4YmE2ZTc5ODE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzE0MjY5OWUyMTFlM2JlZmRlMTk5MmZhZDQ4NDY2MzFiNDk4MTI4OWUxOTk3
|
14
|
+
MGZmYWUwY2I4YWNmZWQxY2IwMGVkMTFlMjE0OWQ1NTM2MTNkYmM2ODY2ZTBi
|
15
|
+
YmU4Yjk3ZDhhMjBmNTQ1YzExYzkxYTA4YzRmMjVlNjQzNjQ0YTY=
|
data/README.md
CHANGED
@@ -350,4 +350,7 @@ Bigbertha is released under the [MIT](http://opensource.org/licenses/MIT) licens
|
|
350
350
|
+ 0.0.4:
|
351
351
|
+ Added command line exec bb_auth_token to generate auth tokens
|
352
352
|
+ Added splat args to child
|
353
|
-
+ Deprecated Load. Use Ref from now on
|
353
|
+
+ Deprecated Load. Use Ref from now on
|
354
|
+
+ 0.0.5
|
355
|
+
+ Added auth token expiration
|
356
|
+
+ Added irb console bin
|
data/Rakefile
CHANGED
@@ -17,6 +17,8 @@ desc 'Cleanup build artifacts'
|
|
17
17
|
task :clean do
|
18
18
|
cov = File.expand_path( File.join( %w(.. coverage) ), __FILE__ )
|
19
19
|
FileUtils.rm_r( cov ) if File.exists?( cov )
|
20
|
+
pkg = File.expand_path( File.join( %w(.. pkg) ), __FILE__ )
|
21
|
+
FileUtils.rm_r( pkg ) if File.exists?( pkg )
|
20
22
|
end
|
21
23
|
|
22
24
|
desc 'Run samples'
|
data/bigbertha.gemspec
CHANGED
@@ -7,10 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = Bigbertha::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
|
10
|
-
s.authors
|
11
|
-
"Fernand Galiana"
|
12
|
-
]
|
13
|
-
|
10
|
+
s.authors = ["Fernand Galiana"]
|
14
11
|
s.email = ["fernand.galiana@gmail.com"]
|
15
12
|
s.homepage = "http://derailed.github.io/bigbertha"
|
16
13
|
s.summary = %q{Ruby implementation for your Firebase battery}
|
data/bin/bb_auth_token
CHANGED
@@ -7,15 +7,17 @@ Main {
|
|
7
7
|
description 'Specifies the firebase secret token'
|
8
8
|
cast :string
|
9
9
|
}
|
10
|
-
option( '
|
11
|
-
description '
|
10
|
+
option( 'expires' ) {
|
11
|
+
description 'Number of days at which the auth token will be considered invalid. Default[30]'
|
12
12
|
cast :integer
|
13
13
|
argument :optional
|
14
|
+
defaults 30
|
14
15
|
}
|
15
16
|
option( 'valid_from' ) {
|
16
|
-
description '
|
17
|
+
description 'Number of days before which the auth token will be considered invalid. Default[0]'
|
17
18
|
cast :integer
|
18
19
|
argument :optional
|
20
|
+
defaults 0
|
19
21
|
}
|
20
22
|
option( 'debug' ) {
|
21
23
|
description 'Turns on debuging mode for security rules'
|
@@ -54,12 +56,20 @@ Main {
|
|
54
56
|
puts '='*200
|
55
57
|
end
|
56
58
|
|
59
|
+
def map_key( key )
|
60
|
+
keys = { valid_from: 'notBefore' }
|
61
|
+
keys[key] || key
|
62
|
+
end
|
63
|
+
|
57
64
|
def run
|
58
65
|
gen = Firebase::FirebaseTokenGenerator.new( params['secret'].value )
|
59
66
|
opts = {}
|
60
|
-
%w(admin simulate debug
|
61
|
-
opts[key.to_sym] = params[key].value
|
67
|
+
%w(admin simulate debug).each do |key|
|
68
|
+
opts[map_key( key.to_sym )] = params[key].value unless params[key].value.nil?
|
62
69
|
end
|
70
|
+
%w(expires valid_from).each do |key|
|
71
|
+
opts[map_key( key.to_sym)] = Time.now.to_i + params[key].value.to_i*24*60*60 unless params[key].value == 0
|
72
|
+
end
|
63
73
|
unless params['data'].value.empty?
|
64
74
|
data = JSON.parse( params['data'].value )
|
65
75
|
else
|
data/bin/bb_console
ADDED
data/lib/bigbertha/action.rb
CHANGED
@@ -113,8 +113,9 @@ module Bigbertha
|
|
113
113
|
if resp.response_code == 403
|
114
114
|
raise PermissionDeniedError, "No permission for #{location}"
|
115
115
|
end
|
116
|
-
unless resp.success?
|
117
|
-
|
116
|
+
unless resp.success?
|
117
|
+
error = "-- " + JSON.parse( resp.body )['error'] rescue ""
|
118
|
+
raise InvalidRequestError, "<#{resp.return_code}> Unable to perform request #{location} #{error}"
|
118
119
|
end
|
119
120
|
if resp.body.empty? or resp.body == "null"
|
120
121
|
raise NoDataError, "No data found at location #{location}"
|
data/lib/bigbertha/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bigbertha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fernand Galiana
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
prerelease: false
|
@@ -86,6 +86,7 @@ email:
|
|
86
86
|
- fernand.galiana@gmail.com
|
87
87
|
executables:
|
88
88
|
- bb_auth_token
|
89
|
+
- bb_console
|
89
90
|
extensions: []
|
90
91
|
extra_rdoc_files: []
|
91
92
|
files:
|
@@ -95,6 +96,7 @@ files:
|
|
95
96
|
- Rakefile
|
96
97
|
- bigbertha.gemspec
|
97
98
|
- bin/bb_auth_token
|
99
|
+
- bin/bb_console
|
98
100
|
- examples/a.rb
|
99
101
|
- examples/b.rb
|
100
102
|
- examples/c.rb
|