joinme-api 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- joinme-api (0.0.4)
4
+ joinme-api (0.0.5)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -38,14 +38,14 @@ GEM
38
38
  method_source (~> 0.8)
39
39
  slop (~> 3.3.1)
40
40
  rb-fsevent (0.9.2)
41
- rspec (2.11.0)
42
- rspec-core (~> 2.11.0)
43
- rspec-expectations (~> 2.11.0)
44
- rspec-mocks (~> 2.11.0)
45
- rspec-core (2.11.1)
46
- rspec-expectations (2.11.3)
41
+ rspec (2.12.0)
42
+ rspec-core (~> 2.12.0)
43
+ rspec-expectations (~> 2.12.0)
44
+ rspec-mocks (~> 2.12.0)
45
+ rspec-core (2.12.0)
46
+ rspec-expectations (2.12.0)
47
47
  diff-lcs (~> 1.1.3)
48
- rspec-mocks (2.11.3)
48
+ rspec-mocks (2.12.0)
49
49
  slop (3.3.3)
50
50
  thor (0.16.0)
51
51
  webmock (1.8.11)
@@ -63,5 +63,5 @@ DEPENDENCIES
63
63
  guard-rspec (~> 2.1.0)
64
64
  joinme-api!
65
65
  rb-fsevent (~> 0.9.2)
66
- rspec (~> 2.11.0)
66
+ rspec (= 2.12.0)
67
67
  webmock (~> 1.8.11)
data/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ The MIT License (MIT)
2
+ Copyright (c) 2011 Paul Hepworth
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+
6
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -7,25 +7,15 @@ A ruby gem that is a simple wrapper for the join.me API
7
7
 
8
8
  ### Create an Instance ###
9
9
 
10
- session = JoinmeApi.new('myemail@gmail.com', 'mypassword')
10
+ session = Joinme::Session.new 'myemail@gmail.com', 'mypassword'
11
11
 
12
- ### Login ###
12
+ ### Presenter URL ###
13
13
 
14
- session.login
14
+ session.presenter_url
15
15
 
16
- ### Request an Auth Code ###
16
+ ### Participant URL ###
17
17
 
18
- session.request_auth_code
19
-
20
- ### Request an Meeting Code ###
21
-
22
- session.request_code
23
-
24
-
25
- ### Generate a Download URL for a Meeting ###
26
-
27
- session.download
28
- session.download_url
18
+ session.participant_url
29
19
 
30
20
  ## Official Join.Me Documentation ##
31
21
 
@@ -1,14 +1,21 @@
1
+ require './lib/joinme-api/version'
2
+
1
3
  Gem::Specification.new do |s|
2
- s.name = 'joinme-api'
3
- s.author = 'Paul Hepworth'
4
- s.email = 'paul<dot>hepworth<at>peppyheppy<dot>com'
5
- s.version = '0.0.4'
4
+ s.name = 'joinme-api'
5
+ s.version = Joinme::VERSION
6
+ s.authors = ['Paul Hepworth', 'Ryan Montgomery']
7
+ s.email = ['paul<dot>hepworth<at>peppyheppy<dot>com', 'rmontgomery429<at>gmail<dot>com']
8
+ s.description = "A simple library for communicating with the join.me API (https://secure.join.me/welcome/webhelp/joinme/join.me/c_joinme_API.html)"
9
+ s.summary = "A simple library for communicating with the join.me API"
6
10
  s.homepage = 'https://github.com/peppyheppy/joinme-api'
7
- s.date = '2012-10-29'
8
- s.summary = "A gem that provides a basic wrapper for the join.me API"
9
- s.description = "A gem that provides a basic wrapper for the join.me API (https://secure.join.me/welcome/webhelp/joinme/join.me/c_joinme_API.html)"
10
- s.files = s.files = `git ls-files`.split("\n")
11
- s.add_development_dependency 'rspec', '~>2.11.0'
11
+ s.license = 'MIT'
12
+
13
+ s.platform = Gem::Platform::RUBY
14
+ s.require_paths = %w[lib]
15
+ s.files = s.files = `git ls-files`.split("\n")
16
+ s.test_files = Dir['spec/**/*.rb']
17
+
18
+ s.add_development_dependency 'rspec', '2.12.0'
12
19
  s.add_development_dependency 'debugger'
