rest-firebase 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b3abd41266838b60199410b6ac1bc94cba83482
4
- data.tar.gz: 2b94610d3db1ca7149613ce7f0c475ffc1595270
3
+ metadata.gz: abdca1643c16e51c16f42747eeba4eda9f1a9e91
4
+ data.tar.gz: e3f1d4518d893fd9882047410c8617fef616d257
5
5
  SHA512:
6
- metadata.gz: 80d3b15e2c4a5540d421643df0c98837b89cc79d523aed558f7edfeb4723d7c449c98e5085943818a0aa84f1e825dc4bbb8d0793c159a603d2d87e07685c9d4e
7
- data.tar.gz: fab331037d2b0a0e7470ecb4e3bfb10c7c1f97895ed0522740874516076e82a0564b1c34ac0f5d1cf5f2cc7a78614fb58f0a6ece49ff902af50b7eb32cc790a4
6
+ metadata.gz: 9c28d6ac640f9146f4dd581a111fda8ebdda2cbd7341f437c42b21107b626d953e9904a555cfd99c11a74179eb6a77aaf009b7c2ba74a84b1267b48609a00ac5
7
+ data.tar.gz: 6c3f2e686c4e1ce85247810ec63a10af5dbf099c8e0a373f05223caac41ae0dc9dbb7f3c7b39b798fbcea6594ab177ffea37c2967fed293468f1e0014fe9b683
@@ -1,11 +1,14 @@
1
-
1
+ sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.0
5
- - 2.1
6
4
  - 2.2
7
- - rbx-2
8
- - jruby
5
+ - 2.3.0
6
+ - rbx
7
+ - jruby-9
9
8
 
9
+ before_install:
10
+ - rvm get head
11
+ - rvm reload
12
+ - rvm use --install $TRAVIS_RUBY_VERSION --binary --latest
10
13
  install: 'bundle install --retry=3'
11
- script: 'ruby -r bundler/setup -S rake test'
14
+ script: 'ruby -vr bundler/setup -S rake test'
data/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGES
2
2
 
3
+ ## rest-firebase 1.1.0 -- 2016-02-04
4
+
5
+ * Adopted rest-core 4.0.0
6
+
3
7
  ## rest-firebase 1.0.3 -- 2015-11-16
4
8
 
5
9
  ### Bugs fixed
data/Rakefile CHANGED
@@ -2,21 +2,23 @@
2
2
  begin
3
3
  require "#{dir = File.dirname(__FILE__)}/task/gemgem"
4
4
  rescue LoadError
5
- sh 'git submodule update --init'
5
+ sh 'git submodule update --init --recursive'
6
6
  exec Gem.ruby, '-S', $PROGRAM_NAME, *ARGV
7
7
  end
8
8
 
9
- $LOAD_PATH.unshift(File.expand_path("#{dir}/rest-core/lib"))
9
+ %w[lib rest-builder/lib rest-builder/promise_pool/lib].each do |path|
10
+ $LOAD_PATH.unshift(File.expand_path("#{dir}/rest-core/#{path}"))
11
+ end
10
12
 
11
13
  Gemgem.init(dir) do |s|
12
14
  s.name = 'rest-firebase'
13
- s.version = '1.0.3'
15
+ s.version = '1.1.0'
14
16
  s.homepage = 'https://github.com/CodementorIO/rest-firebase'
15
17
 
16
18
  s.authors = ['Codementor', 'Lin Jen-Shin (godfat)']
17
19
  s.email = ['help@codementor.io']
18
20
 
19
- %w[rest-core].each{ |g| s.add_runtime_dependency(g, '>=3.5.0') }
21
+ %w[rest-core].each{ |g| s.add_runtime_dependency(g, '>=4.0.0') }
20
22
 
21
23
  # exclude rest-core
22
24
  s.files.reject!{ |f| f.start_with?('rest-core/') }
@@ -1,28 +1,30 @@
1
1
 
2
2
  require 'rest-core'
3
+ require 'rest-core/util/json'
4
+ require 'rest-core/util/hmac'
3
5
 
4
6
  # https://www.firebase.com/docs/security/custom-login.html
5
7
  # https://www.firebase.com/docs/rest-api.html
6
8
  # https://www.firebase.com/docs/rest/guide/retrieving-data.html#section-rest-queries
