ruby-box 1.5.0 → 1.6.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
- Nzk0MzA1ZmJjZTkyODM4ZjQ0YjcxNTM5ZWQ0MTIyYjFjYTRkN2UxMw==
4
+ NTc3YWExYjRlZWQyZDQyMjM3M2YxNTBhOGVhNmM2OTc2ZGM4YjIxMQ==
5
5
  data.tar.gz: !binary |-
6
- MTE2NjQ3MTZmN2M2NGM4ZGU0ZWY1YWVjZTBjMzljZDdhZWFhZWE3MQ==
6
+ MmE2M2M2Njg3OWIxYjgyNWUzMzNmMzc2OGFjMzZlZGM5MGIzNmMyNA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YTAxYTFiMjI2YjNiNDU3ZGIwMjQzNjkzMDI5MjRkMWMxZmE0MDgyOTBhY2Qz
10
- ZDgwODQ1Njc2ZGNlNzM1YzcyNWI3ZDExMTVjZmFmMTdlZmI4YTZmZmE0NmJh
11
- MmEyMGQ3ZmZlYjhkZGYyYjJmNDZhNzZjYzJkZDE2MDVhNjk1OWE=
9
+ YTZiZTZjMzM1MmE1M2M1OGRhYzcwMzlmOTk2MzVlOGRjYjE4ZGZmOWY3YmRh
10
+ ZWExZDljOTc4YzQzZGMyNjU2ZWEzZmZmNjkwMDQxNTIyM2RjNzM3OTRhMmE0
11
+ NmZlOGE4YTk3NjNjNGY2NTgxN2Y4MzExNzVkMDRjYmIxNzYxODE=
12
12
  data.tar.gz: !binary |-
13
- M2Y3OTAxMjQ5Zjc1NmJjM2Y1MDkyNTQyNmVmMzkwZjQyNzU5YWJkMDdlYjRl
14
- NmU3ZGMwMDAyOTBkOTAyN2U4NzhhN2EyZGJlNTkyNTI5OGFmOTQ0MzViYWMw
15
- Yjg2M2RjNzdlYTYyOGFhNGJjYTc5MGU0M2JlN2Y2OTc1YTU0NGQ=
13
+ N2RiOWE4NzNkYmNkMWUxMWQ3YTk3YTc3ODA0OGVmOTZiYTg3NGRhYTEwZDE5
14
+ N2VjODVkOTliZmNmYzJmMmIxODMzZGEyMWE1Mjg4ZTFhNjUyNWJjYzU0MmZm
15
+ MzU5NTJkMTY0MThmM2E4MGIxNTE2YzVlYjZiODc1MzMwYWY5ZTE=
data/README.markdown CHANGED
@@ -144,7 +144,7 @@ end
144
144
 
145
145
  ```ruby
146
146
  file = client.file('/image_folder/an-image.jpg').create_shared_link
147
- p file.shared_link['url'] # https://www.box.com/s/d6de3224958c1755412
147
+ p file.shared_link.url # https://www.box.com/s/d6de3224958c1755412
148
148
  ```
149
149
 
150
150
  Search
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.0
1
+ 1.6.0
@@ -11,5 +11,9 @@ module RubyBox
11
11
  ['role', 'status']
12
12
  end
13
13
 
14
+ def has_mini_format?
15
+ true
16
+ end
17
+
14
18
  end
15
19
  end
@@ -6,5 +6,9 @@ module RubyBox
6
6
  def resource_name
7
7
  'comments'
8
8
  end
9
+
10
+ def has_mini_format?
11
+ true
12
+ end
9
13
  end
10
14
  end
@@ -7,5 +7,9 @@ module RubyBox
7
7
  def resource_name
8
8
  'discussions'
9
9
  end
10
+
11
+ def has_mini_format?
12
+ true
13
+ end
10
14
  end
11
15
  end
@@ -1,11 +1,4 @@
1
1
  module RubyBox
2
2
  class Event < Item
3
-
4
- private
5
-
6
- def has_mini_format?
7
- false
8
- end
9
-
10
3
  end
11
4
  end
@@ -12,10 +12,6 @@ module RubyBox
12
12
  def resource_name
13
13
  'events'
14
14
  end
15
-
16
- def has_mini_format?
17
- false
18
- end
19
-
15
+
20
16
  end
21
17
  end
data/lib/ruby-box/file.rb CHANGED
@@ -54,6 +54,10 @@ module RubyBox
54
54
  'files'
55
55
  end
56
56
 
