rbox 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,4 +1,3 @@
1
- .DS_Store
2
1
  *.gem
3
2
  *.rbc
4
3
  .bundle
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ rbox
2
+ ====
3
+
4
+ A Ruby wrapper for box.com API version 1.
5
+ (also known as box.net, now at box.com but just call me box its okay)
6
+
7
+ Featuring: my personal fight with Box api, resulting in viable wrapper with a test suite that passes and just the features I needed for what I had to do. Look at the client specs.
8
+
9
+ Synopsis
10
+ ========
11
+
12
+ ```ruby
13
+ option = { :api_token => 'unique-api-token' }
14
+ client = Rbox.new(options)
15
+
16
+ client.get_ticket
17
+ `open #{client.authorize_url}`
18
+ client.get_auth_token
19
+
20
+ account_tree = client.get_account_tree
21
+ root_folder = account_tree.root_folder
22
+
23
+ # Files
24
+ puts account_tree.files.map { |f| f.file_name }.join(', ')
25
+ ## Folders
26
+ puts account_tree.folders.map { |f| f.name }.join(', ')
27
+
28
+ ## Explore the tree
29
+ root_folder.folders.first.files.first.file_name
30
+ ...
31
+ ```
32
+
33
+ Why not v2?
34
+ ===========
35
+
36
+ Good question. I wish I heard of it before starting working on it. That being said, its not possible to work with box API v2 without v1.
37
+ You at least need to authenticate with v1, and v2 has missing features (in my case file sharing operations).
38
+
39
+
40
+ Pull request?
41
+ =============
42
+
43
+ Yes.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require 'rake/testtask'
4
+ Rake::TestTask.new do |t|
5
+ t.pattern = "spec/*_spec.rb"
6
+ end
7
+
8
+ task :default => 'test'
data/lib/rbox.rb CHANGED
@@ -5,6 +5,7 @@ require 'rbox/download'
5
5
  require 'rbox/item'
6
6
  # Client class
7
7
  require 'rbox/client'
8
+ require 'rbox/errors'
8
9
 
9
10
  # Utility methods modules
10
11
  require 'rbox/utils/collect_nested_key'
@@ -0,0 +1,4 @@
1
+ module Rbox
2
+ class FileNotFoundError < Exception; end
3
+ class ApplicationRestricted < Exception; end
4
+ end
data/lib/rbox/item.rb CHANGED
@@ -19,8 +19,15 @@ module Rbox
19
19
  req.params[:file_id] = file_id
20
20
  end
21
21
 
22
- response_file = response.body['response']['info']
23
- response_file['id'] = response_file['file_id']
22
+ case response.body['response']['status']
23
+ when 's_get_file_info'
24
+ response_file = response.body['response']['info']
25
+ response_file['id'] = response_file['file_id']
26
+ when 'not_logged_in', 'e_access_denied'
27
+ raise Rbox::FileNotFoundError
28
+ when 'application_restricted'
29
+ raise Rbox::ApplicationRestricted
30
+ end
24
31
 
25
32
  Response::File.new(response_file, self)
26
33
  end
data/rbox.gemspec CHANGED
@@ -13,5 +13,5 @@ Gem::Specification.new do |gem|
13
13
  gem.require_paths = ['lib']
14
14
  gem.summary = %q{box.com API wrapper}
15
15
  gem.test_files = `git ls-files -- {spec}/*`.split("\n")
16
- gem.version = '0.1.0'
16
+ gem.version = '0.1.1'
17
17
  end
@@ -0,0 +1,47 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ describe Rbox::Client do
4
+
5
+ before do
6
+ @options = { :api_token => 'unique-api-token', :auth_token => 'unique-auth-token' }
7
+ @client = Rbox.new(@options)
8
+ end
9
+
10
+ it "get ticket and generate authorize_url" do
11
+ VCR.use_cassette('tickets') do
12
+ @client.get_ticket
13
+ @client.authorize_url
14
+ end
15
+ end
16
+
17
+ it "get ticket and generate authorize_url" do
18
+ VCR.use_cassette('tickets') { @client.get_ticket }
19
+ assert_equal @client.authorize_url, 'https://www.box.net/api/1.0/auth/unique-secret-ticket'
20
+ end
21
+
22
+ it "get account informations" do
23
+ VCR.use_cassette('account_info') { @account_info = @client.get_account_info }
24
+ assert_kind_of Rbox::Response::GetAccountInfo, @account_info
25
+ user_info = { "login"=>"unixcharles@gmail.com", "email"=>"unixcharles@gmail.com", "access_id"=>"176951347", "user_id"=>"176951347", "space_amount"=>"5368709120", "space_used"=>"12205491", "max_upload_size"=>"104857600"}
26
+ assert_equal @account_info.user, user_info
27
+ end
28
+
29
+ it "get the account tree" do
30
+ VCR.use_cassette('account_tree') { @account_tree = @client.get_account_tree }
31
+ assert_kind_of Rbox::Response::AccountTree, @account_tree
32
+ assert_kind_of Rbox::Response::Folder, @account_tree.root_folder
33
+ end
34
+
35
+ it "get the file by id" do
36
+ VCR.use_cassette('file_info') { @file = @client.get_file_info(2104480929) }
37
+ assert_kind_of Rbox::Response::File, @file
38
+ assert_equal @file.file_name, 'IMG_0174.jpg'
39
+ end
40
+
41
+ it "enable public sharing on a file" do
42
+ VCR.use_cassette('public_share') do
43
+ @file = @client.get_file_info(2104480929)
44
+ assert_equal @file.public_share_url, 'https://www.box.net/s/b001ec95feb815091d70'
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,39 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.box.net/api/1.0/rest?action=get_account_info&api_key=unique-api-token&auth_token=unique-auth-token
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message:
14
+ headers:
15
+ server:
16
+ - nginx
17
+ date:
18
+ - Mon, 14 May 2012 11:48:56 GMT
19
+ content-type:
20
+ - text/xml
21
+ connection:
22
+ - close
23
+ set-cookie:
24
+ - z=jpg9i489a5gkdsddfhjid73je6; path=/; domain=.box.net; HttpOnly, box_visitor_id=4fb0f1282d3f69.21036989;
25
+ expires=Tue, 14-May-2013 11:48:56 GMT; path=/; domain=.box.net
26
+ expires:
27
+ - Thu, 19 Nov 1981 08:52:00 GMT
28
+ cache-control:
29
+ - cache, must-revalidate
30
+ pragma:
31
+ - public
32
+ content-length:
33
+ - '359'
34
+ body:
35
+ encoding: US-ASCII
36
+ string: ! "<?xml version='1.0' encoding='UTF-8' ?>\r\n<response><status>get_account_info_ok</status><user><login>unixcharles@gmail.com</login><email>unixcharles@gmail.com</email><access_id>176951347</access_id><user_id>176951347</user_id><space_amount>5368709120</space_amount><space_used>12205491</space_used><max_upload_size>104857600</max_upload_size></user></response>"
37
+ http_version:
38
+ recorded_at: Mon, 14 May 2012 11:48:56 GMT
39
+ recorded_with: VCR 2.1.1
@@ -0,0 +1,184 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.box.net/api/1.0/rest?action=get_account_tree&api_key=unique-api-token&auth_token=unique-auth-token&params%5B%5D%5B%5D=nozip&folder_id=0
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message:
14
+ headers:
15
+ server:
16
+ - nginx
17
+ date:
18
+ - Mon, 14 May 2012 11:56:17 GMT
19
+ content-type:
20
+ - text/xml
21
+ transfer-encoding:
22
+ - chunked
23
+ connection:
24
+ - close
25
+ set-cookie:
26
+ - z=pa553f9v0sm7vpvq0m5n3ou413; path=/; domain=.box.net; HttpOnly, box_visitor_id=4fb0f2e0ce3572.91188946;
27
+ expires=Tue, 14-May-2013 11:56:16 GMT; path=/; domain=.box.net
28
+ expires:
29
+ - Thu, 19 Nov 1981 08:52:00 GMT
30
+ cache-control:
31
+ - cache, must-revalidate
32
+ pragma:
33
+ - public
34
+ body:
35
+ encoding: ASCII-8BIT
36
+ string: ! "<?xml version='1.0' encoding='UTF-8' ?>\r\n<response><status>listing_ok</status><tree>UEsDBBQABAAIAAknrkD0fWiFYwgAABIuAAATABUAMzQybDF5Nmx0aS50cmVlLnhtbFVUCQAD4fKwT+HysE9VeAQAMAAwAO2aS28iSRLHvwrivpDvx6g9xxntYaSV+rBHK5822zYgCndb++n3X1VAZ+EyLqpwr7RaqdU2CMIRUfGLV+aXvHmKaTdbxbs5mc/W7jndzeezmKqwW233q826fvlSpd19/RGqlZWUCz2fVY9ul/DW8bf7p9X6W/1ym3bPq6rCV6u7edy8fMcnVv+GWMoYkcLS+SyvntJ92Lys9/UXwi65fSvqZRuPv/7+Ze8eqt+/LNsfrZ54XSjMlDaKWwaJreJ/NMZU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62AAoTAi4WdUOsfbMeZZqORZB6IvmUFUBPqjqYedU9kstiJgRa6+025idlvcKqieF2UGlyxBFcLRIEIdeJuE0V3O6dJMaI4rir4DCN4hIVTl9S4Dkbr6LDiQ2CD2WShTqYOj0xjmWoOk9i2BTboieGEr8ovk7UFy3usOLzsyafZEyIrK6M/4EURi2tb+BxglxRpLCvm+emTXt5Tuv94kfynW7ttC5B6bQmEAQK+jOlsxG4Q2cIxp8Ug7E0ZIpTw3wWW8zW59xnsdXcyVGnOznDJi2L/QPmZydttoGo5LNAZ/hZdbR1w+RSWoqZEIpvxIyMxlLOxCR3EHU5yX0bcnkMdRU3IeoYKYLyn8nXo0N/TLa9PVZ442KyLp60Pk4um7bTm4eK+svSXflMJmS8Usz/I625WF2HUz044EcxSfwHUEsBAhcDFAAEAAgACSeuQPR9aIVjCAAAEi4AABMADQAAAAAAAQAAAKSBAAAAADM0MmwxeTZsdGkudHJlZS54bWxVVAUAA+HysE9VeAAAUEsFBgAAAAABAAEATgAAAKkIAAAAAA==</tree></response>"
37
+ http_version:
38
+ recorded_at: Mon, 14 May 2012 11:56:18 GMT
39
+ - request:
40
+ method: get
41
+ uri: https://www.box.net/api/1.0/rest?action=get_account_tree&api_key=unique-api-token&auth_token=unique-auth-token&params%5B%5D=nozip&folder_id=0
42
+ body:
43
+ encoding: US-ASCII
44
+ string: ''
45
+ headers: {}
46
+ response:
47
+ status:
48
+ code: 200
49
+ message:
50
+ headers:
51
+ server:
52
+ - nginx
53
+ date:
54
+ - Mon, 14 May 2012 12:01:07 GMT
55
+ content-type:
56
+ - text/xml
57
+ transfer-encoding:
58
+ - chunked
59
+ connection:
60
+ - close
61
+ set-cookie:
62
+ - z=hcnocpi7hov9c4u480tmkbm5v6; path=/; domain=.box.net; HttpOnly, box_visitor_id=4fb0f402a5f212.48011704;
63
+ expires=Tue, 14-May-2013 12:01:06 GMT; path=/; domain=.box.net
64
+ expires:
65
+ - Thu, 19 Nov 1981 08:52:00 GMT
66
+ cache-control:
67
+ - cache, must-revalidate
68
+ pragma:
69
+ - public
70
+ body:
71
+ encoding: ASCII-8BIT
72
+ string: ! "<?xml version='1.0' encoding='UTF-8' ?>\r\n<response><status>listing_ok</status><tree><folder
73
+ id=\"0\" name=\"\" description=\"\" user_id=\"176951347\" shared=\"\" shared_link=\"\"
74
+ permissions=\"douv\" size=\"12205491\" file_count=\"\" created=\"\" updated=\"\"
75
+ ><tags></tags><folders><folder id=\"267863921\" name=\"Folders\" description=\"SF
76
+ pictures and screenshots\" user_id=\"176951347\" shared=\"0\" shared_link=\"\"
77
+ permissions=\"kcfgtedopnhsuv\" size=\"12199872\" file_count=\"9\" created=\"1335346603\"
78
+ updated=\"1335467075\" ><tags></tags><files><file id=\"2104476517\" file_name=\"Screen
79
+ Shot 2012-04-04 at 12.20.06 PM.png\" shared=\"0\" sha1=\"ee882ea8582314b7e1df2d6afbf13df96f4349c9\"
80
+ created=\"1335346618\" updated=\"1335346619\" size=\"49883\" shared_link=\"\"
81
+ description=\"\" user_id=\"176951347\" thumbnail=\"https://www.box.net/api/data/bf1007/public/120120221/small_thumb/2012-04-25/6b88f2c54611b7ce6cd5071cea70e273.gif\"
82
+ small_thumbnail=\"https://www.box.net/api/data/bf1007/public/120120221/small_thumb/2012-04-25/6b88f2c54611b7ce6cd5071cea70e273.gif\"
83
+ large_thumbnail=\"https://www.box.net/api/data/bf1007/public/120120221/large_thumb/2012-04-25/6b88f2c54611b7ce6cd5071cea70e273.jpg\"
84
+ larger_thumbnail=\"https://www.box.net/api/data/bf1007/public/120120221/larger_thumb/2012-04-25/6b88f2c54611b7ce6cd5071cea70e273.jpg\"
85
+ preview_thumbnail=\"https://www.box.net/api/data/bf1007/public/120120221/preview_thumb/2012-04-25/6b88f2c54611b7ce6cd5071cea70e273.jpg\"
86
+ permissions=\"gdcenopstuvh\" ><tags></tags></file><file id=\"2104476803\"
87
+ file_name=\"Screen Shot 2012-04-24 at 5.01.57 PM.png\" shared=\"1\" sha1=\"de6024da64929d6856b8a99540f0d0307f4fa9f7\"
88
+ created=\"1335346624\" updated=\"1336755495\" size=\"17021\" shared_link=\"https://www.box.net/s/d298fa7d224ed7ece178\"
89
+ description=\"\" user_id=\"176951347\" thumbnail=\"https://www.box.net/api/data/bf2011/public/120120202/small_thumb/2012-04-25/fba76a6f01d6afc824f149747c616a54.gif\"
90
+ small_thumbnail=\"https://www.box.net/api/data/bf2011/public/120120202/small_thumb/2012-04-25/fba76a6f01d6afc824f149747c616a54.gif\"
91
+ large_thumbnail=\"https://www.box.net/api/data/bf2011/public/120120202/large_thumb/2012-04-25/fba76a6f01d6afc824f149747c616a54.jpg\"
92
+ larger_thumbnail=\"https://www.box.net/api/data/bf2011/public/120120202/larger_thumb/2012-04-25/fba76a6f01d6afc824f149747c616a54.jpg\"
93
+ preview_thumbnail=\"https://www.box.net/api/data/bf2011/public/120120202/preview_thumb/2012-04-25/fba76a6f01d6afc824f149747c616a54.jpg\"
94
+ permissions=\"gdcenopstuvh\" ><tags></tags></file><file id=\"2104478953\"
95
+ file_name=\"IMG_0173.jpg\" shared=\"1\" sha1=\"561e4f35fc9f178d4076d75de1317b717e4ee38f\"
96
+ created=\"1335346661\" updated=\"1336752784\" size=\"1897234\" shared_link=\"https://www.box.net/s/2e00f86bb4ebb9cd5130\"
97
+ description=\"\" user_id=\"176951347\" thumbnail=\"https://www.box.net/api/data/bf1008/public/120120222/small_thumb/2012-04-25/e060f53b5c7323c2550494517c448690.gif\"
98
+ small_thumbnail=\"https://www.box.net/api/data/bf1008/public/120120222/small_thumb/2012-04-25/e060f53b5c7323c2550494517c448690.gif\"
99
+ large_thumbnail=\"https://www.box.net/api/data/bf1008/public/120120222/large_thumb/2012-04-25/e060f53b5c7323c2550494517c448690.jpg\"
100
+ larger_thumbnail=\"https://www.box.net/api/data/bf1008/public/120120222/larger_thumb/2012-04-25/e060f53b5c7323c2550494517c448690.jpg\"
101
+ preview_thumbnail=\"https://www.box.net/api/data/bf1008/public/120120222/preview_thumb/2012-04-25/e060f53b5c7323c2550494517c448690.jpg\"
102
+ permissions=\"gdcenopstuvh\" ><tags></tags></file><file id=\"2104480929\"
103
+ file_name=\"IMG_0174.jpg\" shared=\"1\" sha1=\"0de671d8bb73b1112dd913ea5e33b713479689a4\"
104
+ created=\"1335346691\" updated=\"1335365586\" size=\"2028241\" shared_link=\"https://www.box.net/s/b001ec95feb815091d70\"
105
+ description=\"\" user_id=\"176951347\" thumbnail=\"https://www.box.net/api/data/bf2012/public/120120126/small_thumb/2012-04-25/cd4bb39fbb49b5ad8f051aab2bbad62b.gif\"
106
+ small_thumbnail=\"https://www.box.net/api/data/bf2012/public/120120126/small_thumb/2012-04-25/cd4bb39fbb49b5ad8f051aab2bbad62b.gif\"
107
+ large_thumbnail=\"https://www.box.net/api/data/bf2012/public/120120126/large_thumb/2012-04-25/cd4bb39fbb49b5ad8f051aab2bbad62b.jpg\"
108
+ larger_thumbnail=\"https://www.box.net/api/data/bf2012/public/120120126/larger_thumb/2012-04-25/cd4bb39fbb49b5ad8f051aab2bbad62b.jpg\"
109
+ preview_thumbnail=\"https://www.box.net/api/data/bf2012/public/120120126/preview_thumb/2012-04-25/cd4bb39fbb49b5ad8f051aab2bbad62b.jpg\"
110
+ permissions=\"gdcenopstuvh\" ><tags></tags></file><file id=\"2104483307\"
111
+ file_name=\"IMG_0175.jpg\" shared=\"0\" sha1=\"d6f626c8ef12818744d0e144929203028343f37e\"
112
+ created=\"1335346726\" updated=\"1335346738\" size=\"2038614\" shared_link=\"\"
113
+ description=\"\" user_id=\"176951347\" thumbnail=\"https://www.box.net/api/data/bf1007/public/120120221/small_thumb/2012-04-25/b776f9810b5bb5cd2fc965ad4e8232bf.gif\"
114
+ small_thumbnail=\"https://www.box.net/api/data/bf1007/public/120120221/small_thumb/2012-04-25/b776f9810b5bb5cd2fc965ad4e8232bf.gif\"
115
+ large_thumbnail=\"https://www.box.net/api/data/bf1007/public/120120221/large_thumb/2012-04-25/b776f9810b5bb5cd2fc965ad4e8232bf.jpg\"
116
+ larger_thumbnail=\"https://www.box.net/api/data/bf1007/public/120120221/larger_thumb/2012-04-25/b776f9810b5bb5cd2fc965ad4e8232bf.jpg\"
117
+ preview_thumbnail=\"https://www.box.net/api/data/bf1007/public/120120221/preview_thumb/2012-04-25/b776f9810b5bb5cd2fc965ad4e8232bf.jpg\"
118
+ permissions=\"gdcenopstuvh\" ><tags></tags></file><file id=\"2104486111\"
119
+ file_name=\"IMG_0176.jpg\" shared=\"0\" sha1=\"a1ee54882db52271c8e1c38bf2120c66968d280e\"
120
+ created=\"1335346766\" updated=\"1335346779\" size=\"2121162\" shared_link=\"\"
121
+ description=\"\" user_id=\"176951347\" thumbnail=\"https://www.box.net/api/data/bf2011/public/120120202/small_thumb/2012-04-25/909df8dc70c833c72d668fcda456fc97.gif\"
122
+ small_thumbnail=\"https://www.box.net/api/data/bf2011/public/120120202/small_thumb/2012-04-25/909df8dc70c833c72d668fcda456fc97.gif\"
123
+ large_thumbnail=\"https://www.box.net/api/data/bf2011/public/120120202/large_thumb/2012-04-25/909df8dc70c833c72d668fcda456fc97.jpg\"
124
+ larger_thumbnail=\"https://www.box.net/api/data/bf2011/public/120120202/larger_thumb/2012-04-25/909df8dc70c833c72d668fcda456fc97.jpg\"
125
+ preview_thumbnail=\"https://www.box.net/api/data/bf2011/public/120120202/preview_thumb/2012-04-25/909df8dc70c833c72d668fcda456fc97.jpg\"
126
+ permissions=\"gdcenopstuvh\" ><tags></tags></file><file id=\"2104488123\"
127
+ file_name=\"IMG_0177.jpg\" shared=\"1\" sha1=\"899739a11a94d25a37b73f4879ee0ffe5801a603\"
128
+ created=\"1335346796\" updated=\"1336753212\" size=\"2093723\" shared_link=\"https://www.box.net/s/405608c9660a0b06bcbc\"
129
+ description=\"\" user_id=\"176951347\" thumbnail=\"https://www.box.net/api/data/bf1008/public/120120222/small_thumb/2012-04-25/33314f2f644873f6614980f543235f16.gif\"
130
+ small_thumbnail=\"https://www.box.net/api/data/bf1008/public/120120222/small_thumb/2012-04-25/33314f2f644873f6614980f543235f16.gif\"
131
+ large_thumbnail=\"https://www.box.net/api/data/bf1008/public/120120222/large_thumb/2012-04-25/33314f2f644873f6614980f543235f16.jpg\"
132
+ larger_thumbnail=\"https://www.box.net/api/data/bf1008/public/120120222/larger_thumb/2012-04-25/33314f2f644873f6614980f543235f16.jpg\"
133
+ preview_thumbnail=\"https://www.box.net/api/data/bf1008/public/120120222/preview_thumb/2012-04-25/33314f2f644873f6614980f543235f16.jpg\"
134
+ permissions=\"gdcenopstuvh\" ><tags></tags></file><file id=\"2104492027\"
135
+ file_name=\"IMG_0178.jpg\" shared=\"1\" sha1=\"34805dd1e47fa31093b7fd0fe8477b02a5b460e5\"
136
+ created=\"1335346852\" updated=\"1335365603\" size=\"1952504\" shared_link=\"https://www.box.net/s/cb43cb91ef550696177c\"
137
+ description=\"\" user_id=\"176951347\" thumbnail=\"https://www.box.net/api/data/bf2011/public/120120202/small_thumb/2012-04-25/35123216b38aed80cb5c54f1e6065547.gif\"
138
+ small_thumbnail=\"https://www.box.net/api/data/bf2011/public/120120202/small_thumb/2012-04-25/35123216b38aed80cb5c54f1e6065547.gif\"
139
+ large_thumbnail=\"https://www.box.net/api/data/bf2011/public/120120202/large_thumb/2012-04-25/35123216b38aed80cb5c54f1e6065547.jpg\"
140
+ larger_thumbnail=\"https://www.box.net/api/data/bf2011/public/120120202/larger_thumb/2012-04-25/35123216b38aed80cb5c54f1e6065547.jpg\"
141
+ preview_thumbnail=\"https://www.box.net/api/data/bf2011/public/120120202/preview_thumb/2012-04-25/35123216b38aed80cb5c54f1e6065547.jpg\"
142
+ permissions=\"gdcenopstuvh\" ><tags></tags></file><file id=\"2114830567\"
143
+ file_name=\"Google doc.gdoc\" shared=\"0\" sha1=\"ab81d1a4d636995bc280cfed9d816e51bf9bc0ea\"
144
+ created=\"1335462535\" updated=\"1335462536\" size=\"1490\" shared_link=\"\"
145
+ description=\"\" user_id=\"176951347\" thumbnail=\"https://www.box.net/api/thumbs/27x30/text/gdoc.gif\"
146
+ small_thumbnail=\"https://www.box.net/api/thumbs/27x30/text/gdoc.gif\" large_thumbnail=\"https://www.box.net/api/thumbs/43x51/text/gdoc.gif\"
147
+ larger_thumbnail=\"https://www.box.net/api/thumbs/43x51/text/gdoc.gif\" preview_thumbnail=\"https://www.box.net/api/thumbs/242x286/text/gdoc.png\"
148
+ permissions=\"gdcenopstuvh\" ><tags></tags></file></files></folder></folders><files><file
149
+ id=\"2104474269\" file_name=\"flight_confirm_mars_2012.txt\" shared=\"0\"
150
+ sha1=\"194e96d4d50f56ca76ff0d267d0806fdbc717833\" created=\"1335346583\" updated=\"1335346583\"
151
+ size=\"1498\" shared_link=\"\" description=\"\" user_id=\"176951347\" thumbnail=\"https://www.box.net/api/thumbs/27x30/text/txt.gif\"
152
+ small_thumbnail=\"https://www.box.net/api/thumbs/27x30/text/txt.gif\" large_thumbnail=\"https://www.box.net/api/thumbs/43x51/text/txt.gif\"
153
+ larger_thumbnail=\"https://www.box.net/api/thumbs/43x51/text/txt.gif\" preview_thumbnail=\"https://www.box.net/api/thumbs/242x286/text/txt.png\"
154
+ permissions=\"gdcenopstuvh\" ><tags></tags></file><file id=\"2184550975\"
155
+ file_name=\"Google spreadsheet.gsheet\" shared=\"0\" sha1=\"25606cc8ee141c5dde5741bf0d31817aa6778e6e\"
156
+ created=\"1336405220\" updated=\"1336405221\" size=\"4096\" shared_link=\"\"
157
+ description=\"\" user_id=\"176951347\" thumbnail=\"https://www.box.net/api/thumbs/27x30/text/gsheet.gif\"
158
+ small_thumbnail=\"https://www.box.net/api/thumbs/27x30/text/gsheet.gif\" large_thumbnail=\"https://www.box.net/api/thumbs/43x51/text/gsheet.gif\"
159
+ larger_thumbnail=\"https://www.box.net/api/thumbs/43x51/text/gsheet.gif\"
160
+ preview_thumbnail=\"https://www.box.net/api/thumbs/242x286/text/gsheet.png\"
161
+ permissions=\"gdcenopstuvh\" ><tags></tags></file><file id=\"2098840097\"
162
+ file_name=\"oscar.txt\" shared=\"0\" sha1=\"2063d7ea532210365ec3ff8b6da9a406c4622c20\"
163
+ created=\"1335282163\" updated=\"1335283903\" size=\"17\" shared_link=\"\"
164
+ description=\"\" user_id=\"176951347\" thumbnail=\"https://www.box.net/api/thumbs/27x30/text/txt.gif\"
165
+ small_thumbnail=\"https://www.box.net/api/thumbs/27x30/text/txt.gif\" large_thumbnail=\"https://www.box.net/api/thumbs/43x51/text/txt.gif\"
166
+ larger_thumbnail=\"https://www.box.net/api/thumbs/43x51/text/txt.gif\" preview_thumbnail=\"https://www.box.net/api/thumbs/242x286/text/txt.png\"
167
+ permissions=\"gdcenopstuvh\" ><tags></tags></file><file id=\"1914670306\"
168
+ file_name=\"Some document.webdoc\" shared=\"1\" sha1=\"01298c01639d867f841df8043cedc891cf11d8f0\"
169
+ created=\"1332950493\" updated=\"1336755465\" size=\"4\" shared_link=\"https://www.box.net/s/9235100a59f9c06ebf4a\"
170
+ description=\"\" user_id=\"176951347\" thumbnail=\"https://www.box.net/api/thumbs/27x30/text/webdoc.gif\"
171
+ small_thumbnail=\"https://www.box.net/api/thumbs/27x30/text/webdoc.gif\" large_thumbnail=\"https://www.box.net/api/thumbs/43x51/text/webdoc.gif\"
172
+ larger_thumbnail=\"https://www.box.net/api/thumbs/43x51/text/webdoc.gif\"
173
+ preview_thumbnail=\"https://www.box.net/api/thumbs/242x286/text/webdoc.png\"
174
+ permissions=\"gdcenopstuvhk\" ><tags></tags></file><file id=\"2184549493\"
175
+ file_name=\"Web document.webdoc\" shared=\"0\" sha1=\"01298c01639d867f841df8043cedc891cf11d8f0\"
176
+ created=\"1336405170\" updated=\"1336405170\" size=\"4\" shared_link=\"\"
177
+ description=\"\" user_id=\"176951347\" thumbnail=\"https://www.box.net/api/thumbs/27x30/text/webdoc.gif\"
178
+ small_thumbnail=\"https://www.box.net/api/thumbs/27x30/text/webdoc.gif\" large_thumbnail=\"https://www.box.net/api/thumbs/43x51/text/webdoc.gif\"
179
+ larger_thumbnail=\"https://www.box.net/api/thumbs/43x51/text/webdoc.gif\"
180
+ preview_thumbnail=\"https://www.box.net/api/thumbs/242x286/text/webdoc.png\"
181
+ permissions=\"gdcenopstuvhk\" ><tags></tags></file></files></folder></tree></response>"
182
+ http_version:
183
+ recorded_at: Mon, 14 May 2012 12:01:07 GMT
184
+ recorded_with: VCR 2.1.1
@@ -0,0 +1,39 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.box.net/api/1.0/rest?action=get_file_info&api_key=unique-api-token&auth_token=unique-auth-token&file_id=2104480929
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message:
14
+ headers:
15
+ server:
16
+ - nginx
17
+ date:
18
+ - Mon, 14 May 2012 12:05:12 GMT
19
+ content-type:
20
+ - text/xml
21
+ connection:
22
+ - close
23
+ set-cookie:
24
+ - z=0nkmrdoqtlg244fcve80sah321; path=/; domain=.box.net; HttpOnly, box_visitor_id=4fb0f4f81594c8.23012991;
25
+ expires=Tue, 14-May-2013 12:05:12 GMT; path=/; domain=.box.net
26
+ expires:
27
+ - Thu, 19 Nov 1981 08:52:00 GMT
28
+ cache-control:
29
+ - cache, must-revalidate
30
+ pragma:
31
+ - public
32
+ content-length:
33
+ - '413'
34
+ body:
35
+ encoding: US-ASCII
36
+ string: ! "<?xml version='1.0' encoding='UTF-8' ?>\r\n<response><status>s_get_file_info</status><info><file_id>2104480929</file_id><file_name>IMG_0174.jpg</file_name><folder_id>267863921</folder_id><shared>1</shared><shared_name>b001ec95feb815091d70</shared_name><size>2028241</size><description/><sha1>0de671d8bb73b1112dd913ea5e33b713479689a4</sha1><created>1335346691</created><updated>1335365586</updated></info></response>"
37
+ http_version:
38
+ recorded_at: Mon, 14 May 2012 12:05:12 GMT
39
+ recorded_with: VCR 2.1.1
@@ -0,0 +1,75 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.box.net/api/1.0/rest?action=get_file_info&api_key=unique-api-token&auth_token=unique-auth-token&file_id=2104480929
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message:
14
+ headers:
15
+ server:
16
+ - nginx
17
+ date:
18
+ - Mon, 14 May 2012 13:07:34 GMT
19
+ content-type:
20
+ - text/xml
21
+ connection:
22
+ - close
23
+ set-cookie:
24
+ - z=foklvcbcuvmi8t499od5me13f3; path=/; domain=.box.net; HttpOnly, box_visitor_id=4fb103968c13c0.28870160;
25
+ expires=Tue, 14-May-2013 13:07:34 GMT; path=/; domain=.box.net
26
+ expires:
27
+ - Thu, 19 Nov 1981 08:52:00 GMT
28
+ cache-control:
29
+ - cache, must-revalidate
30
+ pragma:
31
+ - public
32
+ content-length:
33
+ - '413'
34
+ body:
35
+ encoding: US-ASCII
36
+ string: ! "<?xml version='1.0' encoding='UTF-8' ?>\r\n<response><status>s_get_file_info</status><info><file_id>2104480929</file_id><file_name>IMG_0174.jpg</file_name><folder_id>267863921</folder_id><shared>1</shared><shared_name>b001ec95feb815091d70</shared_name><size>2028241</size><description/><sha1>0de671d8bb73b1112dd913ea5e33b713479689a4</sha1><created>1335346691</created><updated>1335365586</updated></info></response>"
37
+ http_version:
38
+ recorded_at: Mon, 14 May 2012 13:07:35 GMT
39
+ - request:
40
+ method: get
41
+ uri: https://www.box.net/api/1.0/rest?action=public_share&api_key=unique-api-token&auth_token=unique-auth-token&target=file&target_id=2104480929&password=&message=&emails%5B%5D=
42
+ body:
43
+ encoding: US-ASCII
44
+ string: ''
45
+ headers: {}
46
+ response:
47
+ status:
48
+ code: 200
49
+ message:
50
+ headers:
51
+ server:
52
+ - nginx
53
+ date:
54
+ - Mon, 14 May 2012 13:09:19 GMT
55
+ content-type:
56
+ - text/xml
57
+ connection:
58
+ - close
59
+ set-cookie:
60
+ - z=g0irunu8hbfmrv2rj1pv7t4ss3; path=/; domain=.box.net; HttpOnly, box_visitor_id=4fb103ff2ee435.03913030;
61
+ expires=Tue, 14-May-2013 13:09:19 GMT; path=/; domain=.box.net
62
+ expires:
63
+ - Thu, 19 Nov 1981 08:52:00 GMT
64
+ cache-control:
65
+ - cache, must-revalidate
66
+ pragma:
67
+ - public
68
+ content-length:
69
+ - '134'
70
+ body:
71
+ encoding: US-ASCII
72
+ string: ! "<?xml version='1.0' encoding='UTF-8' ?>\r\n<response><status>share_ok</status><public_name>b001ec95feb815091d70</public_name></response>"
73
+ http_version:
74
+ recorded_at: Mon, 14 May 2012 13:09:19 GMT
75
+ recorded_with: VCR 2.1.1
@@ -0,0 +1,75 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.box.net/api/1.0/rest?action=get_ticket&api_key=unique-api-token&auth_token=unique-auth-token
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message:
14
+ headers:
15
+ server:
16
+ - nginx
17
+ date:
18
+ - Mon, 14 May 2012 11:25:42 GMT
19
+ content-type:
20
+ - text/xml
21
+ connection:
22
+ - close
23
+ set-cookie:
24
+ - z=l2foploo02tig3dhcb1nl28n41; path=/; domain=.box.net; HttpOnly, box_visitor_id=4fb0ebb6170450.10620016;
25
+ expires=Tue, 14-May-2013 11:25:42 GMT; path=/; domain=.box.net
26
+ expires:
27
+ - Thu, 19 Nov 1981 08:52:00 GMT
28
+ cache-control:
29
+ - cache, must-revalidate
30
+ pragma:
31
+ - public
32
+ content-length:
33
+ - '141'
34
+ body:
35
+ encoding: US-ASCII
36
+ string: ! "<?xml version='1.0' encoding='UTF-8' ?>\r\n<response><status>get_ticket_ok</status><ticket>unique-secret-ticket</ticket></response>"
37
+ http_version:
38
+ recorded_at: Mon, 14 May 2012 11:25:42 GMT
39
+ - request:
40
+ method: get
41
+ uri: https://www.box.net/api/1.0/rest?action=get_account_info&api_key=unique-api-token&auth_token=unique-auth-token
42
+ body:
43
+ encoding: US-ASCII
44
+ string: ''
45
+ headers: {}
46
+ response:
47
+ status:
48
+ code: 200
49
+ message:
50
+ headers:
51
+ server:
52
+ - nginx
53
+ date:
54
+ - Mon, 14 May 2012 11:31:21 GMT
55
+ content-type:
56
+ - text/xml
57
+ connection:
58
+ - close
59
+ set-cookie:
60
+ - z=6ln24qcpq1jt0a9j2dvne18a92; path=/; domain=.box.net; HttpOnly, box_visitor_id=4fb0ed09231f97.11346879;
61
+ expires=Tue, 14-May-2013 11:31:21 GMT; path=/; domain=.box.net
62
+ expires:
63
+ - Thu, 19 Nov 1981 08:52:00 GMT
64
+ cache-control:
65
+ - cache, must-revalidate
66
+ pragma:
67
+ - public
68
+ content-length:
69
+ - '359'
70
+ body:
71
+ encoding: US-ASCII
72
+ string: ! "<?xml version='1.0' encoding='UTF-8' ?>\r\n<response><status>get_account_info_ok</status><user><login>unixcharles@gmail.com</login><email>unixcharles@gmail.com</email><access_id>176951347</access_id><user_id>176951347</user_id><space_amount>5368709120</space_amount><space_used>12205491</space_used><max_upload_size>104857600</max_upload_size></user></response>"
73
+ http_version:
74
+ recorded_at: Mon, 14 May 2012 11:31:21 GMT
75
+ recorded_with: VCR 2.1.1
@@ -0,0 +1,10 @@
1
+ require File.expand_path('../../lib/rbox', __FILE__)
2
+
3
+ require 'minitest/autorun'
4
+ require 'vcr'
5
+
6
+ VCR.configure do |config|
7
+ config.cassette_library_dir = 'spec/fixtures'
8
+ config.default_cassette_options = { :record => :once }
9
+ config.hook_into :faraday
10
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-14 00:00:00.000000000 Z
12
+ date: 2012-06-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
16
- requirement: &70133377507860 !ruby/object:Gem::Requirement
16
+ requirement: &70346553594380 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.7'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70133377507860
24
+ version_requirements: *70346553594380
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: multi_xml
27
- requirement: &70133377507360 !ruby/object:Gem::Requirement
27
+ requirement: &70346553593460 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 0.4.1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70133377507360
35
+ version_requirements: *70346553593460
36
36
  description: A Ruby wrapper for box.com
37
37
  email:
38
38
  - unixcharles@gmail.com
@@ -43,11 +43,14 @@ files:
43
43
  - .gitignore
44
44
  - Gemfile
45
45
  - Gemfile.lock
46
+ - README.md
47
+ - Rakefile
46
48
  - lib/rbox.rb
47
49
  - lib/rbox/authentication.rb
48
50
  - lib/rbox/client.rb
49
51
  - lib/rbox/connection.rb
50
52
  - lib/rbox/download.rb
53
+ - lib/rbox/errors.rb
51
54
  - lib/rbox/item.rb
52
55
  - lib/rbox/response/authentication/auth_token.rb
53
56
  - lib/rbox/response/authentication/get_account_info.rb
@@ -61,6 +64,13 @@ files:
61
64
  - lib/rbox/response/items/folder.rb
62
65
  - lib/rbox/utils/collect_nested_key.rb
63
66
  - rbox.gemspec
67
+ - spec/client_spec.rb
68
+ - spec/fixtures/account_info.yml
69
+ - spec/fixtures/account_tree.yml
70
+ - spec/fixtures/file_info.yml
71
+ - spec/fixtures/public_share.yml
72
+ - spec/fixtures/tickets.yml
73
+ - spec/spec_helper.rb
64
74
  homepage: https://github.com/unixcharles/rbox
65
75
  licenses: []
66
76
  post_install_message: