fileturn 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +107 -0
  6. data/Rakefile +1 -0
  7. data/fileturn.gemspec +27 -0
  8. data/lib/fileturn/exceptions.rb +30 -0
  9. data/lib/fileturn/http_client.rb +49 -0
  10. data/lib/fileturn/resources/account.rb +46 -0
  11. data/lib/fileturn/resources/file.rb +112 -0
  12. data/lib/fileturn/resources/notification.rb +16 -0
  13. data/lib/fileturn/resources/resource.rb +17 -0
  14. data/lib/fileturn/resources/upload.rb +77 -0
  15. data/lib/fileturn/version.rb +3 -0
  16. data/lib/fileturn.rb +19 -0
  17. data/spec/.DS_Store +0 -0
  18. data/spec/data/.DS_Store +0 -0
  19. data/spec/data/testfile.docx +0 -0
  20. data/spec/fileturn_spec.rb +16 -0
  21. data/spec/fixtures/vcr_cassettes/account_info.yml +47 -0
  22. data/spec/fixtures/vcr_cassettes/file_all.yml +60 -0
  23. data/spec/fixtures/vcr_cassettes/file_all_notifications.yml +60 -0
  24. data/spec/fixtures/vcr_cassettes/file_convert_no_params.yml +44 -0
  25. data/spec/fixtures/vcr_cassettes/file_convert_success.yml +46 -0
  26. data/spec/fixtures/vcr_cassettes/file_doesnt_upload_since_too_big.yml +46 -0
  27. data/spec/fixtures/vcr_cassettes/file_failed_.yml +133 -0
  28. data/spec/fixtures/vcr_cassettes/file_notifications.yml +46 -0
  29. data/spec/fixtures/vcr_cassettes/file_queued_.yml +133 -0
  30. data/spec/fixtures/vcr_cassettes/file_reload.yml +89 -0
  31. data/spec/fixtures/vcr_cassettes/file_success.yml +46 -0
  32. data/spec/fixtures/vcr_cassettes/file_success_.yml +133 -0
  33. data/spec/fixtures/vcr_cassettes/file_time_taken.yml +133 -0
  34. data/spec/fixtures/vcr_cassettes/file_unauthorized.yml +44 -0
  35. data/spec/fixtures/vcr_cassettes/file_upload_doc_queued.yml +739 -0
  36. data/spec/fixtures/vcr_cassettes/file_upload_not_enough_credits.yml +87 -0
  37. data/spec/fixtures/vcr_cassettes/file_upload_queued.yml +160 -0
  38. data/spec/fixtures/vcr_cassettes/upload_all.yml +46 -0
  39. data/spec/fixtures/vcr_cassettes/upload_one.yml +46 -0
  40. data/spec/fixtures/vcr_cassettes/upload_refetch.yml +89 -0
  41. data/spec/resources/account_spec.rb +31 -0
  42. data/spec/resources/file_spec.rb +184 -0
  43. data/spec/resources/upload_spec.rb +41 -0
  44. data/spec/spec_helper.rb +19 -0
  45. metadata +198 -0
