firebase_token_generator 1.0.1 → 1.0.2

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 ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ODkwOGQyOTg1NjIyODVlNjRmMGM2YTFlMDI3ZjA0N2YzNTQ2NGQ5Mg==
5
+ data.tar.gz: !binary |-
6
+ MThlMWJiYmM0ODQzOWExOTZlMDJjNTQ1MTRmZmRjYjg1MTdkZDk0NQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ YTZmMDY3MjRmMmJjN2EyMzk0MWJiYjYxOGMzZmU0NGYzNTg3NzIxM2IxZDQ4
10
+ MjM1NTNlYjM4MWU4NzY2MjNhYWNjOGUyMWI5MDllNTk3YWMwYTUzYTEzZTIw
11
+ YWRhYTY1MmEyZTc1Y2QxMjhlZmQyNzFiNTAxN2I5NTc2Y2I0ODI=
12
+ data.tar.gz: !binary |-
13
+ MTVkYWI3YTE5NDQ5OTdmMWNlMWQzYTJkMGRiZDg1OTdkMTcyYWUzOWM0OGQx
14
+ ZjkyOTdhYjNhODJkMDE4OTY5ZTE0Zjk1Zjk3NTBkNGRiZDg1ZmM1NWQ2NWE5
15
+ ZGJmYWFkMGY0YmZmYjJkOGY1YjhkNmU4MDQwN2IxNjdiMDJmOGI=
@@ -1,6 +1,8 @@
1
+ require "rubygems"
1
2
  require "json"
2
3
  require "base64"
3
4
  require "openssl"
5
+ require "date"
4
6
 
5
7
  module Firebase
6
8
 
@@ -24,6 +26,9 @@ module Firebase
24
26
  #
25
27
  # Throws ArgumentError if given an invalid option
26
28
  def create_token(auth_data, options = {})
29
+ if auth_data.empty? and options.empty?
30
+ raise ArgumentError, "FirebaseTokenGenerator.create_token: data is empty and no options are set. This token will have no effect on Firebase."
31
+ end
27
32
  claims = create_options_claims(options)
28
33
  claims[:v] = TOKEN_VERSION
29
34
  claims[:iat] = Time.now.to_i
@@ -48,6 +53,9 @@ module Firebase
48
53
  def create_options_claims(options)
49
54
  opts = {}
50
55
  options.each do |key, value|
56
+ if value.respond_to?(:strftime) then
57
+ value = value.strftime("%s").to_i
58
+ end
51
59
  if CLAIMS_MAP.include?(key.to_sym) then
52
60
  opts[CLAIMS_MAP[key.to_sym]] = value
53
61
  else
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firebase_token_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
5
- prerelease:
4
+ version: 1.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Greg Soltis
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-24 00:00:00.000000000 Z
11
+ date: 2013-09-15 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: A library for generating signed authentication tokens for use with Firebase.
15
14
  Uses your app secret.
@@ -21,26 +20,25 @@ files:
21
20
  - lib/firebase_token_generator.rb
22
21
  homepage: http://github.com/firebase/firebase-token-generator-ruby
23
22
  licenses: []
23
+ metadata: {}
24
24
  post_install_message:
25
25
  rdoc_options: []
26
26
  require_paths:
27
27
  - lib
28
28
  required_ruby_version: !ruby/object:Gem::Requirement
29
- none: false
30
29
  requirements:
31
30
  - - ! '>='
32
31
  - !ruby/object:Gem::Version
33
32
  version: '0'
34
33
  required_rubygems_version: !ruby/object:Gem::Requirement
35
- none: false
36
34
  requirements:
37
35
  - - ! '>='
38
36
  - !ruby/object:Gem::Version
39
37
  version: '0'
40
38
  requirements: []
41
39
  rubyforge_project:
42
- rubygems_version: 1.8.24
40
+ rubygems_version: 2.1.4
43
41
  signing_key:
44
- specification_version: 3
42
+ specification_version: 4
45
43
  summary: Generate Firebase Authentication Tokens
46
44
  test_files: []