tinder 1.4.4 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/.rspec +3 -2
- data/Gemfile +2 -1
- data/Rakefile +3 -4
- data/lib/faraday/response/raise_on_authentication_failure.rb +9 -0
- data/lib/tinder.rb +0 -5
- data/lib/tinder/campfire.rb +5 -0
- data/lib/tinder/connection.rb +17 -16
- data/lib/tinder/room.rb +7 -3
- data/lib/tinder/version.rb +1 -1
- data/spec/spec_helper.rb +7 -9
- data/spec/tinder/campfire_spec.rb +43 -7
- data/spec/tinder/connection_spec.rb +4 -4
- data/tinder.gemspec +27 -53
- metadata +170 -61
- data/lib/tinder/middleware.rb +0 -30
data/.gemtest
ADDED
File without changes
|
data/.rspec
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
--
|
2
|
-
--
|
1
|
+
--color
|
2
|
+
--format=nested
|
3
|
+
--backtrace
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/lib/tinder.rb
CHANGED
data/lib/tinder/campfire.rb
CHANGED
data/lib/tinder/connection.rb
CHANGED
@@ -1,30 +1,31 @@
|
|
1
|
-
require '
|
1
|
+
require 'active_support/json'
|
2
2
|
require 'faraday'
|
3
|
+
require 'faraday/response/raise_on_authentication_failure'
|
4
|
+
require 'faraday_middleware'
|
5
|
+
require 'uri'
|
3
6
|
|
4
7
|
module Tinder
|
5
8
|
class Connection
|
6
|
-
HOST =
|
9
|
+
HOST = 'campfirenow.com'
|
7
10
|
|
8
11
|
attr_reader :subdomain, :uri, :options
|
9
12
|
|
10
13
|
def self.connection
|
11
|
-
@connection ||= Faraday
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
conn.headers['Content-Type'] = 'application/json'
|
14
|
+
@connection ||= Faraday.new do |builder|
|
15
|
+
builder.use Faraday::Request::JSON
|
16
|
+
builder.use Faraday::Response::Mashify
|
17
|
+
builder.use Faraday::Response::ParseJson
|
18
|
+
builder.use Faraday::Response::RaiseOnAuthenticationFailure
|
19
|
+
builder.adapter Faraday.default_adapter
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
22
23
|
def self.raw_connection
|
23
|
-
@raw_connection ||= Faraday
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
@raw_connection ||= Faraday.new do |builder|
|
25
|
+
builder.use Faraday::Response::Mashify
|
26
|
+
builder.use Faraday::Response::ParseJson
|
27
|
+
builder.use Faraday::Response::RaiseOnAuthenticationFailure
|
28
|
+
builder.adapter Faraday.default_adapter
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
@@ -39,7 +40,7 @@ module Tinder
|
|
39
40
|
end
|
40
41
|
|
41
42
|
def basic_auth_settings
|
42
|
-
{
|
43
|
+
{:username => token, :password => 'X'}
|
43
44
|
end
|
44
45
|
|
45
46
|
def connection
|
data/lib/tinder/room.rb
CHANGED
@@ -127,6 +127,9 @@ module Tinder
|
|
127
127
|
|
128
128
|
join # you have to be in the room to listen
|
129
129
|
|
130
|
+
require 'active_support/json'
|
131
|
+
require 'hashie'
|
132
|
+
require 'multi_json'
|
130
133
|
require 'twitter/json_stream'
|
131
134
|
|
132
135
|
auth = connection.basic_auth_settings
|
@@ -140,20 +143,20 @@ module Tinder
|
|
140
143
|
EventMachine::run do
|
141
144
|
@stream = Twitter::JSONStream.connect(options)
|
142
145
|
@stream.each_item do |message|
|
143
|
-
message =
|
146
|
+
message = Hashie::Mash.new(MultiJson.decode(message))
|
144
147
|
message[:user] = user(message.delete(:user_id))
|
145
148
|
message[:created_at] = Time.parse(message[:created_at])
|
146
149
|
yield(message)
|
147
150
|
end
|
148
151
|
|
149
152
|
@stream.on_error do |message|
|
150
|
-
raise ListenFailed.new("got an error! #{message.inspect}!")
|
153
|
+
raise ListenFailed.new("got an error! #{message.inspect}!")
|
151
154
|
end
|
152
155
|
|
153
156
|
@stream.on_max_reconnects do |timeout, retries|
|
154
157
|
raise ListenFailed.new("Tried #{retries} times to connect. Got disconnected from #{@name}!")
|
155
158
|
end
|
156
|
-
|
159
|
+
|
157
160
|
# if we really get disconnected
|
158
161
|
raise ListenFailed.new("got disconnected from #{@name}!") if !EventMachine.reactor_running?
|
159
162
|
end
|
@@ -192,6 +195,7 @@ module Tinder
|
|
192
195
|
end
|
193
196
|
|
194
197
|
def upload(file, content_type = nil, filename = nil)
|
198
|
+
require 'mime/types'
|
195
199
|
content_type ||= MIME::Types.type_for(filename || file)
|
196
200
|
raw_post(:uploads, { :upload => Faraday::UploadIO.new(file, content_type, filename) })
|
197
201
|
end
|
data/lib/tinder/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
$:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
|
2
2
|
|
3
|
-
require 'rubygems'
|
4
3
|
require 'rspec'
|
5
|
-
gem 'activesupport', ENV['RAILS_VERSION'] if ENV['RAILS_VERSION']
|
6
4
|
require 'tinder'
|
7
5
|
require 'fakeweb'
|
8
6
|
|
@@ -15,13 +13,13 @@ end
|
|
15
13
|
def stub_connection(object, &block)
|
16
14
|
@stubs ||= Faraday::Adapter::Test::Stubs.new
|
17
15
|
|
18
|
-
object.connection.build do |
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
16
|
+
object.connection.build do |builder|
|
17
|
+
builder.use Faraday::Request::JSON
|
18
|
+
builder.use Faraday::Response::Mashify
|
19
|
+
builder.use Faraday::Response::ParseJson
|
20
|
+
builder.use Faraday::Response::RaiseOnAuthenticationFailure
|
21
|
+
builder.adapter :test, @stubs
|
24
22
|
end
|
25
23
|
|
26
24
|
block.call(@stubs)
|
27
|
-
end
|
25
|
+
end
|
@@ -4,26 +4,62 @@ describe Tinder::Campfire do
|
|
4
4
|
before do
|
5
5
|
@campfire = Tinder::Campfire.new('test', :token => 'mytoken')
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
describe "rooms" do
|
9
9
|
before do
|
10
10
|
stub_connection(@campfire.connection) do |stub|
|
11
11
|
stub.get('/rooms.json') {[ 200, {}, fixture('rooms.json') ]}
|
12
12
|
end
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
it "should return rooms" do
|
16
16
|
@campfire.rooms.size.should == 2
|
17
17
|
@campfire.rooms.first.should be_kind_of(Tinder::Room)
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
it "should set the room name and id" do
|
21
21
|
room = @campfire.rooms.first
|
22
22
|
room.name.should == 'Room 1'
|
23
23
|
room.id.should == 80749
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
|
+
describe "find_by_id" do
|
28
|
+
before do
|
29
|
+
stub_connection(@campfire.connection) do |stub|
|
30
|
+
stub.get('/rooms.json') {[ 200, {}, fixture('rooms.json') ]}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should return a Tinder::Room object when a match is found" do
|
35
|
+
room = @campfire.find_room_by_id 80749
|
36
|
+
room.should be_kind_of(Tinder::Room)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should return nil when no match is found" do
|
40
|
+
room = @campfire.find_room_by_id 123
|
41
|
+
room.should be nil
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "find_room_by_name" do
|
46
|
+
before do
|
47
|
+
stub_connection(@campfire.connection) do |stub|
|
48
|
+
stub.get('/rooms.json') {[ 200, {}, fixture('rooms.json') ]}
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return a Tinder::Room object when a match is found" do
|
53
|
+
room = @campfire.find_room_by_name 'Room 1'
|
54
|
+
room.should be_kind_of(Tinder::Room)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should return nil when no match is found" do
|
58
|
+
room = @campfire.find_room_by_name 'asdf'
|
59
|
+
room.should be nil
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
27
63
|
describe "users" do
|
28
64
|
before do
|
29
65
|
stub_connection(@campfire.connection) do |stub|
|
@@ -34,21 +70,21 @@ describe Tinder::Campfire do
|
|
34
70
|
end
|
35
71
|
end
|
36
72
|
end
|
37
|
-
|
73
|
+
|
38
74
|
it "should return a sorted list of users in all rooms" do
|
39
75
|
@campfire.users.length.should == 2
|
40
76
|
@campfire.users.first[:name].should == "Jane Doe"
|
41
77
|
@campfire.users.last[:name].should == "John Doe"
|
42
78
|
end
|
43
79
|
end
|
44
|
-
|
80
|
+
|
45
81
|
describe "me" do
|
46
82
|
before do
|
47
83
|
stub_connection(@campfire.connection) do |stub|
|
48
84
|
stub.get("/users/me.json") {[ 200, {}, fixture('users/me.json') ]}
|
49
85
|
end
|
50
86
|
end
|
51
|
-
|
87
|
+
|
52
88
|
it "should return the current user's information" do
|
53
89
|
@campfire.me["name"].should == "John Doe"
|
54
90
|
end
|
@@ -10,7 +10,7 @@ describe Tinder::Connection do
|
|
10
10
|
connection = Tinder::Connection.new('test', :token => 'foo')
|
11
11
|
lambda { connection.get('/rooms.json') }.should raise_error(Tinder::AuthenticationFailed)
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
it "should lookup token when username/password provided" do
|
15
15
|
stub_connection(Tinder::Connection) do |stub|
|
16
16
|
stub.get("/users/me.json") {[ 200, {}, fixture('users/me.json') ]}
|
@@ -19,8 +19,8 @@ describe Tinder::Connection do
|
|
19
19
|
connection = Tinder::Connection.new('test', :username => 'user', :password => 'pass')
|
20
20
|
connection.token.should.should == "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
21
21
|
end
|
22
|
-
|
23
|
-
|
22
|
+
|
23
|
+
|
24
24
|
it "should use basic auth for credentials" do
|
25
25
|
stub_connection(Tinder::Connection) do |stub|
|
26
26
|
stub.get("/rooms.json") {[ 200, {}, fixture('rooms.json') ]}
|
@@ -29,4 +29,4 @@ describe Tinder::Connection do
|
|
29
29
|
lambda { connection.get('/rooms.json') }.should_not raise_error
|
30
30
|
end
|
31
31
|
end
|
32
|
-
end
|
32
|
+
end
|
data/tinder.gemspec
CHANGED
@@ -1,57 +1,31 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path(
|
3
|
-
require
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'tinder/version'
|
4
4
|
|
5
|
-
Gem::Specification.new do |
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
s.summary = %q{Ruby wrapper for the Campfire API}
|
19
|
-
s.files = `git ls-files`.split("\n")
|
20
|
-
s.test_files = `git ls-files -- spec/*`.split("\n")
|
21
|
-
s.require_paths = ["lib"]
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.add_development_dependency 'fakeweb', '~> 1.3'
|
7
|
+
gem.add_development_dependency 'rake', '~> 0.8'
|
8
|
+
gem.add_development_dependency 'rspec', '~> 2.6'
|
9
|
+
gem.add_runtime_dependency 'activesupport', ['>= 2.3', '< 4']
|
10
|
+
gem.add_runtime_dependency 'eventmachine', '~> 0.12'
|
11
|
+
gem.add_runtime_dependency 'faraday', ['>= 0.6', '< 0.8']
|
12
|
+
gem.add_runtime_dependency 'faraday_middleware', ['>= 0.6', '< 0.8']
|
13
|
+
gem.add_runtime_dependency 'hashie', '~> 1.0'
|
14
|
+
gem.add_runtime_dependency 'mime-types', '~> 1.16'
|
15
|
+
gem.add_runtime_dependency 'multi_json', '~> 1.0'
|
16
|
+
gem.add_runtime_dependency 'multipart-post', '~> 1.1'
|
17
|
+
gem.add_runtime_dependency 'twitter-stream', '~> 0.1'
|
22
18
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
s.add_development_dependency(%q<fakeweb>, [">= 0"])
|
36
|
-
else
|
37
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
38
|
-
s.add_dependency(%q<faraday>, ["~> 0.5.1"])
|
39
|
-
s.add_dependency(%q<multipart-post>, [">= 0"])
|
40
|
-
s.add_dependency(%q<mime-types>, [">= 0"])
|
41
|
-
s.add_dependency(%q<twitter-stream>, [">= 0"])
|
42
|
-
s.add_dependency(%q<eventmachine>, [">= 0"])
|
43
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
44
|
-
s.add_dependency(%q<fakeweb>, [">= 0"])
|
45
|
-
end
|
46
|
-
else
|
47
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
48
|
-
s.add_dependency(%q<faraday>, ["~> 0.5.1"])
|
49
|
-
s.add_dependency(%q<multipart-post>, [">= 0"])
|
50
|
-
s.add_dependency(%q<mime-types>, [">= 0"])
|
51
|
-
s.add_dependency(%q<twitter-stream>, [">= 0"])
|
52
|
-
s.add_dependency(%q<eventmachine>, [">= 0"])
|
53
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
54
|
-
s.add_dependency(%q<fakeweb>, [">= 0"])
|
55
|
-
end
|
19
|
+
gem.authors = ["Brandon Keepers"]
|
20
|
+
gem.description = %q{A Ruby API for interfacing with Campfire, the 37Signals chat application.}
|
21
|
+
gem.email = ['brandon@opensoul.org']
|
22
|
+
gem.extra_rdoc_files = ['README.markdown']
|
23
|
+
gem.files = `git ls-files`.split("\n")
|
24
|
+
gem.homepage = 'http://github.com/collectiveidea/tinder'
|
25
|
+
gem.name = 'tinder'
|
26
|
+
gem.require_paths = ['lib']
|
27
|
+
gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6')
|
28
|
+
gem.summary = %q{Ruby wrapper for the Campfire API}
|
29
|
+
gem.test_files = `git ls-files -- spec/*`.split("\n")
|
30
|
+
gem.version = Tinder::VERSION
|
56
31
|
end
|
57
|
-
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tinder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 3
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 1
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 1.
|
8
|
+
- 5
|
9
|
+
- 0
|
10
|
+
version: 1.5.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Brandon Keepers
|
@@ -14,109 +15,211 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2011-
|
18
|
-
default_executable:
|
18
|
+
date: 2011-08-17 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
21
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
22
|
+
none: false
|
24
23
|
requirements:
|
25
|
-
- -
|
24
|
+
- - ~>
|
26
25
|
- !ruby/object:Gem::Version
|
26
|
+
hash: 9
|
27
27
|
segments:
|
28
|
-
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
name: faraday
|
28
|
+
- 1
|
29
|
+
- 3
|
30
|
+
version: "1.3"
|
31
|
+
name: fakeweb
|
32
|
+
type: :development
|
34
33
|
prerelease: false
|
35
|
-
requirement:
|
34
|
+
requirement: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
36
38
|
requirements:
|
37
39
|
- - ~>
|
38
40
|
- !ruby/object:Gem::Version
|
41
|
+
hash: 27
|
39
42
|
segments:
|
40
43
|
- 0
|
41
|
-
-
|
42
|
-
|
43
|
-
|
44
|
-
type: :
|
45
|
-
|
44
|
+
- 8
|
45
|
+
version: "0.8"
|
46
|
+
name: rake
|
47
|
+
type: :development
|
48
|
+
prerelease: false
|
49
|
+
requirement: *id002
|
46
50
|
- !ruby/object:Gem::Dependency
|
47
|
-
|
51
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 15
|
57
|
+
segments:
|
58
|
+
- 2
|
59
|
+
- 6
|
60
|
+
version: "2.6"
|
61
|
+
name: rspec
|
62
|
+
type: :development
|
48
63
|
prerelease: false
|
49
|
-
requirement:
|
64
|
+
requirement: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
50
68
|
requirements:
|
51
69
|
- - ">="
|
52
70
|
- !ruby/object:Gem::Version
|
71
|
+
hash: 5
|
53
72
|
segments:
|
54
|
-
-
|
55
|
-
|
73
|
+
- 2
|
74
|
+
- 3
|
75
|
+
version: "2.3"
|
76
|
+
- - <
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
hash: 11
|
79
|
+
segments:
|
80
|
+
- 4
|
81
|
+
version: "4"
|
82
|
+
name: activesupport
|
56
83
|
type: :runtime
|
57
|
-
|
84
|
+
prerelease: false
|
85
|
+
requirement: *id004
|
58
86
|
- !ruby/object:Gem::Dependency
|
59
|
-
|
87
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ~>
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
hash: 19
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
- 12
|
96
|
+
version: "0.12"
|
97
|
+
name: eventmachine
|
98
|
+
type: :runtime
|
60
99
|
prerelease: false
|
61
|
-
requirement:
|
100
|
+
requirement: *id005
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
62
104
|
requirements:
|
63
105
|
- - ">="
|
64
106
|
- !ruby/object:Gem::Version
|
107
|
+
hash: 7
|
65
108
|
segments:
|
66
109
|
- 0
|
67
|
-
|
110
|
+
- 6
|
111
|
+
version: "0.6"
|
112
|
+
- - <
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
hash: 27
|
115
|
+
segments:
|
116
|
+
- 0
|
117
|
+
- 8
|
118
|
+
version: "0.8"
|
119
|
+
name: faraday
|
68
120
|
type: :runtime
|
69
|
-
version_requirements: *id004
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: twitter-stream
|
72
121
|
prerelease: false
|
73
|
-
requirement:
|
122
|
+
requirement: *id006
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
74
126
|
requirements:
|
75
127
|
- - ">="
|
76
128
|
- !ruby/object:Gem::Version
|
129
|
+
hash: 7
|
130
|
+
segments:
|
131
|
+
- 0
|
132
|
+
- 6
|
133
|
+
version: "0.6"
|
134
|
+
- - <
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
hash: 27
|
77
137
|
segments:
|
78
138
|
- 0
|
79
|
-
|
139
|
+
- 8
|
140
|
+
version: "0.8"
|
141
|
+
name: faraday_middleware
|
80
142
|
type: :runtime
|
81
|
-
version_requirements: *id005
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: eventmachine
|
84
143
|
prerelease: false
|
85
|
-
requirement:
|
144
|
+
requirement: *id007
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
147
|
+
none: false
|
86
148
|
requirements:
|
87
|
-
- -
|
149
|
+
- - ~>
|
88
150
|
- !ruby/object:Gem::Version
|
151
|
+
hash: 15
|
89
152
|
segments:
|
153
|
+
- 1
|
90
154
|
- 0
|
91
|
-
version: "0"
|
155
|
+
version: "1.0"
|
156
|
+
name: hashie
|
92
157
|
type: :runtime
|
93
|
-
|
158
|
+
prerelease: false
|
159
|
+
requirement: *id008
|
94
160
|
- !ruby/object:Gem::Dependency
|
95
|
-
|
161
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
162
|
+
none: false
|
163
|
+
requirements:
|
164
|
+
- - ~>
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
hash: 47
|
167
|
+
segments:
|
168
|
+
- 1
|
169
|
+
- 16
|
170
|
+
version: "1.16"
|
171
|
+
name: mime-types
|
172
|
+
type: :runtime
|
96
173
|
prerelease: false
|
97
|
-
requirement:
|
174
|
+
requirement: *id009
|
175
|
+
- !ruby/object:Gem::Dependency
|
176
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
98
178
|
requirements:
|
99
|
-
- -
|
179
|
+
- - ~>
|
100
180
|
- !ruby/object:Gem::Version
|
181
|
+
hash: 15
|
101
182
|
segments:
|
183
|
+
- 1
|
102
184
|
- 0
|
103
|
-
version: "0"
|
104
|
-
|
105
|
-
|
185
|
+
version: "1.0"
|
186
|
+
name: multi_json
|
187
|
+
type: :runtime
|
188
|
+
prerelease: false
|
189
|
+
requirement: *id010
|
106
190
|
- !ruby/object:Gem::Dependency
|
107
|
-
|
191
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
192
|
+
none: false
|
193
|
+
requirements:
|
194
|
+
- - ~>
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
hash: 13
|
197
|
+
segments:
|
198
|
+
- 1
|
199
|
+
- 1
|
200
|
+
version: "1.1"
|
201
|
+
name: multipart-post
|
202
|
+
type: :runtime
|
108
203
|
prerelease: false
|
109
|
-
requirement:
|
204
|
+
requirement: *id011
|
205
|
+
- !ruby/object:Gem::Dependency
|
206
|
+
version_requirements: &id012 !ruby/object:Gem::Requirement
|
207
|
+
none: false
|
110
208
|
requirements:
|
111
|
-
- -
|
209
|
+
- - ~>
|
112
210
|
- !ruby/object:Gem::Version
|
211
|
+
hash: 9
|
113
212
|
segments:
|
114
213
|
- 0
|
115
|
-
|
116
|
-
|
117
|
-
|
214
|
+
- 1
|
215
|
+
version: "0.1"
|
216
|
+
name: twitter-stream
|
217
|
+
type: :runtime
|
218
|
+
prerelease: false
|
219
|
+
requirement: *id012
|
118
220
|
description: A Ruby API for interfacing with Campfire, the 37Signals chat application.
|
119
|
-
email:
|
221
|
+
email:
|
222
|
+
- brandon@opensoul.org
|
120
223
|
executables: []
|
121
224
|
|
122
225
|
extensions: []
|
@@ -124,6 +227,7 @@ extensions: []
|
|
124
227
|
extra_rdoc_files:
|
125
228
|
- README.markdown
|
126
229
|
files:
|
230
|
+
- .gemtest
|
127
231
|
- .gitignore
|
128
232
|
- .rspec
|
129
233
|
- CHANGELOG.txt
|
@@ -132,10 +236,10 @@ files:
|
|
132
236
|
- README.markdown
|
133
237
|
- Rakefile
|
134
238
|
- init.rb
|
239
|
+
- lib/faraday/response/raise_on_authentication_failure.rb
|
135
240
|
- lib/tinder.rb
|
136
241
|
- lib/tinder/campfire.rb
|
137
242
|
- lib/tinder/connection.rb
|
138
|
-
- lib/tinder/middleware.rb
|
139
243
|
- lib/tinder/room.rb
|
140
244
|
- lib/tinder/version.rb
|
141
245
|
- site/index.html
|
@@ -150,7 +254,6 @@ files:
|
|
150
254
|
- spec/tinder/connection_spec.rb
|
151
255
|
- spec/tinder/room_spec.rb
|
152
256
|
- tinder.gemspec
|
153
|
-
has_rdoc: true
|
154
257
|
homepage: http://github.com/collectiveidea/tinder
|
155
258
|
licenses: []
|
156
259
|
|
@@ -160,23 +263,29 @@ rdoc_options: []
|
|
160
263
|
require_paths:
|
161
264
|
- lib
|
162
265
|
required_ruby_version: !ruby/object:Gem::Requirement
|
266
|
+
none: false
|
163
267
|
requirements:
|
164
268
|
- - ">="
|
165
269
|
- !ruby/object:Gem::Version
|
270
|
+
hash: 3
|
166
271
|
segments:
|
167
272
|
- 0
|
168
273
|
version: "0"
|
169
274
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
275
|
+
none: false
|
170
276
|
requirements:
|
171
277
|
- - ">="
|
172
278
|
- !ruby/object:Gem::Version
|
279
|
+
hash: 23
|
173
280
|
segments:
|
174
|
-
-
|
175
|
-
|
281
|
+
- 1
|
282
|
+
- 3
|
283
|
+
- 6
|
284
|
+
version: 1.3.6
|
176
285
|
requirements: []
|
177
286
|
|
178
|
-
rubyforge_project:
|
179
|
-
rubygems_version: 1.
|
287
|
+
rubyforge_project:
|
288
|
+
rubygems_version: 1.8.6
|
180
289
|
signing_key:
|
181
290
|
specification_version: 3
|
182
291
|
summary: Ruby wrapper for the Campfire API
|
data/lib/tinder/middleware.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
module Tinder
|
2
|
-
module FaradayResponse
|
3
|
-
class WithIndifferentAccess < ::Faraday::Response::Middleware
|
4
|
-
begin
|
5
|
-
require 'active_support/core_ext/hash/indifferent_access'
|
6
|
-
rescue LoadError, NameError => error
|
7
|
-
self.load_error = error
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.register_on_complete(env)
|
11
|
-
env[:response].on_complete do |response|
|
12
|
-
json = response[:body]
|
13
|
-
if json.is_a?(Hash)
|
14
|
-
response[:body] = ::HashWithIndifferentAccess.new(json)
|
15
|
-
elsif json.is_a?(Array) and json.first.is_a?(Hash)
|
16
|
-
response[:body] = json.map{|item| ::HashWithIndifferentAccess.new(item) }
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
class RaiseOnAuthenticationFailure < ::Faraday::Response::Middleware
|
23
|
-
def self.register_on_complete(env)
|
24
|
-
env[:response].on_complete do |response|
|
25
|
-
raise AuthenticationFailed if response[:status] == 401
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|