7
- RestFirebase = RC::Builder.client(:d, :secret, :auth, :auth_ttl, :iat) do
8
- use RC::DefaultSite , 'https://SampleChat.firebaseIO-demo.com/'
9
- use RC::DefaultHeaders, {'Accept' => 'application/json',
10
- 'Content-Type' => 'application/json'}
11
- use RC::DefaultQuery , nil
12
- use RC::JsonRequest , true
13
-
14
- use RC::Retry , 0, RC::Retry::DefaultRetryExceptions
15
- use RC::Timeout , 10
16
- use RC::FollowRedirect, 5
17
- use RC::ErrorHandler , lambda{ |env| RestFirebase::Error.call(env) }
18
- use RC::ErrorDetectorHttp
19
- use RC::JsonResponse , true
20
- use RC::CommonLogger , nil
21
- use RC::Cache , nil, 600
22
- end
9
+ RestFirebase =
10
+ RestCore::Builder.client(:d, :secret, :auth, :auth_ttl, :iat) do
11
+ use RestCore::DefaultSite , 'https://SampleChat.firebaseIO-demo.com/'
12
+ use RestCore::DefaultHeaders, {'Accept' => 'application/json',
13
+ 'Content-Type' => 'application/json'}
14
+ use RestCore::DefaultQuery , nil
15
+ use RestCore::JsonRequest , true
16
+
17
+ use RestCore::Retry , 0, RestCore::Retry::DefaultRetryExceptions
18
+ use RestCore::Timeout , 10
19
+ use RestCore::FollowRedirect, 5
20
+ use RestCore::ErrorHandler , lambda{|env| RestFirebase::Error.call(env)}
21
+ use RestCore::ErrorDetectorHttp
22
+ use RestCore::JsonResponse , true
23
+ use RestCore::CommonLogger , nil
24
+ use RestCore::Cache , nil, 600
25
+ end
23
26
 
24
27
  class RestFirebase::Error < RestCore::Error
25
- include RestCore
26
28
  class ServerError < RestFirebase::Error; end
27
29
  class ClientError < RestCore::Error; end
28
30
 
@@ -44,8 +46,9 @@ class RestFirebase::Error < RestCore::Error
44
46
  end
45
47
 
46
48
  def self.call env
47
- error, code, url = env[RESPONSE_BODY], env[RESPONSE_STATUS],
48
- env[REQUEST_URI]
49
+ error, code, url = env[RestCore::RESPONSE_BODY],
50
+ env[RestCore::RESPONSE_STATUS],
51
+ env[RestCore::REQUEST_URI]
49
52
  return new(error, code, url) unless error.kind_of?(Hash)
50
53
  case code
51
54
  when 400; BadRequest
@@ -63,12 +66,10 @@ class RestFirebase::Error < RestCore::Error
63
66
  end
64
67
 
65
68
  module RestFirebase::Client
66
- include RestCore
67
-
68
69
  class EventSource < RestCore::EventSource
69
70
  def onmessage event=nil, data=nil, sock=nil
70
71
  if event
71
- super(event, Json.decode(data), sock)
72
+ super(event, RestCore::Json.decode(data), sock)
72
73
  else
73
74
  super
74
75
  end
@@ -77,12 +78,13 @@ module RestFirebase::Client
77
78
 
78
79
  def request env, a=app
79
80
  check_auth
80
- query = env[REQUEST_QUERY].inject({}) do |q, (k, v)|
81
- q[k] = Json.encode(v)
81
+ query = env[RestCore::REQUEST_QUERY].inject({}) do |q, (k, v)|
82
+ q[k] = RestCore::Json.encode(v)
82
83
  q
83
84
  end
84
- super(env.merge(REQUEST_PATH => "#{env[REQUEST_PATH]}.json",
85
- REQUEST_QUERY => query), a)
85
+ super(env.merge(RestCore::REQUEST_PATH =>
86
+ "#{env[RestCore::REQUEST_PATH]}.json",
87
+ RestCore::REQUEST_QUERY => query), a)
86
88
  end
87
89
 
88
90
  def generate_auth opts={}
@@ -93,9 +95,10 @@ module RestFirebase::Client
93
95
  header = {:typ => 'JWT', :alg => 'HS256'}
94
96
  claims = {:v => 0, :iat => iat, :d => d}.merge(opts)
95
97
  # http://tools.ietf.org/html/draft-ietf-jose-json-web-signature-26
96
- input = [header, claims].map{ |d| base64url(Json.encode(d)) }.join('.')
98
+ input = [header, claims].map{ |d| base64url(RestCore::Json.encode(d)) }.
99
+ join('.')
97
100
  # http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-20
98
- "#{input}.#{base64url(Hmac.sha256(secret, input))}"
101
+ "#{input}.#{base64url(RestCore::Hmac.sha256(secret, input))}"
99
102
  end
100
103
 
101
104
  def query
@@ -1,50 +1,50 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: rest-firebase 1.0.3 ruby lib
2
+ # stub: rest-firebase 1.1.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
- s.name = "rest-firebase"
6
- s.version = "1.0.3"
5
+ s.name = "rest-firebase".freeze
6
+ s.version = "1.1.0"
7
7
 
