firebase 0.2.2 → 0.2.3

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: 4e0fa541544ab3358d0fc06e917791916a5d9e1f
4
- data.tar.gz: 12e96cf8448060ee5ae9d38a64c45f92fbe22842
3
+ metadata.gz: b144a7fbc2d7183897b257d55dc6d371c4d9c375
4
+ data.tar.gz: 551367963ea25efcb0dad36ad8e96deefc061305
5
5
  SHA512:
6
- metadata.gz: 9620eed6c15a1214f24a12ecda7f6a351409c974dea0e2902b5b315731b8277e7c73d85c31e23cb938852ff562f4867d0a00fe0b85390851f74b1df1d7c59ef3
7
- data.tar.gz: 4fa22a0d1a9a071ba7ec469feacf15860ad7dcc683c8d00755191b11cb170741ab4efb687b566ef04ab785d174723d56fa858bdfb27ca0c956041286b98e8031
6
+ metadata.gz: 93e12c2bbbec9255fda4a25388f0088b4d40768fb96489f276051dc05f9b18119f6761977f11c424221e6c625732db05113ec79391ce77c7c1c3cd2f2db89798
7
+ data.tar.gz: cd7eba8cf7d2729596585898b7796f51fd14b9b1080380ea2db2fbaf16b510ad26d0d48bdf3bd43f1e2e1bdc6a753167b8aa3ab279c93953ec7bd9298dca26f4
data/.document CHANGED
File without changes
data/.rspec CHANGED
File without changes
@@ -1,16 +1,23 @@
1
- - 0.2.2
1
+ # Changelog
2
2
 
3
- Update dependencies
3
+ ## 0.2.3 (in development)
4
4
 
5
- - 0.2.1
5
+ * Switch from problematic `typhoeus` client to `HTTPClient`
6
+ * File permissions issue fix
7
+
8
+ ## 0.2.2
9
+
10
+ * Update dependencies
11
+
12
+ ## 0.2.1
6
13
 
7
14
  * Fix auth parse exception
8
15
 
9
- - 0.2.0
16
+ ## 0.2.0
10
17
 
11
18
  * You can now pass query options to get/push/set, etc.
12
19
  * The old syntax no longer works. You now need to create instance variables of Firebase::Client.new(...)
13
20
 
14
- - 0.1.6
21
+ ## 0.1.6
15
22
 
16
23
  * You can now create instances of Firebase. The old syntax still works but will be removed in version 0,2. - @wannabefro
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source "http://rubygems.org"
3
3
  # Example:
4
4
  # gem "activesupport", ">= 2.3.5"
5
5
 
6
- gem 'typhoeus', ">= 0.6.1"
6
+ gem 'httpclient'
7
7
  gem 'json'
8
8
 
9
9
  # Add dependencies to develop your gem here.
@@ -6,11 +6,8 @@ GEM
6
6
  descendants_tracker (0.0.4)
7
7
  thread_safe (~> 0.3, >= 0.3.1)
8
8
  diff-lcs (1.2.5)
9
- ethon (0.7.0)
10
- ffi (>= 1.3.0)
11
9
  faraday (0.9.0)
12
10
  multipart-post (>= 1.2, < 3)
13
- ffi (1.9.3)
14
11
  git (1.2.6)
15
12
  github_api (0.11.3)
16
13
  addressable (~> 2.3)
@@ -22,6 +19,7 @@ GEM
22
19
  oauth2
23
20
  hashie (2.1.1)
24
21
  highline (1.6.21)
22
+ httpclient (2.5.3.3)
25
23
  jeweler (2.0.1)
26
24
  builder
27
25
  bundler (>= 1.0)
@@ -59,14 +57,12 @@ GEM
59
57
  diff-lcs (>= 1.1.3, < 2.0)
60
58
  rspec-mocks (2.14.6)
61
59
  thread_safe (0.3.3)
62
- typhoeus (0.6.8)
63
- ethon (>= 0.7.0)
64
60
 
65
61
  PLATFORMS
66
62
  ruby
67
63
 
68
64
  DEPENDENCIES
65
+ httpclient
69
66
  jeweler
70
67
  json
71
68
  rspec