57
+ def has_mini_format?
58
+ true
59
+ end
60
+
57
61
  def update_fields
58
62
  ['name', 'description']
59
63
  end
@@ -66,6 +66,10 @@ module RubyBox
66
66
  'folders'
67
67
  end
68
68
 
69
+ def has_mini_format?
70
+ true
71
+ end
72
+
69
73
  def update_fields
70
74
  ['name', 'description']
71
75
  end
data/lib/ruby-box/item.rb CHANGED
@@ -113,16 +113,16 @@ module RubyBox
113
113
  protected
114
114
 
115
115
  def self.factory(session, entry)
116
- type = entry['type'] ? entry['type'].capitalize.to_sym : nil
116
+ type = entry['type'] ? entry['type'].split('_').map(&:capitalize).join('').to_sym : nil
117
117
  if RubyBox.constants.include? type
118
118
  RubyBox.const_get(type).new(session, entry)
119
119
  else
120
- entry
120
+ RubyBox::Item.new(session, entry)
121
121
  end
122
122
  end
123
123
 
124
124
  def has_mini_format?
125
- true
125
+ false
126
126
  end
127
127
 
128
128
  private
@@ -1,11 +1,4 @@
1
1
  module RubyBox
2
2
  class WebLink < Item
3
-
4
- private
5
-
6
- def has_mini_format?
7
- false
8
- end
9
-
10
3
  end
11
4
  end
data/ruby-box.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ruby-box"
8
- s.version = "1.5.0"
8
+ s.version = "1.6.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-07-01"
12
+ s.date = "2013-07-16"
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 = [
@@ -48,6 +48,7 @@ Gem::Specification.new do |s|
48
48
  "spec/helper/account.example",
49
49
  "spec/helper/account.rb",
50
50
  "spec/integration_spec.rb",
51
+ "spec/item_spec.rb",
51
52
  "spec/me_spec.rb",
52
53
  "spec/spec_helper.rb"
53
54
  ]
@@ -204,7 +204,7 @@ describe RubyBox, :skip => true do
204
204
  folder = @client.create_folder('/ruby-box_gem_testing/shared_folder').create_shared_link
205
205
 
206
206
  # share link was successfully created.
207
- folder.shared_link['url'].should match /https?:\/\/[\S]+/
207
+ folder.shared_link.url.should match /https?:\/\/[\S]+/
208
208
 
209
209
  # share link can be disabled.
210
210
  folder.disable_shared_link
@@ -218,7 +218,7 @@ describe RubyBox, :skip => true do
218
218
  file = @client.upload_file('spec/fixtures/' + utf8_file_name, '/ruby-box_gem_testing/cool stuff/').create_shared_link
219
219
 
220
220
  # share link was successfully created.
221
- file.shared_link['url'].should match /https?:\/\/[\S]+/
221
+ file.shared_link.url.should match /https?:\/\/[\S]+/
222
222
 
223
223
  # share link can be disabled.
224
224
  file.disable_shared_link
data/spec/item_spec.rb ADDED
@@ -0,0 +1,31 @@
1
+ #encoding: UTF-8
2
+
3
+ require 'ruby-box'
4
+ require 'webmock/rspec'
5
+
6
+ describe RubyBox::Item do
7
+
8
+ before do
9
+ @session = RubyBox::Session.new
10
+ @client = RubyBox::Client.new(@session)
11
+ end
12
+
13
+ describe '#factory' do
14
+
15
+ it 'creates an object from a web_link hash' do
16
+ web_link = RubyBox::Item.factory(@session, {
17
+ 'type' => 'web_link'
18
+ })
19
+ web_link.type.should == 'web_link'
20
+ web_link.instance_of?(RubyBox::WebLink).should == true
21
+ end
22
+
23
+ it 'defaults to item object if unknown type' do
24
+ banana = RubyBox::Item.factory(@session, {
25
+ 'type' => 'banana'
26
+ })
27
+ banana.type.should == 'banana'
28
+ banana.instance_of?(RubyBox::Item).should == true
29
+ end
30
+ end
31
+ 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.5.0
4
+ version: 1.6.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-07-01 00:00:00.000000000 Z
11
+ date: 2013-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multipart-post
@@ -161,6 +161,7 @@ files:
161
161
  - spec/helper/account.example
162
162
  - spec/helper/account.rb
163
163
  - spec/integration_spec.rb
164
+ - spec/item_spec.rb
164
165
  - spec/me_spec.rb
165
166
  - spec/spec_helper.rb
166
167
  homepage: http://github.com/attachmentsme/ruby-box