ruby-box 1.10.2 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OWYwMGMxNjFiZjdjZGMwNjA2OGRhZWQwZDhmNjViNDJmMjM5NWEwZg==
4
+ MTU1NDgxZjE2ZTljMmUxNTRjOTAwZjBjNmNkOWYwZjQ1MWRkNjQ1MA==
5
5
  data.tar.gz: !binary |-
6
- YzQ5MWRmMzczN2ZjMGIzMTdhNmU3NjI5NzI4MGEwZGM3YzYxMDMyZA==
6
+ NTI3YzY2NGRkZGZkYzIyYTAzMjM1Y2YxMWFmY2ZlN2QyOTdmNzk4Yw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OWY1NzBiNmZmNWQ0MGUyY2JlNjQwYTA2YzVmMmZlYTQyYmYyMzAwNTE1Mjli
10
- YzdkMzY2NDk3MjcwNzk5MGE2NzRhNzkwNTJmYjdkNDM2ZmI4YjdmNWM2MTM5
11
- ZmU5MzViNjM5NmE3YmE5ODk4OWNiM2NjYmQ3ODlkMTZiYmJjMjQ=
9
+ NTdiOGEyNjhjNDJhMjk0Y2JhY2MwYzVlMDU2MGUwZDA0MjhiNTA5NzZlNTFi
10
+ OTlkMmQxODlmYmJiMDRlNDNmMmQ5NzA1MTQzYTQyOWY5MzkxNmUyZWQ3MDFm
11
+ NjJjMmJjODM1MDk1YmViMmQyNGYzZWM2ZTA5MDZlNjZkY2VkZmI=
12
12
  data.tar.gz: !binary |-
13
- OTQxMzE5YTk3NWRhY2IwMGIxYTA3ZTlkMjJmNDM2YzkxYjhlZWYwZWU4ODY3
14
- OGIzYTZhMjIwY2RlYjMzNzRjOWU4NDRkZTQwOGYwYmEzZTZkMDkwNjgxODQw
15
- YTExZmUxNDU3NjdiY2RiNGQ5NTg3YWVjZmU4MDUwMmNmNjVmMTk=
13
+ ODQ2ODhhYzJhZGEwYjE4NGE5MjBiNzdjYzA0ZjcwYTQwNTk3NjYyNGI2MDZm
14
+ NTliNDJmZDQ0Yzg2NjFkNjVjZjc5YzA2NjkzZTliYjRiM2FmMDk1MWJhMWFk
15
+ ZTY4YzBhYzEyNDAxZGIwMDcxN2ViODQ4NWJlZDgyMmMwYTcxYzk=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.10.2
1
+ 1.11.0
@@ -29,6 +29,16 @@ module RubyBox
29
29
  folder.files(file_name).first if folder
30
30
  end
31
31
 
32
+ def item(path)
33
+ path = split_path( path.sub(/^\.\//, '') )
34
+ item_name = path.pop
35
+ folder = folder_from_split_path( path )
36
+
37
+ folder.items.select do |item|
38
+ item.instance_variable_get(:@raw_item)['name'] and item.name == item_name
39
+ end.first
40
+ end
41
+
32
42
  def download(path)
33
43
  file = file(path)
34
44
  file.download if file
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ruby-box"
8
- s.version = "1.10.2"
8
+ s.version = "1.11.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Attachments.me"]
12
- s.date = "2013-08-12"
12
+ s.date = "2013-09-07"
13
13
  s.description = "ruby gem for box.com 2.0 api"
14
14
  s.email = "ben@attachments.me"
15
15
  s.extra_rdoc_files = [
@@ -7,6 +7,7 @@ require 'webmock/rspec'
7
7
 
8
8
  describe RubyBox, :skip => true do
9
9
  before do
10
+
10
11
  WebMock.allow_net_connect!
11
12
 
12
13
  @session = RubyBox::Session.new({
@@ -112,6 +113,20 @@ describe RubyBox, :skip => true do
112
113
  end
113
114
 
114
115
  describe RubyBox::Client do
116
+
117
+ describe RubyBox::Client do
118
+ describe '#item' do
119
+ it "item method can lookup generic items, e.g., files or folders" do
120
+ file = @client.item( '/ruby-box_gem_testing/cool stuff/кузнецкий_105_а_№2.test' )
121
+ file.size.should == 14
122
+ file.name.should == 'кузнецкий_105_а_№2.test'
123
+
124
+ folder = @client.item( 'ruby-box_gem_testing' )
125
+ folder.name.should == 'ruby-box_gem_testing'
126
+ end
127
+ end
128
+ end
129
+
115
130
  describe '#put_data' do
116
131
  it "should update an existing file" do
117
132
  utf8_file_name = '遠志教授.jpg'
@@ -328,5 +343,4 @@ describe RubyBox, :skip => true do
328
343
  end
329
344
 
330
345
  end
331
-
332
346
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-box
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.2
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Attachments.me
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-12 00:00:00.000000000 Z
11
+ date: 2013-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multipart-post