13
20
  s.add_development_dependency 'rb-fsevent', '~>0.9.2'
14
21
  s.add_development_dependency 'guard', '~>1.5.2'
@@ -16,5 +23,8 @@ Gem::Specification.new do |s|
16
23
  s.add_development_dependency 'guard-rspec', '~>2.1.0'
17
24
  s.add_development_dependency 'growl', '~>1.0.3'
18
25
  s.add_development_dependency 'webmock', '~>1.8.11'
26
+
27
+ s.extra_rdoc_files = ['README.md', 'LICENSE']
28
+ s.rdoc_options = ['--line-numbers', '--inline-source', '--title', 'joinme-api', '--main', 'README.md']
19
29
  end
20
30
 
@@ -1,67 +1,10 @@
1
1
  require 'uri'
2
2
  require 'net/http'
3
3
 
4
- class JoinmeApi
5
- attr_accessor :email, :password
4
+ require 'joinme-api/version'
5
+ require 'joinme-api/api_request'
6
+ require 'joinme-api/download'
7
+ require 'joinme-api/request_auth_code'
8
+ require 'joinme-api/request_code'
9
+ require 'joinme-api/session'
6
10
 
7
- def initialize(email, password)
8
- @email = email
9
- @password = password
10
- end
11
-
12
- def login
13
- api_call('login', 'email' => email, 'password' => password) == 'OK'
14
- end
15
-
16
- def request_auth_code
17
- parts = api_call('requestAuthCode', 'email' => email, 'password' => password).split("\n")
18
- if parts.first == 'OK'
19
- parts.last.split(': ').last
20
- end
21
- end
22
-
23
- def request_code(auth_code = request_auth_code)
24
- codes = code_and_ticket(auth_code)
25
- codes['code']
26
- end
27
-
28
- def download(code=nil, ticket=nil)
29
- codes = {}
30
- if code and ticket
31
- codes['code'] = code
32
- codes['ticket'] = ticket
33
- else
34
- codes = code_and_ticket
35
- end
36
-
37
- if codes['code'] and codes['ticket']
38
- "https://secure.join.me/download.aspx?webdownload=true&code=%s&ticket=%s" % [codes['code'], codes['ticket']]
39
- end
40
- end
41
- alias :download_url :download
42
-
43
- private
44
-
45
- def code_and_ticket(auth_code = request_auth_code)
46
- parts = api_call('requestCode', 'authcode' => auth_code).split("\n")
47
- params = {}
48
- if parts.first == 'OK'
49
- parts.each do |param|
50
- key, value = param.split(': ')
51
- params[key.downcase] = value
52
- end
53
- end
54
- params
55
- end
56
-
57
- def api_call(call, params)
58
- uri = URI("https://secure.join.me/API/#{call}")
59
- req = Net::HTTP::Post.new(uri.path)
60
- req.set_form_data(params)
61
- res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
62
- http.request(req)
63
- end
64
- res.body.to_s
65
- end
66
-
67
- end
@@ -0,0 +1,13 @@
1
+ class Joinme::APIRequest
2
+
3
+ def api_call(call, params)
4
+ uri = URI("https://secure.join.me/API/#{call}")
5
+ req = Net::HTTP::Post.new(uri.path)
6
+ req.set_form_data(params)
7
+ res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
8
+ http.request(req)
9
+ end
10
+ res.body.to_s
11
+ end
12
+
13
+ end
@@ -0,0 +1,12 @@
1
+ class Joinme::Download
2
+
3
+ def initialize code, ticket
4
+ @code = code
5
+ @ticket = ticket
6
+ end
7
+
8
+ def url
9
+ "https://secure.join.me/download.aspx?code=#{@code}&ticket=#{@ticket}&webdownload=true"
10
+ end
11
+
12
+ end
@@ -0,0 +1,20 @@
1
+ class Joinme::RequestAuthCode < Joinme::APIRequest
2
+
3
+ attr_reader :auth_code
4
+
5
+ def initialize email, password
6
+ @email = email
7
+ @password = password
8
+ invoke!
9
+ end
10
+
11
+ private
12
+
13
+ def invoke!
14
+ parts = api_call('requestAuthCode', 'email' => @email, 'password' => @password).split("\n")
15
+ if parts.first == 'OK'
16
+ @auth_code = parts.last.split(': ').last
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,29 @@
1
+ class Joinme::RequestCode < Joinme::APIRequest
2
+
3
+ def initialize auth_code
4
+ @auth_code = auth_code
5
+ @params = {}
6
+ invoke!
7
+ end
8
+
9
+ def code
10
+ @params['code'] || ""
11
+ end
12
+
13
+ def ticket
14
+ @params['ticket'] || ""
15
+ end
16
+
17
+ private
18
+
19
+ def invoke!
20
+ parts = api_call('requestCode', 'authcode' => @auth_code).split("\n")
21
+ if parts.first == 'OK'
22
+ parts.each do |param|
23
+ key, value = param.split(': ')
24
+ @params[key.downcase] = value
25
+ end
26
+ end
27
+ end
28
+
29
+ end
@@ -0,0 +1,26 @@
1
+ class Joinme::Session
2
+
3
+ def initialize email, password
4
+ @email = email
5
+ @password = password
6
+ end
7
+
8
+ def presenter_url
9
+ Joinme::Download.new(request_code.code, request_code.ticket).url
10
+ end
11
+
12
+ def participant_url
13
+ "http://join.me/#{request_code.code}"
14
+ end
15
+
16
+ private
17
+
18
+ def request_code
19
+ @request_code ||= Joinme::RequestCode.new request_auth_code.auth_code
20
+ end
21
+
22
+ def request_auth_code
23
+ @request_auth_code ||= Joinme::RequestAuthCode.new @email, @password
24
+ end
25
+
26
+ end
@@ -0,0 +1,3 @@
1
+ module Joinme
2
+ VERSION = '0.0.5'
3
+ end
@@ -1,140 +1,140 @@
1
- require 'spec_helper'
2
-
3
- describe JoinmeApi do
4
- before :each do
5
- @api = JoinmeApi.new('p@z.com','qawsed')
6
- end
7
-
8
- describe "#new" do
9
- it "should require email and password" do
10
- expect {
11
- JoinmeApi.new
12
- }.to raise_error(ArgumentError)
13
- end
14
- end
15
-
16
- describe "#login" do
17
- it "should hit the login api" do
18
- stub_request(:post, "https://secure.join.me/API/login")
19
- .with(:body => {"email"=>"p@z.com", "password"=>"qawsed"})
20
- .to_return(:status => 200, :body => "OK")
21
-
22
- @api.login.should be_true
23
- end
24
-
25
- it "should handle errors" do
26
- stub_request(:post, "https://secure.join.me/API/login")
27
- .with(:body => {"email"=>"p@z.com", "password"=>"qawsed"})
28
- .to_return(:status => 200, :body => "ERROR: 4; Invalid email or password")
29
-
30
- @api.login.should be_false
31
- end
32
- end
33
-
34
- describe "#request_auth_code" do
35
- it "should return an auth code" do
36
- stub_request(:post, "https://secure.join.me/API/requestAuthCode")
37
- .with(:body => {"email"=>"p@z.com", "password"=>"qawsed"})
38
- .to_return(:status => 200, :body => "OK\nAUTHCODE: usbzlurwujpw2xbfy1xc2cjiuovaankw")
39
-
40
- @api.request_auth_code.should == 'usbzlurwujpw2xbfy1xc2cjiuovaankw'
41
- end
42
-
43
- it "should handle errors" do
44
- stub_request(:post, "https://secure.join.me/API/requestAuthCode")
45
- .with(:body => {"email"=>"p@z.com", "password"=>"qawsed"})
46
- .to_return(:status => 200, :body => "ERROR: 4; Invalid email or password")
47
-
48
- @api.request_auth_code.should be_nil
49
- end
50
- end
51
-
52
- describe "#request_code" do
53
- it "should return an meeting and ticket codes" do
54
- # stub the request auth code call
55
- stub_request(:post, "https://secure.join.me/API/requestAuthCode")
56
- .with(:body => {"email"=>"p@z.com", "password"=>"qawsed"})
57
- .to_return(:status => 200, :body => "OK\nAUTHCODE: usbzlurwujpw2xbfy1xc2cjiuovaankw")
58
-
59
- # stub the request meeting code
60
- stub_request(:post, "https://secure.join.me/API/requestCode")
61
- .with(:body => {"authcode"=>"usbzlurwujpw2xbfy1xc2cjiuovaankw"})
62
- .to_return(:status => 200, :body => "OK\nCODE: 101494581\nTICKET: 432412671")
63
-
64
- @api.request_code.should == '101494581'
65
- end
66
-
67
- it "should handle errors" do
68
- # stub the request auth code call
69
- stub_request(:post, "https://secure.join.me/API/requestAuthCode")
70
- .with(:body => {"email"=>"p@z.com", "password"=>"qawsed"})
71
- .to_return(:status => 200, :body => "OK\nAUTHCODE: usbzlurwujpw2xbfy1xc2cjiuovaankw")
72
-
73
- stub_request(:post, "https://secure.join.me/API/requestCode")
74
- .with(:body => {"authcode"=>"usbzlurwujpw2xbfy1xc2cjiuovaankw"})
75
- .to_return(:status => 200, :body => "ERROR: 4; Invalid email or password")
76
-
77
- @api.request_code.should be_nil
78
- end
79
-
80
- it "should accept the request code as a parameter" do
81
- stub_request(:post, "https://secure.join.me/API/requestCode")
82
- .with(:body => {"authcode"=>"usbzlurwujpw2xbfy1xc2cjiuovaankw"})
83
- .to_return(:status => 200, :body => "ERROR: 4; Invalid email or password")
84
-
85
- @api.request_code('usbzlurwujpw2xbfy1xc2cjiuovaankw').should be_nil
86
- end
87
- end
88
-
89
- describe "#download and #download_url" do
90
- it "should return the download url" do
91
- # stub the request meeting code
92
- stub_request(:post, "https://secure.join.me/API/requestCode")
93
- .with(:body => {"authcode"=>"usbzlurwujpw2xbfy1xc2cjiuovaankw"})
94
- .to_return(:status => 200, :body => "OK\nCODE: 101494581\nTICKET: 432412671")
95
-
96
- url = "https://secure.join.me/download.aspx?webdownload=true&code=101494588&ticket=432412675"
97
- @api.download('101494588','432412675').should == url
98
- @api.download_url('101494588','432412675').should == url
99
- end
100
-
101
- it "should return the download url" do
102
- # stub the request meeting code
103
- stub_request(:post, "https://secure.join.me/API/requestCode")
104
- .with(:body => {"authcode"=>"usbzlurwujpw2xbfy1xc2cjiuovaankw"})
105
- .to_return(:status => 200, :body => "OK\nCODE: 101494581\nTICKET: 432412671")
106
-
107
- url = "https://secure.join.me/download.aspx?webdownload=true&code=101494588&ticket=432412675"
108
- @api.download('101494588','432412675').should == url
109
- end
110
-
111
- it "should return the download url" do
112
- # stub the request auth code call
113
- stub_request(:post, "https://secure.join.me/API/requestAuthCode")
114
- .with(:body => {"email"=>"p@z.com", "password"=>"qawsed"})
115
- .to_return(:status => 200, :body => "OK\nAUTHCODE: usbzlurwujpw2xbfy1xc2cjiuovaankw")
116
-
117
- # stub the request meeting code
118
- stub_request(:post, "https://secure.join.me/API/requestCode")
119
- .with(:body => {"authcode"=>"usbzlurwujpw2xbfy1xc2cjiuovaankw"})
120
- .to_return(:status => 200, :body => "OK\nCODE: 101494588\nTICKET: 432412675")
121
-
122
- url = "https://secure.join.me/download.aspx?webdownload=true&code=101494588&ticket=432412675"
123
- @api.download.should == url
124
- end
125
-
126
- it "should handle errors" do
127
- # stub the request auth code call
128
- stub_request(:post, "https://secure.join.me/API/requestAuthCode")
129
- .with(:body => {"email"=>"p@z.com", "password"=>"qawsed"})
130
- .to_return(:status => 200, :body => "OK\nAUTHCODE: usbzlurwujpw2xbfy1xc2cjiuovaankw")
131
-
132
- # stub the request meeting code
133
- stub_request(:post, "https://secure.join.me/API/requestCode")
134
- .with(:body => {"authcode"=>"usbzlurwujpw2xbfy1xc2cjiuovaankw"})
135
- .to_return(:status => 200, :body => "ERROR: 4; Invalid email or password")
136
-
137
- @api.download_url.should be_nil
138
- end
139
- end
140
- end
1
+ # require 'spec_helper'
2
+
3
+ # describe JoinmeApi do
4
+ # before :each do
5
+ # @api = JoinmeApi.new('p@z.com','qawsed')
6
+ # end
7
+
8
+ # describe "#new" do
9
+ # it "should require email and password" do
10
+ # expect {
11
+ # JoinmeApi.new
12
+ # }.to raise_error(ArgumentError)
13
+ # end
14
+ # end
15
+
16
+ # describe "#login" do
17
+ # it "should hit the login api" do
18
+ # stub_request(:post, "https://secure.join.me/API/login")
19
+ # .with(:body => {"email"=>"p@z.com", "password"=>"qawsed"})
20
+ # .to_return(:status => 200, :body => "OK")
21
+
22
+ # @api.login.should be_true
23
+ # end
24
+
25
+ # it "should handle errors" do
26
+ # stub_request(:post, "https://secure.join.me/API/login")
27
+ # .with(:body => {"email"=>"p@z.com", "password"=>"qawsed"})
28
+ # .to_return(:status => 200, :body => "ERROR: 4; Invalid email or password")
29
+
30
+ # @api.login.should be_false
31
+ # end
32
+ # end
33
+
34
+ # describe "#request_auth_code" do
35
+ # it "should return an auth code" do
36
+ # stub_request(:post, "https://secure.join.me/API/requestAuthCode")
37
+ # .with(:body => {"email"=>"p@z.com", "password"=>"qawsed"})
38
+ # .to_return(:status => 200, :body => "OK\nAUTHCODE: usbzlurwujpw2xbfy1xc2cjiuovaankw")
39
+
40
+ # @api.request_auth_code.should == 'usbzlurwujpw2xbfy1xc2cjiuovaankw'
41
+ # end
42
+
43
+ # it "should handle errors" do
44
+ # stub_request(:post, "https://secure.join.me/API/requestAuthCode")
45
+ # .with(:body => {"email"=>"p@z.com", "password"=>"qawsed"})
46
+ # .to_return(:status => 200, :body => "ERROR: 4; Invalid email or password")
47
+
48
+ # @api.request_auth_code.should be_nil
49
+ # end
50
+ # end
51
+
52
+ # describe "#request_code" do
53
+ # it "should return an meeting and ticket codes" do
54
+ # # stub the request auth code call
55
+ # stub_request(:post, "https://secure.join.me/API/requestAuthCode")
56
+ # .with(:body => {"email"=>"p@z.com", "password"=>"qawsed"})
57
+ # .to_return(:status => 200, :body => "OK\nAUTHCODE: usbzlurwujpw2xbfy1xc2cjiuovaankw")
58
+
59
+ # # stub the request meeting code
60
+ # stub_request(:post, "https://secure.join.me/API/requestCode")
61
+ # .with(:body => {"authcode"=>"usbzlurwujpw2xbfy1xc2cjiuovaankw"})
62
+ # .to_return(:status => 200, :body => "OK\nCODE: 101494581\nTICKET: 432412671")
63
+
64
+ # @api.request_code.should == '101494581'
65
+ # end
66
+
67
+ # it "should handle errors" do
68
+ # # stub the request auth code call
69
+ # stub_request(:post, "https://secure.join.me/API/requestAuthCode")
70
+ # .with(:body => {"email"=>"p@z.com", "password"=>"qawsed"})
71
+ # .to_return(:status => 200, :body => "OK\nAUTHCODE: usbzlurwujpw2xbfy1xc2cjiuovaankw")
72
+
73
+ # stub_request(:post, "https://secure.join.me/API/requestCode")
74
+ # .with(:body => {"authcode"=>"usbzlurwujpw2xbfy1xc2cjiuovaankw"})
75
+ # .to_return(:status => 200, :body => "ERROR: 4; Invalid email or password")
76
+
77
+ # @api.request_code.should be_nil
78
+ # end
79
+
80
+ # it "should accept the request code as a parameter" do
81
+ # stub_request(:post, "https://secure.join.me/API/requestCode")
82
+ # .with(:body => {"authcode"=>"usbzlurwujpw2xbfy1xc2cjiuovaankw"})
83
+ # .to_return(:status => 200, :body => "ERROR: 4; Invalid email or password")
84
+
85
+ # @api.request_code('usbzlurwujpw2xbfy1xc2cjiuovaankw').should be_nil
86
+ # end
87
+ # end
88
+
89
+ # describe "#download and #download_url" do
90
+ # it "should return the download url" do
91
+ # # stub the request meeting code
92
+ # stub_request(:post, "https://secure.join.me/API/requestCode")
93
+ # .with(:body => {"authcode"=>"usbzlurwujpw2xbfy1xc2cjiuovaankw"})
94
+ # .to_return(:status => 200, :body => "OK\nCODE: 101494581\nTICKET: 432412671")
95
+
96
+ # url = "https://secure.join.me/download.aspx?webdownload=true&code=101494588&ticket=432412675"
97
+ # @api.download('101494588','432412675').should == url
98
+ # @api.download_url('101494588','432412675').should == url
99
+ # end
100
+
101
+ # it "should return the download url" do
102
+ # # stub the request meeting code
103
+ # stub_request(:post, "https://secure.join.me/API/requestCode")
104
+ # .with(:body => {"authcode"=>"usbzlurwujpw2xbfy1xc2cjiuovaankw"})
105
+ # .to_return(:status => 200, :body => "OK\nCODE: 101494581\nTICKET: 432412671")
106
+
107
+ # url = "https://secure.join.me/download.aspx?webdownload=true&code=101494588&ticket=432412675"
108
+ # @api.download('101494588','432412675').should == url
109
+ # end
110
+
111
+ # it "should return the download url" do
112
+ # # stub the request auth code call
113
+ # stub_request(:post, "https://secure.join.me/API/requestAuthCode")
114
+ # .with(:body => {"email"=>"p@z.com", "password"=>"qawsed"})
115
+ # .to_return(:status => 200, :body => "OK\nAUTHCODE: usbzlurwujpw2xbfy1xc2cjiuovaankw")
116
+
117
+ # # stub the request meeting code
118
+ # stub_request(:post, "https://secure.join.me/API/requestCode")
119
+ # .with(:body => {"authcode"=>"usbzlurwujpw2xbfy1xc2cjiuovaankw"})
120
+ # .to_return(:status => 200, :body => "OK\nCODE: 101494588\nTICKET: 432412675")
121
+
122
+ # url = "https://secure.join.me/download.aspx?webdownload=true&code=101494588&ticket=432412675"
123
+ # @api.download.should == url
124
+ # end
125
+
126
+ # it "should handle errors" do
127
+ # # stub the request auth code call
128
+ # stub_request(:post, "https://secure.join.me/API/requestAuthCode")
129
+ # .with(:body => {"email"=>"p@z.com", "password"=>"qawsed"})
130
+ # .to_return(:status => 200, :body => "OK\nAUTHCODE: usbzlurwujpw2xbfy1xc2cjiuovaankw")
131
+
132
+ # # stub the request meeting code
133
+ # stub_request(:post, "https://secure.join.me/API/requestCode")
134
+ # .with(:body => {"authcode"=>"usbzlurwujpw2xbfy1xc2cjiuovaankw"})
135
+ # .to_return(:status => 200, :body => "ERROR: 4; Invalid email or password")
136
+
137
+ # @api.download_url.should be_nil
138
+ # end
139
+ # end
140
+ # end
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ describe Joinme::Session do
4
+
5
+ let(:auth_code) { "abc123def456" }
6
+ let(:code) { "123456789" }
7
+ let(:email) { "ryan@ryan.com" }
8
+ let(:password) { "password" }
9
+ let(:ticket) { "123098456765" }
10
+ let(:session) { Joinme::Session.new email, password }
11
+
12
+ context "a new session" do
13
+
14
+ before do
15
+ stub_request(:post, "https://secure.join.me/API/requestAuthCode")
16
+ .with(body: { email: email, password: password })
17
+ .to_return(status: 200, body: "OK\nAUTHCODE: #{auth_code}")
18
+
19
+ stub_request(:post, "https://secure.join.me/API/requestCode")
20
+ .with(body: { authcode: auth_code })
21
+ .to_return(status: 200, body: "OK\nCODE: #{code}\nTICKET: #{ticket}")
22
+ end
23
+
24
+ describe "#presenter_url" do
25
+ it "should return the download url for the unique session" do
26
+ session.presenter_url.should eq("https://secure.join.me/download.aspx?code=#{code}&ticket=#{ticket}&webdownload=true")
27
+ end
28
+ end
29
+
30
+ describe "#participant_url" do
31
+ it "should return the join.me url for the participant to join online" do
32
+ session.participant_url.should eq("http://join.me/#{code}")
33
+ end
34
+ end
35
+
36
+ end
37
+
38
+ end
@@ -1,6 +1,6 @@
1
- require "rubygems"
2
- require "bundler/setup"
3
- require "joinme-api"
1
+ require 'rubygems'
2
+ require 'joinme-api'
3
+ require 'bundler/setup'
4
4
  require 'webmock/rspec'