@@ -0,0 +1,41 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe FileTurn::Upload do
4
+
5
+ describe '.all' do
6
+ it 'retrives all the uploaded files' do
7
+ VCR.use_cassette('upload all') do
8
+ obj = FileTurn::Upload.all
9
+ obj.uploads.count.should == 20
10
+ obj.current_page.should == 1
11
+ obj.per_page.should == 20
12
+ obj.total_pages.should >= 4
13
+ end
14
+ end
15
+ end
16
+
17
+ describe '.find' do
18
+ it 'fetches a single uploaded file' do
19
+ VCR.use_cassette('upload one') do
20
+ upload = FileTurn::Upload.find(19)
21
+ upload.id.should == 19
22
+ upload.policy.should_not be_empty
23
+ upload.signature.should_not be_empty
24
+ upload.aws_access_key_id.should_not be_empty
25
+ upload.key.should_not be_empty
26
+ upload.url.should_not be_empty
27
+ end
28
+ end
29
+
30
+ it 'reload fetches the info again' do
31
+ VCR.use_cassette('upload refetch') do
32
+ upload = FileTurn::Upload.find(19)
33
+ old_params = upload.params
34
+ upload.should_receive(:parse_json_params)
35
+
36
+ upload.reload.params.should == old_params
37
+ end
38
+ end
39
+ end
40
+
41
+ end
@@ -0,0 +1,19 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+
4
+ require 'fileturn'
5
+ require 'rspec'
6
+ require 'ostruct'
7
+ require 'vcr'
8
+
9
+ VCR.configure do |c|
10
+ c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
11
+ c.hook_into :webmock # or :fakeweb
12
+ c.default_cassette_options = { :record => :new_episodes }
13
+ end
14
+
15
+ RSpec.configure do |config|
16
+ config.before(:each) do
17
+ FileTurn.configure(:api_key => "67sFfjudMpXxJeioQcPSppYkoVdQD1oetqPWzMAh")
18
+ end
19
+ end
metadata ADDED
@@ -0,0 +1,198 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fileturn
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Nisarg Shah
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: vcr
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: FileTurn Client
98
+ email:
99
+ - nisargshah100@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - .gitignore
105
+ - Gemfile
106
+ - LICENSE.txt
107
+ - README.md
108
+ - Rakefile
109
+ - fileturn.gemspec
110
+ - lib/fileturn.rb
111
+ - lib/fileturn/exceptions.rb
112
+ - lib/fileturn/http_client.rb
113
+ - lib/fileturn/resources/account.rb
114
+ - lib/fileturn/resources/file.rb
115
+ - lib/fileturn/resources/notification.rb
116
+ - lib/fileturn/resources/resource.rb
117
+ - lib/fileturn/resources/upload.rb
118
+ - lib/fileturn/version.rb
119
+ - spec/.DS_Store
120
+ - spec/data/.DS_Store
121
+ - spec/data/testfile.docx
122
+ - spec/fileturn_spec.rb
123
+ - spec/fixtures/vcr_cassettes/account_info.yml
124
+ - spec/fixtures/vcr_cassettes/file_all.yml
125
+ - spec/fixtures/vcr_cassettes/file_all_notifications.yml
126
+ - spec/fixtures/vcr_cassettes/file_convert_no_params.yml
127
+ - spec/fixtures/vcr_cassettes/file_convert_success.yml
128
+ - spec/fixtures/vcr_cassettes/file_doesnt_upload_since_too_big.yml
129
+ - spec/fixtures/vcr_cassettes/file_failed_.yml
130
+ - spec/fixtures/vcr_cassettes/file_notifications.yml
131
+ - spec/fixtures/vcr_cassettes/file_queued_.yml
132
+ - spec/fixtures/vcr_cassettes/file_reload.yml
133
+ - spec/fixtures/vcr_cassettes/file_success.yml
134
+ - spec/fixtures/vcr_cassettes/file_success_.yml
135
+ - spec/fixtures/vcr_cassettes/file_time_taken.yml
136
+ - spec/fixtures/vcr_cassettes/file_unauthorized.yml
137
+ - spec/fixtures/vcr_cassettes/file_upload_doc_queued.yml
138
+ - spec/fixtures/vcr_cassettes/file_upload_not_enough_credits.yml
139
+ - spec/fixtures/vcr_cassettes/file_upload_queued.yml
140
+ - spec/fixtures/vcr_cassettes/upload_all.yml
141
+ - spec/fixtures/vcr_cassettes/upload_one.yml
142
+ - spec/fixtures/vcr_cassettes/upload_refetch.yml
143
+ - spec/resources/account_spec.rb
144
+ - spec/resources/file_spec.rb
145
+ - spec/resources/upload_spec.rb
146
+ - spec/spec_helper.rb
147
+ homepage: ''
148
+ licenses: []
149
+ metadata: {}
150
+ post_install_message:
151
+ rdoc_options: []
152
+ require_paths:
153
+ - lib
154
+ required_ruby_version: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ! '>='
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ required_rubygems_version: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ! '>='
162
+ - !ruby/object:Gem::Version
163
+ version: '0'
164
+ requirements: []
165
+ rubyforge_project:
166
+ rubygems_version: 2.0.4
167
+ signing_key:
168
+ specification_version: 4
169
+ summary: FileTurn Client
170
+ test_files:
171
+ - spec/.DS_Store
172
+ - spec/data/.DS_Store
173
+ - spec/data/testfile.docx
174
+ - spec/fileturn_spec.rb
175
+ - spec/fixtures/vcr_cassettes/account_info.yml
176
+ - spec/fixtures/vcr_cassettes/file_all.yml
177
+ - spec/fixtures/vcr_cassettes/file_all_notifications.yml
178
+ - spec/fixtures/vcr_cassettes/file_convert_no_params.yml
179
+ - spec/fixtures/vcr_cassettes/file_convert_success.yml
180
+ - spec/fixtures/vcr_cassettes/file_doesnt_upload_since_too_big.yml
181
+ - spec/fixtures/vcr_cassettes/file_failed_.yml
182
+ - spec/fixtures/vcr_cassettes/file_notifications.yml
183
+ - spec/fixtures/vcr_cassettes/file_queued_.yml
184
+ - spec/fixtures/vcr_cassettes/file_reload.yml
185
+ - spec/fixtures/vcr_cassettes/file_success.yml
186
+ - spec/fixtures/vcr_cassettes/file_success_.yml
187
+ - spec/fixtures/vcr_cassettes/file_time_taken.yml
188
+ - spec/fixtures/vcr_cassettes/file_unauthorized.yml
189
+ - spec/fixtures/vcr_cassettes/file_upload_doc_queued.yml
190
+ - spec/fixtures/vcr_cassettes/file_upload_not_enough_credits.yml
191
+ - spec/fixtures/vcr_cassettes/file_upload_queued.yml
192
+ - spec/fixtures/vcr_cassettes/upload_all.yml
193
+ - spec/fixtures/vcr_cassettes/upload_one.yml
194
+ - spec/fixtures/vcr_cassettes/upload_refetch.yml
195
+ - spec/resources/account_spec.rb
196
+ - spec/resources/file_spec.rb
197
+ - spec/resources/upload_spec.rb
198
+ - spec/spec_helper.rb