boxnet 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/boxnet/version.rb +1 -1
- data/lib/boxnet.rb +3 -1
- data/lib/result.rb +3 -1
- data/lib/ticket.rb +15 -0
- data/spec/boxnet_spec.rb +4 -2
- data/spec/get_auth_token_spec.rb +15 -0
- data/spec/get_ticket_spec.rb +10 -0
- metadata +7 -2
data/lib/boxnet/version.rb
CHANGED
data/lib/boxnet.rb
CHANGED
@@ -5,6 +5,7 @@ require 'file_node'
|
|
5
5
|
require 'file_tree'
|
6
6
|
require 'folder'
|
7
7
|
require 'file'
|
8
|
+
require 'ticket'
|
8
9
|
|
9
10
|
module Boxnet
|
10
11
|
class Client
|
@@ -17,7 +18,8 @@ module Boxnet
|
|
17
18
|
end
|
18
19
|
|
19
20
|
def self.get_ticket
|
20
|
-
get(@@URL + "?api_key=#{@@API_KEY}&action=get_ticket")
|
21
|
+
data = get(@@URL + "?api_key=#{@@API_KEY}&action=get_ticket")
|
22
|
+
Ticket.new(data)
|
21
23
|
end
|
22
24
|
|
23
25
|
def self.get_auth_url_for_ticket(ticket)
|
data/lib/result.rb
CHANGED
data/lib/ticket.rb
ADDED
data/spec/boxnet_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe Boxnet do
|
|
8
8
|
describe "get ticket" do
|
9
9
|
context "no API key" do
|
10
10
|
before(:each) do
|
11
|
-
Boxnet.API_KEY = ""
|
11
|
+
Boxnet::Client.API_KEY = ""
|
12
12
|
@result = Boxnet::Client.get_ticket
|
13
13
|
end
|
14
14
|
it { @result.should_not be_nil }
|
@@ -17,7 +17,7 @@ describe Boxnet do
|
|
17
17
|
|
18
18
|
context "invalid API key" do
|
19
19
|
before(:each) do
|
20
|
-
Boxnet.API_KEY = "bad_api_key"
|
20
|
+
Boxnet::Client.API_KEY = "bad_api_key"
|
21
21
|
@result = Boxnet::Client.get_ticket
|
22
22
|
end
|
23
23
|
it { @result.should_not be_nil }
|
@@ -27,6 +27,8 @@ describe Boxnet do
|
|
27
27
|
context "valid API key" do
|
28
28
|
before(:each) do
|
29
29
|
@result = Boxnet::Client.get_ticket
|
30
|
+
puts "ticket"
|
31
|
+
puts @result.inspect
|
30
32
|
end
|
31
33
|
it { @result.should_not be_nil }
|
32
34
|
it { @result["response"]["status"].should == "get_ticket_ok" }
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "get account tree" do
|
4
|
+
context "valid ticket" do
|
5
|
+
before(:each) do
|
6
|
+
Boxnet::Client.API_KEY = "m4o9591n3z2k41gks0gr69mayvfbg6gz"
|
7
|
+
ticket = "1csa8hpmko9z838m7s76qbqrmrv0bk0q"
|
8
|
+
@result = Boxnet::Client.get_auth_token(ticket)
|
9
|
+
end
|
10
|
+
it { @result.should_not be_nil }
|
11
|
+
it { @result["response"]["status"].should == "get_auth_token_ok" }
|
12
|
+
it { @result["response"]["auth_token"].should_not be_nil }
|
13
|
+
it { @result["response"]["user"].should_not be_nil }
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: boxnet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jonathan Birkholz
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-11-
|
13
|
+
date: 2011-11-21 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -67,8 +67,11 @@ files:
|
|
67
67
|
- lib/file_tree.rb
|
68
68
|
- lib/folder.rb
|
69
69
|
- lib/result.rb
|
70
|
+
- lib/ticket.rb
|
70
71
|
- spec/boxnet_spec.rb
|
71
72
|
- spec/get_account_file_tree_spec.rb
|
73
|
+
- spec/get_auth_token_spec.rb
|
74
|
+
- spec/get_ticket_spec.rb
|
72
75
|
- spec/spec_helper.rb
|
73
76
|
homepage: ""
|
74
77
|
licenses: []
|
@@ -100,4 +103,6 @@ summary: Ruby gem for Box.net REST Api
|
|
100
103
|
test_files:
|
101
104
|
- spec/boxnet_spec.rb
|
102
105
|
- spec/get_account_file_tree_spec.rb
|
106
|
+
- spec/get_auth_token_spec.rb
|
107
|
+
- spec/get_ticket_spec.rb
|
103
108
|
- spec/spec_helper.rb
|