5
5
 
6
6
  RSpec.configure do |config|
metadata CHANGED
@@ -1,30 +1,31 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: joinme-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Paul Hepworth
9
+ - Ryan Montgomery
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2012-10-29 00:00:00.000000000 Z
13
+ date: 2012-11-30 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: rspec
16
- requirement: &70352910873980 !ruby/object:Gem::Requirement
17
+ requirement: &70240662904420 !ruby/object:Gem::Requirement
17
18
  none: false
18
19
  requirements:
19
- - - ~>
20
+ - - =
20
21
  - !ruby/object:Gem::Version
21
- version: 2.11.0
22
+ version: 2.12.0
22
23
  type: :development
23
24
  prerelease: false
24
- version_requirements: *70352910873980
25
+ version_requirements: *70240662904420
25
26
  - !ruby/object:Gem::Dependency
26
27
  name: debugger
27
- requirement: &70352910873300 !ruby/object:Gem::Requirement
28
+ requirement: &70240662903880 !ruby/object:Gem::Requirement
28
29
  none: false
29
30
  requirements:
30
31
  - - ! '>='
@@ -32,10 +33,10 @@ dependencies:
32
33
  version: '0'
33
34
  type: :development
34
35
  prerelease: false
35
- version_requirements: *70352910873300
36
+ version_requirements: *70240662903880
36
37
  - !ruby/object:Gem::Dependency