72
- typhoeus (>= 0.6.1)
File without changes
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # firebase
2
2
 
3
- Ruby wrapper for the Firebase backend API.
3
+ Ruby wrapper for the [Firebase REST API](https://www.firebase.com/docs/rest/api/).
4
4
 
5
5
  Changes are sent to all subscribed clients automatically, so you can
6
6
  update your clients **in realtime from the backend**.
data/Rakefile CHANGED
File without changes
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "firebase"
8
- s.version = "0.2.2"
8
+ s.version = "0.2.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Oscar Del Ben"]
12
- s.date = "2014-05-03"
12
+ s.date = "2015-01-23"
13
13
  s.description = "Firebase wrapper for Ruby"
14
14
  s.email = "info@oscardelben.com"
15
15
  s.extra_rdoc_files = [
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.files = [
20
20
  ".document",
21
21
  ".rspec",
22
- "CHANGELOG",
22
+ "CHANGELOG.md",
23
23
  "Gemfile",
24
24
  "Gemfile.lock",
25
25
  "LICENSE.txt",
@@ -30,7 +30,6 @@ Gem::Specification.new do |s|
30
30
  "lib/firebase.rb",
31
31
  "lib/firebase/request.rb",
32
32
  "lib/firebase/response.rb",
33
- "spec/firebase_request_spec.rb",
34
33
  "spec/firebase_spec.rb",
35
34
  "spec/spec_helper.rb"
36
35
  ]
@@ -44,18 +43,18 @@ Gem::Specification.new do |s|
44
43
  s.specification_version = 4
45
44
 
46
45
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
47
- s.add_runtime_dependency(%q<typhoeus>, [">= 0.6.1"])
46
+ s.add_runtime_dependency(%q<httpclient>, [">= 0"])
48
47
  s.add_runtime_dependency(%q<json>, [">= 0"])
49
48
  s.add_development_dependency(%q<rspec>, [">= 0"])
50
49
  s.add_development_dependency(%q<jeweler>, [">= 0"])
51
50
  else
52
- s.add_dependency(%q<typhoeus>, [">= 0.6.1"])
51
+ s.add_dependency(%q<httpclient>, [">= 0"])
53
52
  s.add_dependency(%q<json>, [">= 0"])
54
53
  s.add_dependency(%q<rspec>, [">= 0"])
55
54
  s.add_dependency(%q<jeweler>, [">= 0"])
56
55
  end
57
56
  else
58
- s.add_dependency(%q<typhoeus>, [">= 0.6.1"])
57
+ s.add_dependency(%q<httpclient>, [">= 0"])
59
58
  s.add_dependency(%q<json>, [">= 0"])
60
59
  s.add_dependency(%q<rspec>, [">= 0"])
61
60
  s.add_dependency(%q<jeweler>, [">= 0"])
@@ -1,20 +1,17 @@
1
+ require 'uri'
2
+ require 'firebase/request'
3
+ require 'firebase/response'
4
+
1
5
  module Firebase
2
6
  class Client
3
-
4
- require 'firebase/request'
5
- require 'firebase/response'
6
-
7
- def self.format_uri(other)
8
- if other
9
- other.end_with?("/") ? other : other + '/'
10
- end
11
- end
12
-
13
7
  attr_reader :auth, :request
14
8
 
15
9
  def initialize(base_uri, auth=nil)
16
- uri = Firebase::Client.format_uri(base_uri)
17
- @request = Firebase::Request.new(uri)
10
+ if base_uri !~ URI::regexp(%w(https))
11
+ raise ArgumentError.new('base_uri must be a valid https uri')
12
+ end
13
+ base_uri += '/' unless base_uri.end_with?('/')
14
+ @request = Firebase::Request.new(base_uri)
18
15
  @auth = auth
19
16
  end
20
17
 
@@ -1,15 +1,11 @@
1
- require 'typhoeus'
1
+ require 'httpclient'
2
2
  require 'json'
3
- require 'open-uri'
4
- require 'uri'
5
3
 
6
4
  module Firebase
7
5
  class Request
8
-
9
- attr_reader :base_uri
10
-
11
6
  def initialize(base_uri)
12
- @base_uri = base_uri
7
+ @client = HTTPClient.new(base_url: base_uri)
8
+ @client.default_header['Content-Type'] = 'application/json'
13
9
  end
14
10
 
15
11
  def get(path, query_options)
@@ -32,25 +28,11 @@ module Firebase
32
28
  process(:patch, path, value.to_json, query_options)
33
29
  end
34
30
 
35
- def build_url(path)
36
- path = "#{path}.json"
37
- url = URI.join(base_uri, path)
38
-
39
- url.to_s
40
- end
41
-
42
31
  private
43
32
 
44
33
  def process(method, path, body=nil, query_options={})
45
- @@hydra ||= Typhoeus::Hydra.new
46
- request = Typhoeus::Request.new(build_url(path),
47
- :body => body,
48
- :method => method,
49
- :params => query_options)
50
- @@hydra.queue(request)
51
- @@hydra.run
52
-
53
- Firebase::Response.new(request.response)
34
+ response = @client.request(method, "#{path}.json", body: body, query: query_options, follow_redirect: true)
35
+ Firebase::Response.new(response)
54
36
  end
55
37
  end
56
38
  end
@@ -1,6 +1,5 @@
1
1
  module Firebase
2
2
  class Response
3
-
4
3
  attr_accessor :response
5
4
 
6
5
  def initialize(response)
@@ -9,8 +8,6 @@ module Firebase
9
8
 
10
9
  def body
11
10
  JSON.parse(response.body, :quirks_mode => true)
12
- rescue JSON::ParserError => e
13
- response.body == 'null' ? nil : raise
14
11
  end
15
12
 
16
13
  def raw_body
@@ -18,11 +15,11 @@ module Firebase
18
15
  end
19
16
 
20
17
  def success?
21
- [200, 204].include? response.code
18
+ [200, 204].include? response.status
22
19
  end
23
20
 
24
21
  def code
25
- response.code
22
+ response.status
26
23
  end
27
24
  end
28
25
  end
@@ -1,11 +1,20 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "Firebase" do
4
-
5
4
  let (:data) do
6
5
  { 'name' => 'Oscar' }
7
6
  end
8
7
 
8
+ describe "invalid uri" do
9
+ it "should raise on http" do
10
+ expect{ Firebase::Client.new('http://test.firebaseio.com') }.to raise_error(ArgumentError)
11
+ end
12
+
13
+ it 'should raise on empty' do
14
+ expect{ Firebase::Client.new('') }.to raise_error(ArgumentError)
15
+ end
16
+ end
17
+
9
18
  before do
10
19
  @firebase = Firebase::Client.new('https://test.firebaseio.com')
11
20
  @req = @firebase.request
File without changes
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firebase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Del Ben
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-03 00:00:00.000000000 Z
11
+ date: 2015-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: typhoeus
14
+ name: httpclient
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.6.1
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.6.1
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -76,7 +76,7 @@ extra_rdoc_files:
76
76
  files:
77
77
  - .document
78
78
  - .rspec
79
- - CHANGELOG
79
+ - CHANGELOG.md
80
80
  - Gemfile
81
81
  - Gemfile.lock
82
82
  - LICENSE.txt
@@ -87,7 +87,6 @@ files:
87
87
  - lib/firebase.rb
88
88
  - lib/firebase/request.rb
89
89
  - lib/firebase/response.rb
90
- - spec/firebase_request_spec.rb
91
90
  - spec/firebase_spec.rb
92
91
  - spec/spec_helper.rb
93
92
  homepage: http://github.com/oscardelben/firebase-ruby
@@ -1,20 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Firebase Request" do
4
-
5
- describe "url_builder" do
6
- before do
7
- @req = req = Firebase::Request.new 'https://test.firebaseio.com'
8
- end
9
-
10
- it "should build the correct url when passed no path" do
11
- @req.build_url(nil).should == 'https://test.firebaseio.com/.json'
12
- end
13
-
14
- it "should build the correct url when passed a path" do
15
- req = Firebase::Request.new 'https://test.firebaseio.com'
16
-
17
- @req.build_url('users/eugene').should == 'https://test.firebaseio.com/users/eugene.json'
18
- end
19
- end
20
- end