tinder 1.3.1 → 1.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gemtest +0 -0
- data/.gitignore +6 -3
- data/.rspec +2 -0
- data/.travis.yml +11 -0
- data/CHANGELOG.txt +54 -0
- data/Gemfile +7 -0
- data/MIT-LICENSE +20 -0
- data/README.markdown +47 -0
- data/Rakefile +7 -63
- data/init.rb +1 -1
- data/lib/faraday/response/raise_on_authentication_failure.rb +10 -0
- data/lib/faraday/response/remove_whitespace.rb +10 -0
- data/lib/tinder/campfire.rb +28 -51
- data/lib/tinder/connection.rb +108 -9
- data/lib/tinder/room.rb +205 -97
- data/lib/tinder/version.rb +4 -0
- data/lib/tinder.rb +12 -8
- data/site/index.html +7 -7
- data/spec/fixtures/presence.json +26 -0
- data/spec/fixtures/rooms/recent.json +19 -0
- data/spec/fixtures/rooms/room80749.json +21 -0
- data/spec/fixtures/rooms/room80751.json +21 -0
- data/spec/fixtures/rooms/show.json +21 -0
- data/spec/fixtures/rooms.json +18 -0
- data/spec/fixtures/users/me.json +11 -0
- data/spec/spec_helper.rb +26 -2
- data/spec/tinder/campfire_spec.rb +112 -0
- data/spec/tinder/connection_spec.rb +104 -0
- data/spec/tinder/room_spec.rb +364 -0
- data/tinder.gemspec +26 -74
- metadata +206 -82
- data/Manifest.txt +0 -10
- data/README.txt +0 -54
- data/VERSION +0 -1
- data/lib/tinder/multipart.rb +0 -63
- data/spec/campfire_spec.rb +0 -225
- data/spec/html/full_lobby.html +0 -198
- data/spec/html/normal_lobby.html +0 -192
- data/spec/html/transcript.html +0 -133
- data/spec/spec.opts +0 -1
- data/test/remote/credentials.rb.example +0 -4
- data/test/remote/remote_campfire_test.rb +0 -59
- data/test/test_helper.rb +0 -2
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 21c0b81e4f63a6db27ad0ba806c08443314a4ae0
|
4
|
+
data.tar.gz: 41cfc4284a986df69e5f7d5fac9d11347db83afe
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8f08b0ac436ed01136ba1234eb5cd58b215efe50e50d6adc87924a31a673d962fbc0d07a2def1400cc4399b179b8704949d7076e7f6bf2a0a3893fefd374922b
|
7
|
+
data.tar.gz: 8afb11d4a1572c15382ea75b6b69e2ed10b8ab26ee72f9189cd34ea92cf8ba7d8bf2e88730e5d43246c594c32a56d1a1d32248bdb989e1a8f285bd66bf2979d4
|
data/.gemtest
ADDED
File without changes
|
data/.gitignore
CHANGED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.txt
CHANGED
@@ -1,3 +1,57 @@
|
|
1
|
+
1.10.1 - 2014-12-01
|
2
|
+
* Loosen hashie dependency
|
3
|
+
|
4
|
+
1.10.0 - 2014-08-06
|
5
|
+
* Update Faraday dependency
|
6
|
+
* Loosen mime-type dependency
|
7
|
+
|
8
|
+
1.9.4 - 2014-02-24
|
9
|
+
* Fix typos in MIT licence
|
10
|
+
* Add Campfire#presence to get a list of rooms in which you are present
|
11
|
+
|
12
|
+
1.9.3 - 2013-09-06
|
13
|
+
* OAuth support
|
14
|
+
|
15
|
+
1.9.2 - 2013-01-04
|
16
|
+
* Update dependencies to latest versions
|
17
|
+
|
18
|
+
1.9.0 - 2012-07-16
|
19
|
+
* Add Room#recent to get a list of recent messages
|
20
|
+
* Add Room#search to search a room's transcripts
|
21
|
+
|
22
|
+
1.4.3 - 2010-12-07
|
23
|
+
* explicitly require 'uri'
|
24
|
+
* added Room#tweet(url)
|
25
|
+
|
26
|
+
1.4.2 - 2010-11-13
|
27
|
+
* Use Faraday instead of HTTParty [eric]
|
28
|
+
* Fix file uploads [eric]
|
29
|
+
|
30
|
+
1.4.1 - 2010-10-09
|
31
|
+
* Make SSL the default since it is available for all Campfire accounts.
|
32
|
+
* Added MIT License
|
33
|
+
|
34
|
+
1.4 - 2010-05-11
|
35
|
+
* Remove methods no longer supported by API
|
36
|
+
Campfire#available_transcripts, Room#ping, Room#destroy, Room#toggle_guest_access
|
37
|
+
* Added Room#play
|
38
|
+
* ActiveSupport 3.0 support
|
39
|
+
* Fix streaming API support
|
40
|
+
* Allow SSL for listening
|
41
|
+
* Add support for HTTP proxies [c13bcc0b]
|
42
|
+
|
43
|
+
1.3.1 - 2009-12-17
|
44
|
+
* Declare HTTParty dependency
|
45
|
+
* Fix Room#paste
|
46
|
+
|
47
|
+
1.3.0 - 2009-12-15
|
48
|
+
* Rewrite to use Official Campfire API
|
49
|
+
|
50
|
+
1.2.2 - 2009-09-12
|
51
|
+
* Work around CSRF protection bug
|
52
|
+
* Fixes for changes to Campfire markup
|
53
|
+
* Include timestamps in the transcript
|
54
|
+
|
1
55
|
1.2.1 - 2009-08-27
|
2
56
|
* Fixes for listening after campfire updates [Jordan Byron]
|
3
57
|
|
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2006-2014 Brandon Keepers, Collective Idea
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
18
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Tinder - get the Campfire started
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/tinder.png)](http://badge.fury.io/rb/tinder)
|
4
|
+
[![Build Status](https://travis-ci.org/collectiveidea/tinder.png?branch=master)](https://travis-ci.org/collectiveidea/tinder)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/collectiveidea/tinder.png)](https://codeclimate.com/github/collectiveidea/tinder)
|
6
|
+
[![Dependency Status](https://gemnasium.com/collectiveidea/tinder.png)](https://gemnasium.com/collectiveidea/tinder)
|
7
|
+
|
8
|
+
Tinder is a library for interfacing with Campfire, the chat application from 37Signals, allowing you to programmatically manage and speak/listen in chat rooms. As of December 2009, thanks to initial work from Joshua Peek at 37signals, it now makes use of the official Campfire API (described at: http://developer.37signals.com/campfire/).
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
campfire = Tinder::Campfire.new 'mysubdomain', :token => '546884b3d8fee4d80665g561caf7h9f3ea7b999e'
|
13
|
+
# or you can still use username/password and Tinder will look up your token
|
14
|
+
# campfire = Tinder::Campfire.new 'mysubdomain', :username => 'user', :password => 'pass'
|
15
|
+
# or if you have an OAuth token then you can use that to connect
|
16
|
+
# campfire = Tinder::Campfire.new 'mysubdomain', :oauth_token => '546884b3d8fee4d80665g561caf7h9f3ea7b999e'
|
17
|
+
|
18
|
+
room = campfire.rooms.first
|
19
|
+
room.rename 'New Room Names'
|
20
|
+
room.speak 'Hello world!'
|
21
|
+
room.paste "my pasted\ncode"
|
22
|
+
|
23
|
+
room = campfire.find_room_by_guest_hash 'abc123', 'John Doe'
|
24
|
+
room.speak 'Hello world!'
|
25
|
+
|
26
|
+
See the RDoc for more details.
|
27
|
+
|
28
|
+
## Installation
|
29
|
+
|
30
|
+
gem install tinder
|
31
|
+
|
32
|
+
## Contributions
|
33
|
+
|
34
|
+
Tinder is open source and contributions from the community are encouraged! No contribution is too small. Please consider:
|
35
|
+
|
36
|
+
* adding an awesome feature
|
37
|
+
* fixing a terrible bug
|
38
|
+
* updating documentation
|
39
|
+
* fixing a not-so-bad bug
|
40
|
+
* fixing typos
|
41
|
+
|
42
|
+
For the best chance of having your changes merged, please:
|
43
|
+
|
44
|
+
1. Ask us! We'd love to hear what you're up to.
|
45
|
+
2. Fork the project.
|
46
|
+
3. Commit your changes and tests (if applicable (they're applicable)).
|
47
|
+
4. Submit a pull request with a thorough explanation and at least one animated GIF.
|
data/Rakefile
CHANGED
@@ -1,65 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Jeweler::Tasks.new do |gem|
|
4
|
-
gem.name = "tinder"
|
5
|
-
gem.summary = "An (unofficial) Campfire API"
|
6
|
-
gem.description = "An API for interfacing with Campfire, the 37Signals chat application."
|
7
|
-
gem.authors = ['Brandon Keepers']
|
8
|
-
gem.email = 'brandon@opensoul.org'
|
9
|
-
gem.homepage = 'http://github.com/collectiveidea/tinder'
|
10
|
-
gem.rubyforge_project = "tinder"
|
11
|
-
gem.add_dependency "activesupport"
|
12
|
-
gem.add_dependency "httparty"
|
13
|
-
gem.add_dependency "mime-types"
|
14
|
-
gem.add_development_dependency "rspec"
|
15
|
-
end
|
16
|
-
Jeweler::GemcutterTasks.new
|
17
|
-
rescue LoadError
|
18
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
19
|
-
end
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
20
3
|
|
21
|
-
require '
|
22
|
-
|
23
|
-
|
24
|
-
test.pattern = 'test/**/*_test.rb'
|
25
|
-
test.verbose = true
|
26
|
-
end
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
desc 'Run the specs'
|
6
|
+
RSpec::Core::RakeTask.new
|
27
7
|
|
28
|
-
|
29
|
-
|
30
|
-
Rcov::RcovTask.new do |test|
|
31
|
-
test.libs << 'test'
|
32
|
-
test.pattern = 'test/**/*_test.rb'
|
33
|
-
test.verbose = true
|
34
|
-
end
|
35
|
-
rescue LoadError
|
36
|
-
task :rcov do
|
37
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
task :test => :check_dependencies
|
42
|
-
|
43
|
-
require 'rake/rdoctask'
|
44
|
-
Rake::RDocTask.new do |rdoc|
|
45
|
-
if File.exist?('VERSION')
|
46
|
-
version = File.read('VERSION')
|
47
|
-
else
|
48
|
-
version = ""
|
49
|
-
end
|
50
|
-
|
51
|
-
rdoc.rdoc_dir = 'rdoc'
|
52
|
-
rdoc.title = "tinder #{version}"
|
53
|
-
rdoc.rdoc_files.include('README*')
|
54
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
55
|
-
end
|
56
|
-
|
57
|
-
require 'spec/rake/spectask'
|
58
|
-
desc "Run the specs under spec"
|
59
|
-
Spec::Rake::SpecTask.new do |t|
|
60
|
-
t.spec_opts = ['--options', "spec/spec.opts"]
|
61
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
62
|
-
end
|
63
|
-
|
64
|
-
desc "Run tests"
|
65
|
-
task :default => [:spec, :test]
|
8
|
+
task :default => :spec
|
9
|
+
task :test => :spec
|
data/init.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require 'tinder'
|
1
|
+
require 'tinder'
|
data/lib/tinder/campfire.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
module Tinder
|
2
3
|
|
3
4
|
# == Usage
|
4
5
|
#
|
5
|
-
# campfire = Tinder::Campfire.new 'mysubdomain'
|
6
|
-
# campfire.login 'myemail@example.com', 'mypassword'
|
6
|
+
# campfire = Tinder::Campfire.new 'mysubdomain', :token => 'xyz'
|
7
7
|
#
|
8
8
|
# room = campfire.create_room 'New Room', 'My new campfire room to test tinder'
|
9
9
|
# room.speak 'Hello world!'
|
@@ -12,58 +12,44 @@ module Tinder
|
|
12
12
|
# room = campfire.find_room_by_guest_hash 'abc123', 'John Doe'
|
13
13
|
# room.speak 'Hello world!'
|
14
14
|
class Campfire
|
15
|
-
|
16
|
-
|
17
|
-
attr_reader :connection, :subdomain, :uri
|
15
|
+
attr_reader :connection
|
18
16
|
|
19
17
|
# Create a new connection to the campfire account with the given +subdomain+.
|
20
18
|
#
|
21
19
|
# == Options:
|
22
20
|
# * +:ssl+: use SSL for the connection, which is required if you have a Campfire SSL account.
|
23
|
-
# Defaults to
|
21
|
+
# Defaults to true
|
22
|
+
# * +:ssl_options+: SSL options passed to the underlaying Faraday connection. Allows to specify if the SSL certificate should be verified (:verify => true|false) and to specify the path to the ssl certs directory (:ca_path => "path/certs")
|
23
|
+
# Defaults to {:verify => true}
|
24
24
|
# * +:proxy+: a proxy URI. (e.g. :proxy => 'http://user:pass@example.com:8000')
|
25
25
|
#
|
26
26
|
# c = Tinder::Campfire.new("mysubdomain", :ssl => true)
|
27
27
|
def initialize(subdomain, options = {})
|
28
|
-
|
29
|
-
@connection = Connection.new
|
30
|
-
@cookie = nil
|
31
|
-
@subdomain = subdomain
|
32
|
-
@uri = URI.parse("#{options[:ssl] ? 'https' : 'http' }://#{subdomain}.#{HOST}")
|
33
|
-
connection.base_uri @uri.to_s
|
34
|
-
if options[:proxy]
|
35
|
-
uri = URI.parse(options[:proxy])
|
36
|
-
@http = Net::HTTP::Proxy(uri.host, uri.port, uri.user, uri.password)
|
37
|
-
else
|
38
|
-
@http = Net::HTTP
|
39
|
-
end
|
40
|
-
@logged_in = false
|
41
|
-
end
|
42
|
-
|
43
|
-
# Log in to campfire using your +email+ and +password+
|
44
|
-
def login(username, password)
|
45
|
-
connection.basic_auth(username, password)
|
46
|
-
@logged_in = true
|
47
|
-
end
|
48
|
-
|
49
|
-
# Returns true when successfully logged in
|
50
|
-
def logged_in?
|
51
|
-
@logged_in == true
|
52
|
-
end
|
53
|
-
|
54
|
-
def logout
|
55
|
-
connection.default_options.delete(:basic_auth)
|
56
|
-
@logged_in = false
|
28
|
+
@connection = Connection.new(subdomain, options)
|
57
29
|
end
|
58
30
|
|
59
31
|
# Get an array of all the available rooms
|
60
32
|
# TODO: detect rooms that are full (no link)
|
61
33
|
def rooms
|
62
34
|
connection.get('/rooms.json')['rooms'].map do |room|
|
63
|
-
Room.new(
|
35
|
+
Room.new(connection, room)
|
64
36
|
end
|
65
37
|
end
|
66
38
|
|
39
|
+
# Get an array of all rooms user is present in
|
40
|
+
def presence
|
41
|
+
connection.get('/presence.json')['rooms'].map do |room|
|
42
|
+
Room.new(connection, room)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Find a campfire room by id
|
47
|
+
# NOTE: id should be of type Integer
|
48
|
+
def find_room_by_id(id)
|
49
|
+
id = id.to_i
|
50
|
+
rooms.detect { |room| room.id == id }
|
51
|
+
end
|
52
|
+
|
67
53
|
# Find a campfire room by name
|
68
54
|
def find_room_by_name(name)
|
69
55
|
rooms.detect { |room| room.name == name }
|
@@ -76,7 +62,7 @@ module Tinder
|
|
76
62
|
|
77
63
|
# Creates and returns a new Room with the given +name+ and optionally a +topic+
|
78
64
|
def create_room(name, topic = nil)
|
79
|
-
connection.post('/rooms.json',
|
65
|
+
connection.post('/rooms.json', { :room => { :name => name, :topic => topic } })
|
80
66
|
find_room_by_name(name)
|
81
67
|
end
|
82
68
|
|
@@ -85,22 +71,13 @@ module Tinder
|
|
85
71
|
end
|
86
72
|
|
87
73
|
# List the users that are currently chatting in any room
|
88
|
-
def users
|
89
|
-
rooms.map(&:users).flatten.compact.uniq.
|
90
|
-
end
|
91
|
-
|
92
|
-
# Get the dates of the available transcripts by room
|
93
|
-
#
|
94
|
-
# campfire.available_transcripts
|
95
|
-
# #=> {"15840" => [#<Date: 4908311/2,0,2299161>, #<Date: 4908285/2,0,2299161>]}
|
96
|
-
#
|
97
|
-
def available_transcripts(room = nil)
|
98
|
-
raise NotImplementedError
|
74
|
+
def users
|
75
|
+
rooms.map(&:users).flatten.compact.uniq.sort_by {|u| u[:name]}
|
99
76
|
end
|
100
77
|
|
101
|
-
#
|
102
|
-
def
|
103
|
-
|
78
|
+
# get the user info of the current user
|
79
|
+
def me
|
80
|
+
connection.get("/users/me.json")["user"]
|
104
81
|
end
|
105
82
|
end
|
106
83
|
end
|
data/lib/tinder/connection.rb
CHANGED
@@ -1,21 +1,120 @@
|
|
1
|
-
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'faraday'
|
3
|
+
require 'faraday/request/multipart'
|
4
|
+
require 'faraday/response/raise_on_authentication_failure'
|
5
|
+
require 'faraday/response/remove_whitespace'
|
6
|
+
require 'faraday_middleware'
|
7
|
+
require 'json'
|
8
|
+
require 'uri'
|
9
|
+
|
10
|
+
class Faraday::RequestOptions
|
11
|
+
attr_accessor :preserve_raw
|
12
|
+
end
|
2
13
|
|
3
14
|
module Tinder
|
4
15
|
class Connection
|
5
|
-
|
6
|
-
|
7
|
-
|
16
|
+
HOST = 'campfirenow.com'
|
17
|
+
|
18
|
+
attr_reader :subdomain, :uri, :options
|
19
|
+
|
20
|
+
def self.connection
|
21
|
+
@connection ||= Faraday.new do |builder|
|
22
|
+
builder.use FaradayMiddleware::EncodeJson
|
23
|
+
builder.use FaradayMiddleware::Mashify
|
24
|
+
builder.use FaradayMiddleware::ParseJson
|
25
|
+
builder.use Faraday::Response::RemoveWhitespace
|
26
|
+
builder.use Faraday::Response::RaiseOnAuthenticationFailure
|
27
|
+
builder.adapter Faraday.default_adapter
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.raw_connection
|
32
|
+
@raw_connection ||= Faraday.new do |builder|
|
33
|
+
builder.use Faraday::Request::Multipart
|
34
|
+
builder.use FaradayMiddleware::Mashify
|
35
|
+
builder.use FaradayMiddleware::ParseJson
|
36
|
+
builder.use Faraday::Response::RemoveWhitespace
|
37
|
+
builder.use Faraday::Response::RaiseOnAuthenticationFailure
|
38
|
+
builder.adapter Faraday.default_adapter
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def initialize(subdomain, options = {})
|
43
|
+
@subdomain = subdomain
|
44
|
+
@options = {:ssl => true, :ssl_options => {:verify => true}, :proxy => ENV['HTTP_PROXY']}
|
45
|
+
@options[:ssl_options][:verify] = options.delete(:ssl_verify) unless options[:ssl_verify].nil?
|
46
|
+
@options.merge!(options)
|
47
|
+
@uri = URI.parse("#{@options[:ssl] ? 'https' : 'http' }://#{subdomain}.#{HOST}")
|
48
|
+
@token = options[:token]
|
49
|
+
@oauth_token = options[:oauth_token]
|
50
|
+
|
51
|
+
if @oauth_token
|
52
|
+
connection.headers["Authorization"] = "Bearer #{@oauth_token}"
|
53
|
+
raw_connection.headers["Authorization"] = "Bearer #{@oauth_token}"
|
54
|
+
else
|
55
|
+
connection.basic_auth token, 'X'
|
56
|
+
raw_connection.basic_auth token, 'X'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def basic_auth_settings
|
61
|
+
{:username => token, :password => 'X'}
|
62
|
+
end
|
8
63
|
|
9
|
-
|
64
|
+
def connection
|
65
|
+
@connection ||= begin
|
66
|
+
conn = self.class.connection.dup
|
67
|
+
set_connection_options(conn)
|
68
|
+
conn
|
10
69
|
end
|
11
70
|
end
|
12
71
|
|
13
|
-
def
|
14
|
-
|
72
|
+
def raw_connection
|
73
|
+
@raw_connection ||= begin
|
74
|
+
conn = self.class.raw_connection.dup
|
75
|
+
set_connection_options(conn)
|
76
|
+
conn
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def token
|
81
|
+
@token ||= begin
|
82
|
+
connection.basic_auth(options[:username], options[:password])
|
83
|
+
get('/users/me.json')['user']['api_auth_token']
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def get(url, *args)
|
88
|
+
response = connection.get(url, *args)
|
89
|
+
response.body
|
90
|
+
end
|
91
|
+
|
92
|
+
def post(url, body = nil, *args)
|
93
|
+
response = connection.post(url, body, *args)
|
94
|
+
response.body
|
15
95
|
end
|
16
96
|
|
17
|
-
def
|
18
|
-
|
97
|
+
def raw_post(url, body = nil, *args)
|
98
|
+
response = raw_connection.post(url, body, *args)
|
99
|
+
end
|
100
|
+
|
101
|
+
def put(url, body = nil, *args)
|
102
|
+
response = connection.put(url, body, *args)
|
103
|
+
response.body
|
104
|
+
end
|
105
|
+
|
106
|
+
# Is the connection to campfire using ssl?
|
107
|
+
def ssl?
|
108
|
+
uri.scheme == 'https'
|
109
|
+
end
|
110
|
+
|
111
|
+
private
|
112
|
+
def set_connection_options(conn)
|
113
|
+
conn.url_prefix = @uri.to_s
|
114
|
+
conn.proxy options[:proxy]
|
115
|
+
if options[:ssl_options]
|
116
|
+
conn.ssl.merge!(options[:ssl_options])
|
117
|
+
end
|
19
118
|
end
|
20
119
|
end
|
21
120
|
end
|