37
38
  name: rb-fsevent
38
- requirement: &70352910872240 !ruby/object:Gem::Requirement
39
+ requirement: &70240662902380 !ruby/object:Gem::Requirement
39
40
  none: false
40
41
  requirements:
41
42
  - - ~>
@@ -43,10 +44,10 @@ dependencies:
43
44
  version: 0.9.2
44
45
  type: :development
45
46
  prerelease: false
46
- version_requirements: *70352910872240
47
+ version_requirements: *70240662902380
47
48
  - !ruby/object:Gem::Dependency
48
49
  name: guard
49
- requirement: &70352910871280 !ruby/object:Gem::Requirement
50
+ requirement: &70240662901720 !ruby/object:Gem::Requirement
50
51
  none: false
51
52
  requirements:
52
53
  - - ~>
@@ -54,10 +55,10 @@ dependencies:
54
55
  version: 1.5.2
55
56
  type: :development
56
57
  prerelease: false
57
- version_requirements: *70352910871280
58
+ version_requirements: *70240662901720
58
59
  - !ruby/object:Gem::Dependency
59
60
  name: guard-bundler
60
- requirement: &70352910870620 !ruby/object:Gem::Requirement
61
+ requirement: &70240662901100 !ruby/object:Gem::Requirement
61
62
  none: false