8
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
- s.require_paths = ["lib"]
8
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
+ s.require_paths = ["lib".freeze]
10
10
  s.authors = [
11
- "Codementor",
12
- "Lin Jen-Shin (godfat)"]
13
- s.date = "2015-11-16"
14
- s.description = "Ruby Firebase REST API client built on top of [rest-core][].\n\n[rest-core]: https://github.com/godfat/rest-core"
15
- s.email = ["help@codementor.io"]
11
+ "Codementor".freeze,
12
+ "Lin Jen-Shin (godfat)".freeze]
13
+ s.date = "2016-02-04"
14
+ s.description = "Ruby Firebase REST API client built on top of [rest-core][].\n\n[rest-core]: https://github.com/godfat/rest-core".freeze
15
+ s.email = ["help@codementor.io".freeze]
16
16
  s.files = [
17
- ".gitignore",
18
- ".gitmodules",
19
- ".travis.yml",
20
- "CHANGES.md",
21
- "Gemfile",
22
- "LICENSE",
23
- "README.md",
24
- "Rakefile",
25
- "TODO.md",
26
- "doc/intro.md",
27
- "example/daemon.rb",
28
- "lib/rest-firebase.rb",
29
- "rest-firebase.gemspec",
30
- "task/README.md",
31
- "task/gemgem.rb",
32
- "test/test_api.rb"]
33
- s.homepage = "https://github.com/CodementorIO/rest-firebase"
34
- s.licenses = ["Apache License 2.0"]
35
- s.rubygems_version = "2.5.0"
36
- s.summary = "Ruby Firebase REST API client built on top of [rest-core][]."
37
- s.test_files = ["test/test_api.rb"]
17
+ ".gitignore".freeze,
18
+ ".gitmodules".freeze,
19
+ ".travis.yml".freeze,
20
+ "CHANGES.md".freeze,
21
+ "Gemfile".freeze,
22
+ "LICENSE".freeze,
23
+ "README.md".freeze,
24
+ "Rakefile".freeze,
25
+ "TODO.md".freeze,
26
+ "doc/intro.md".freeze,
27
+ "example/daemon.rb".freeze,
28
+ "lib/rest-firebase.rb".freeze,
29
+ "rest-firebase.gemspec".freeze,
30
+ "task/README.md".freeze,
31
+ "task/gemgem.rb".freeze,
32
+ "test/test_api.rb".freeze]
33
+ s.homepage = "https://github.com/CodementorIO/rest-firebase".freeze
34
+ s.licenses = ["Apache License 2.0".freeze]
35
+ s.rubygems_version = "2.5.2".freeze
36
+ s.summary = "Ruby Firebase REST API client built on top of [rest-core][].".freeze
37
+ s.test_files = ["test/test_api.rb".freeze]
38
38
 
39
39
  if s.respond_to? :specification_version then
40
40
  s.specification_version = 4
41
41
 
42
42
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
43
- s.add_runtime_dependency(%q<rest-core>, [">= 3.5.0"])
43
+ s.add_runtime_dependency(%q<rest-core>.freeze, [">= 4.0.0"])
44
44
  else
45
- s.add_dependency(%q<rest-core>, [">= 3.5.0"])
45
+ s.add_dependency(%q<rest-core>.freeze, [">= 4.0.0"])
46
46
  end
47
47
  else
48
- s.add_dependency(%q<rest-core>, [">= 3.5.0"])
48
+ s.add_dependency(%q<rest-core>.freeze, [">= 4.0.0"])
49
49
  end
50
50
  end
@@ -1,9 +1,10 @@
1
1
 
2
2
  require 'rest-firebase'
3
- require 'rest-core/test'
3
+ require 'rest-builder/test'
4
4
 
5
5
  Pork::API.describe RestFirebase do
6
6
  before do
7
+ stub_select_for_stringio
7
8
  stub(Time).now{ Time.at(86400) }
8
9
  end
9
10
 
@@ -74,6 +75,7 @@ SSE
74
75
  end
75
76
 
76
77
  would 'refresh token' do
78
+ firebase # initialize http-client first (it's using Time.now too)
77
79
  mock(Time).now{ Time.at(0) }
78
80
  auth, query = firebase.auth, firebase.query
79
81
  query[:auth].should.eq auth
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest-firebase
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Codementor
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-16 00:00:00.000000000 Z
12
+ date: 2016-02-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-core
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 3.5.0
20
+ version: 4.0.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 3.5.0
27
+ version: 4.0.0
28
28
  description: |-
29
29
  Ruby Firebase REST API client built on top of [rest-core][].
30
30
 
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  version: '0'
72
72
  requirements: []
73
73
  rubyforge_project:
74
- rubygems_version: 2.5.0
74
+ rubygems_version: 2.5.2
75
75
  signing_key:
76
76
  specification_version: 4
77
77
  summary: Ruby Firebase REST API client built on top of [rest-core][].