iora-ruby-box 1.14.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.travis.yml +6 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +51 -0
- data/LICENSE.txt +20 -0
- data/README.markdown +349 -0
- data/Rakefile +32 -0
- data/VERSION +1 -0
- data/lib/ruby-box.rb +21 -0
- data/lib/ruby-box/client.rb +163 -0
- data/lib/ruby-box/collaboration.rb +19 -0
- data/lib/ruby-box/comment.rb +14 -0
- data/lib/ruby-box/discussion.rb +15 -0
- data/lib/ruby-box/event.rb +4 -0
- data/lib/ruby-box/event_response.rb +17 -0
- data/lib/ruby-box/exceptions.rb +22 -0
- data/lib/ruby-box/file.rb +96 -0
- data/lib/ruby-box/folder.rb +113 -0
- data/lib/ruby-box/item.rb +181 -0
- data/lib/ruby-box/session.rb +136 -0
- data/lib/ruby-box/shared_link.rb +10 -0
- data/lib/ruby-box/user.rb +16 -0
- data/lib/ruby-box/web_link.rb +4 -0
- data/ruby-box.gemspec +99 -0
- data/spec/client_spec.rb +64 -0
- data/spec/event_spec.rb +70 -0
- data/spec/file_spec.rb +110 -0
- data/spec/fixtures/comment_create.json +18 -0
- data/spec/fixtures/events.json +161 -0
- data/spec/fixtures/me.json +17 -0
- data/spec/fixtures/users.json +39 -0
- data/spec/folder_spec.rb +181 -0
- data/spec/helper/account.example +3 -0
- data/spec/helper/account.rb +8 -0
- data/spec/integration_spec.rb +387 -0
- data/spec/item_spec.rb +31 -0
- data/spec/me_spec.rb +20 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/users_spec.rb +24 -0
- metadata +214 -0
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
|
data/spec/me_spec.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#encoding: UTF-8
|
2
|
+
|
3
|
+
require 'ruby-box'
|
4
|
+
require 'webmock/rspec'
|
5
|
+
|
6
|
+
describe '/users/me' do
|
7
|
+
before do
|
8
|
+
@session = RubyBox::Session.new
|
9
|
+
@client = RubyBox::Client.new(@session)
|
10
|
+
@me_json = File.read 'spec/fixtures/me.json'
|
11
|
+
@me = JSON.load @me_json
|
12
|
+
stub_request(:get, /#{RubyBox::API_URL}\/users\/me/).to_return(body: @me_json, :status => 200)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should return the currently logged in User' do
|
16
|
+
me = @client.me
|
17
|
+
me.instance_of?(RubyBox::User).should be_true
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
data/spec/spec_helper.rb
ADDED
data/spec/users_spec.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#encoding: UTF-8
|
2
|
+
|
3
|
+
require 'ruby-box'
|
4
|
+
require 'webmock/rspec'
|
5
|
+
|
6
|
+
describe '/users' do
|
7
|
+
before do
|
8
|
+
@session = RubyBox::Session.new
|
9
|
+
@client = RubyBox::Client.new(@session)
|
10
|
+
@users_json = File.read 'spec/fixtures/users.json'
|
11
|
+
@users = JSON.load(@users_json)
|
12
|
+
stub_request(:get, /#{RubyBox::API_URL}\/users/).to_return(body: @users_json, :status => 200)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should return a list of all users in the enterprise' do
|
16
|
+
users = @client.users
|
17
|
+
users.instance_of?(Array).should be_true
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should return a list of all users in the enterprise as a user object' do
|
21
|
+
users = @client.users
|
22
|
+
users.first.instance_of?(RubyBox::User).should be_true
|
23
|
+
end
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,214 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: iora-ruby-box
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.14.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Patrick Robertson
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-03-07 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: multipart-post
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: oauth2
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: json
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: addressable
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rspec
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: bundler
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: jeweler
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.6.4
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 1.6.4
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: webmock
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
description: ruby gem for box.com 2.0 api
|
143
|
+
email: patricksrobertson@gmail.com
|
144
|
+
executables: []
|
145
|
+
extensions: []
|
146
|
+
extra_rdoc_files:
|
147
|
+
- LICENSE.txt
|
148
|
+
- README.markdown
|
149
|
+
files:
|
150
|
+
- .document
|
151
|
+
- .travis.yml
|
152
|
+
- Gemfile
|
153
|
+
- Gemfile.lock
|
154
|
+
- LICENSE.txt
|
155
|
+
- README.markdown
|
156
|
+
- Rakefile
|
157
|
+
- VERSION
|
158
|
+
- lib/ruby-box.rb
|
159
|
+
- lib/ruby-box/client.rb
|
160
|
+
- lib/ruby-box/collaboration.rb
|
161
|
+
- lib/ruby-box/comment.rb
|
162
|
+
- lib/ruby-box/discussion.rb
|
163
|
+
- lib/ruby-box/event.rb
|
164
|
+
- lib/ruby-box/event_response.rb
|
165
|
+
- lib/ruby-box/exceptions.rb
|
166
|
+
- lib/ruby-box/file.rb
|
167
|
+
- lib/ruby-box/folder.rb
|
168
|
+
- lib/ruby-box/item.rb
|
169
|
+
- lib/ruby-box/session.rb
|
170
|
+
- lib/ruby-box/shared_link.rb
|
171
|
+
- lib/ruby-box/user.rb
|
172
|
+
- lib/ruby-box/web_link.rb
|
173
|
+
- ruby-box.gemspec
|
174
|
+
- spec/client_spec.rb
|
175
|
+
- spec/event_spec.rb
|
176
|
+
- spec/file_spec.rb
|
177
|
+
- spec/fixtures/comment_create.json
|
178
|
+
- spec/fixtures/events.json
|
179
|
+
- spec/fixtures/me.json
|
180
|
+
- spec/fixtures/users.json
|
181
|
+
- spec/folder_spec.rb
|
182
|
+
- spec/helper/account.example
|
183
|
+
- spec/helper/account.rb
|
184
|
+
- spec/integration_spec.rb
|
185
|
+
- spec/item_spec.rb
|
186
|
+
- spec/me_spec.rb
|
187
|
+
- spec/spec_helper.rb
|
188
|
+
- spec/users_spec.rb
|
189
|
+
homepage: http://github.com/attachmentsme/ruby-box
|
190
|
+
licenses:
|
191
|
+
- MIT
|
192
|
+
post_install_message:
|
193
|
+
rdoc_options: []
|
194
|
+
require_paths:
|
195
|
+
- lib
|
196
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
197
|
+
none: false
|
198
|
+
requirements:
|
199
|
+
- - ! '>='
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
203
|
+
none: false
|
204
|
+
requirements:
|
205
|
+
- - ! '>='
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: '0'
|
208
|
+
requirements: []
|
209
|
+
rubyforge_project:
|
210
|
+
rubygems_version: 1.8.23.2
|
211
|
+
signing_key:
|
212
|
+
specification_version: 4
|
213
|
+
summary: ruby gem for box.com 2.0 api
|
214
|
+
test_files: []
|