62
63
  requirements:
63
64
  - - ~>
@@ -65,10 +66,10 @@ dependencies:
65
66
  version: 1.0.0
66
67
  type: :development
67
68
  prerelease: false
68
- version_requirements: *70352910870620
69
+ version_requirements: *70240662901100
69
70
  - !ruby/object:Gem::Dependency
70
71
  name: guard-rspec
71
- requirement: &70352910869520 !ruby/object:Gem::Requirement
72
+ requirement: &70240662900420 !ruby/object:Gem::Requirement
72
73
  none: false
73
74
  requirements:
74
75
  - - ~>
@@ -76,10 +77,10 @@ dependencies:
76
77
  version: 2.1.0
77
78
  type: :development
78
79
  prerelease: false
79
- version_requirements: *70352910869520
80
+ version_requirements: *70240662900420
80
81
  - !ruby/object:Gem::Dependency
81
82
  name: growl
82
- requirement: &70352910868580 !ruby/object:Gem::Requirement
83
+ requirement: &70240662899760 !ruby/object:Gem::Requirement
83
84
  none: false
84
85
  requirements:
85
86
  - - ~>
@@ -87,10 +88,10 @@ dependencies:
87
88
  version: 1.0.3
88
89
  type: :development
89
90
  prerelease: false
90
- version_requirements: *70352910868580
91
+ version_requirements: *70240662899760
91
92
  - !ruby/object:Gem::Dependency
92
93
  name: webmock
93
- requirement: &70352910867900 !ruby/object:Gem::Requirement
94
+ requirement: &70240662899100 !ruby/object:Gem::Requirement
94
95
  none: false
95
96
  requirements:
96
97
  - - ~>
@@ -98,12 +99,16 @@ dependencies:
98
99
  version: 1.8.11
99
100
  type: :development
100
101
  prerelease: false
101
- version_requirements: *70352910867900
102
- description: A gem that provides a basic wrapper for the join.me API (https://secure.join.me/welcome/webhelp/joinme/join.me/c_joinme_API.html)
103
- email: paul<dot>hepworth<at>peppyheppy<dot>com
102
+ version_requirements: *70240662899100
103
+ description: A simple library for communicating with the join.me API (https://secure.join.me/welcome/webhelp/joinme/join.me/c_joinme_API.html)
104
+ email:
105
+ - paul<dot>hepworth<at>peppyheppy<dot>com
106
+ - rmontgomery429<at>gmail<dot>com
104
107
  executables: []
105
108
  extensions: []
106
- extra_rdoc_files: []
109
+ extra_rdoc_files:
110
+ - README.md
111
+ - LICENSE
107
112
  files:
108
113
  - .gitignore
109
114
  - .rspec
@@ -111,16 +116,31 @@ files:
111
116
  - Gemfile
112
117
  - Gemfile.lock
113
118
  - Guardfile
119
+ - LICENSE
114
120
  - README.md
115
121
  - Rakefile
116
122
  - joinme-api.gemspec
117
123
  - lib/joinme-api.rb
124
+ - lib/joinme-api/api_request.rb
125
+ - lib/joinme-api/download.rb
126
+ - lib/joinme-api/request_auth_code.rb
127
+ - lib/joinme-api/request_code.rb
128
+ - lib/joinme-api/session.rb
129
+ - lib/joinme-api/version.rb
118
130
  - spec/lib/joinme_api_spec.rb
131
+ - spec/lib/session_spec.rb
119
132
  - spec/spec_helper.rb
120
133
  homepage: https://github.com/peppyheppy/joinme-api
121
- licenses: []
134
+ licenses:
135
+ - MIT
122
136
  post_install_message:
123
- rdoc_options: []
137
+ rdoc_options:
138
+ - --line-numbers
139
+ - --inline-source
140
+ - --title
141
+ - joinme-api
142
+ - --main
143
+ - README.md
124
144
  require_paths:
125
145
  - lib
126
146
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -140,5 +160,8 @@ rubyforge_project:
140
160
  rubygems_version: 1.8.17
141
161
  signing_key:
142
162
  specification_version: 3
143
- summary: A gem that provides a basic wrapper for the join.me API
144
- test_files: []
163
+ summary: A simple library for communicating with the join.me API
164
+ test_files:
165
+ - spec/lib/joinme_api_spec.rb
166
+ - spec/lib/session_spec.rb
167
+ - spec/spec_helper.rb