groupdocs 1.2.8 → 1.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/examples/api-samples/README.md +17 -6
  2. data/examples/api-samples/app.rb +0 -2
  3. data/examples/api-samples/public/GroupDocs_Signature_Demo.pdf +0 -0
  4. data/examples/api-samples/public/docs/docco.css +192 -0
  5. data/examples/api-samples/public/docs/envelope-sample.html +132 -0
  6. data/examples/api-samples/public/docs/sample1.html +26 -0
  7. data/examples/api-samples/public/docs/sample10.html +49 -0
  8. data/examples/api-samples/public/docs/sample11.html +87 -0
  9. data/examples/api-samples/public/docs/sample12.html +40 -0
  10. data/examples/api-samples/public/docs/sample13.html +41 -0
  11. data/examples/api-samples/public/docs/sample14.html +30 -0
  12. data/examples/api-samples/public/docs/sample15.html +27 -0
  13. data/examples/api-samples/public/docs/sample16.html +25 -0
  14. data/examples/api-samples/public/docs/sample17.html +37 -0
  15. data/examples/api-samples/public/docs/sample18.html +62 -0
  16. data/examples/api-samples/public/docs/sample2.html +30 -0
  17. data/examples/api-samples/public/docs/sample3.html +34 -0
  18. data/examples/api-samples/public/docs/sample4.html +41 -0
  19. data/examples/api-samples/public/docs/sample5.html +56 -0
  20. data/examples/api-samples/public/docs/sample6.html +48 -0
  21. data/examples/api-samples/public/docs/sample7.html +43 -0
  22. data/examples/api-samples/public/docs/sample8.html +54 -0
  23. data/examples/api-samples/public/docs/sample9.html +31 -0
  24. data/examples/api-samples/samples/envelope-sample.rb +132 -0
  25. data/examples/api-samples/samples/sample1.rb +10 -2
  26. data/examples/api-samples/samples/sample10.rb +17 -5
  27. data/examples/api-samples/samples/sample11.rb +86 -0
  28. data/examples/api-samples/samples/sample12.rb +39 -0
  29. data/examples/api-samples/samples/sample13.rb +40 -0
  30. data/examples/api-samples/samples/sample14.rb +29 -0
  31. data/examples/api-samples/samples/sample15.rb +26 -0
  32. data/examples/api-samples/samples/sample16.rb +24 -0
  33. data/examples/api-samples/samples/sample17.rb +36 -0
  34. data/examples/api-samples/samples/sample18.rb +61 -0
  35. data/examples/api-samples/samples/sample2.rb +14 -4
  36. data/examples/api-samples/samples/sample3.rb +14 -4
  37. data/examples/api-samples/samples/sample4.rb +12 -3
  38. data/examples/api-samples/samples/sample5.rb +13 -2
  39. data/examples/api-samples/samples/sample6.rb +18 -6
  40. data/examples/api-samples/samples/sample7.rb +9 -0
  41. data/examples/api-samples/samples/sample8.rb +17 -4
  42. data/examples/api-samples/samples/sample9.rb +10 -2
  43. data/examples/api-samples/views/envelope_sample.haml +73 -0
  44. data/examples/api-samples/views/index.haml +18 -0
  45. data/examples/api-samples/views/sample1.haml +21 -0
  46. data/examples/api-samples/views/sample10.haml +21 -0
  47. data/examples/api-samples/views/sample11.haml +141 -0
  48. data/examples/api-samples/views/sample12.haml +94 -0
  49. data/examples/api-samples/views/sample13.haml +90 -0
  50. data/examples/api-samples/views/sample14.haml +86 -0
  51. data/examples/api-samples/views/sample15.haml +75 -0
  52. data/examples/api-samples/views/sample16.haml +68 -0
  53. data/examples/api-samples/views/sample17.haml +80 -0
  54. data/examples/api-samples/views/sample18.haml +87 -0
  55. data/examples/api-samples/views/sample2.haml +21 -0
  56. data/examples/api-samples/views/sample3.haml +23 -2
  57. data/examples/api-samples/views/sample4.haml +21 -0
  58. data/examples/api-samples/views/sample5.haml +21 -0
  59. data/examples/api-samples/views/sample6.haml +22 -1
  60. data/examples/api-samples/views/sample7.haml +21 -0
  61. data/examples/api-samples/views/sample8.haml +22 -1
  62. data/examples/api-samples/views/sample9.haml +21 -0
  63. data/lib/groupdocs/job.rb +5 -3
  64. data/lib/groupdocs/user.rb +33 -0
  65. data/lib/groupdocs/version.rb +1 -1
  66. data/spec/groupdocs/job_spec.rb +5 -0
  67. data/spec/groupdocs/user_spec.rb +22 -0
  68. data/spec/support/json/update_account.json +10 -0
  69. metadata +45 -4
@@ -4,6 +4,9 @@
4
4
  .samplecontent{:style => "padding:10px;"}
5
5
  %i This sample will show how to list thumbnails for documents in the GroupDocs account using Ruby SDK
6
6
  %br/
7
+ %i You can find documentation for this sample
8
+ %a{:href => "/docs/sample7.html"} here
9
+ %br/
7
10
  %br/
8
11
  %p
9
12
  You entered:
@@ -57,3 +60,21 @@
57
60
  %a{:href => "/sample9"} Sample9 - How to generate an embedded Viewer URL for a Document
58
61
  %li
59
62
  %a{:href => "/sample10"} Sample10 - How to share a document to other users
63
+ %li
64
+ %a{:href => "/sample11"}Sample11 - How programmatically create and post an annotation into document. How to delete the annotation
65
+ %li
66
+ %a{:href => "/sample12"}Sample12 - How to list all annotations from document
67
+ %li
68
+ %a{:href => "/sample13"}Sample13 - How to add collaborator to doc with annotations
69
+ %li
70
+ %a{:href => "/sample14"}Sample14 - How to check the list of shares for a folder
71
+ %li
72
+ %a{:href => "/sample15"}Sample15 - How to check the number of document's views
73
+ %li
74
+ %a{:href => "/sample16"}Sample16 - How to insert Assembly questionary into webpage
75
+ %li
76
+ %a{:href => "/sample17"}Sample17 - How to upload a file into the storage and compress it into zip archive
77
+ %li
78
+ %a{:href => "/sample18"}Sample18 - How to convert Doc to Docx, Docx to Doc, Docx to PDF, PPT to PDF
79
+ %li
80
+ %a{:href => "/envelope-sample"}Envelope sample - How to use envelope and signature API
@@ -4,6 +4,9 @@
4
4
  .samplecontent{:style => "padding:10px;"}
5
5
  %i This sample will show how to return a URL representing a single page of particular Document in the GroupDocs account using Ruby SDK
6
6
  %br/
7
+ %i You can find documentation for this sample
8
+ %a{:href => "/docs/sample8.html"} here
9
+ %br/
7
10
  %br/
8
11
  %p
9
12
  You entered:
@@ -72,4 +75,22 @@
72
75
  %li
73
76
  %a{:href => "/sample9"} Sample9 - How to generate an embedded Viewer URL for a Document
74
77
  %li
75
- %a{:href => "/sample10"} Sample10 - How to share a document to other users
78
+ %a{:href => "/sample10"} Sample10 - How to share a document to other userss
79
+ %li
80
+ %a{:href => "/sample11"}Sample11 - How programmatically create and post an annotation into document. How to delete the annotation
81
+ %li
82
+ %a{:href => "/sample12"}Sample12 - How to list all annotations from document
83
+ %li
84
+ %a{:href => "/sample13"}Sample13 - How to add collaborator to doc with annotations
85
+ %li
86
+ %a{:href => "/sample14"}Sample14 - How to check the list of shares for a folder
87
+ %li
88
+ %a{:href => "/sample15"}Sample15 - How to check the number of document's views
89
+ %li
90
+ %a{:href => "/sample16"}Sample16 - How to insert Assembly questionary into webpage
91
+ %li
92
+ %a{:href => "/sample17"}Sample17 - How to upload a file into the storage and compress it into zip archive
93
+ %li
94
+ %a{:href => "/sample18"}Sample18 - How to convert Doc to Docx, Docx to Doc, Docx to PDF, PPT to PDF
95
+ %li
96
+ %a{:href => "/envelope-sample"}Envelope sample - How to use envelope and signature API
@@ -4,6 +4,9 @@
4
4
  .samplecontent{:style => "padding:10px;"}
5
5
  %i This sample will show how to generate an embedded Viewer URL for particular Document in the GroupDocs account using Ruby SDK
6
6
  %br/
7
+ %i You can find documentation for this sample
8
+ %a{:href => "/docs/sample9.html"} here
9
+ %br/
7
10
  %br/
8
11
  %p
9
12
  You entered:
@@ -59,3 +62,21 @@
59
62
  %a{:href => "/sample9"} Sample9 - How to generate a embedded Viewer URL for a DocumentI
60
63
  %li
61
64
  %a{:href => "/sample10"} Sample10 - How to share a document to other users
65
+ %li
66
+ %a{:href => "/sample11"}Sample11 - How programmatically create and post an annotation into document. How to delete the annotation
67
+ %li
68
+ %a{:href => "/sample12"}Sample12 - How to list all annotations from document
69
+ %li
70
+ %a{:href => "/sample13"}Sample13 - How to add collaborator to doc with annotations
71
+ %li
72
+ %a{:href => "/sample14"}Sample14 - How to check the list of shares for a folder
73
+ %li
74
+ %a{:href => "/sample15"}Sample15 - How to check the number of document's views
75
+ %li
76
+ %a{:href => "/sample16"}Sample16 - How to insert Assembly questionary into webpage
77
+ %li
78
+ %a{:href => "/sample17"}Sample17 - How to upload a file into the storage and compress it into zip archive
79
+ %li
80
+ %a{:href => "/sample18"}Sample18 - How to convert Doc to Docx, Docx to Doc, Docx to PDF, PPT to PDF
81
+ %li
82
+ %a{:href => "/envelope-sample"}Envelope sample - How to use envelope and signature API
data/lib/groupdocs/job.rb CHANGED
@@ -53,11 +53,13 @@ module GroupDocs
53
53
  # @return [GroupDocs::Job]
54
54
  #
55
55
  def self.get!(id, access = {})
56
- json = Api::Request.new do |request|
56
+ api = Api::Request.new do |request|
57
57
  request[:access] = access
58
58
  request[:method] = :GET
59
59
  request[:path] = "/async/{{client_id}}/jobs/#{id}"
60
- end.execute!
60
+ end
61
+ api.add_params(format: 'json')
62
+ json = api.execute!
61
63
 
62
64
  Job.new(json)
63
65
  end
@@ -150,7 +152,7 @@ module GroupDocs
150
152
  # @return [Array<Symbol>]
151
153
  #
152
154
  def actions
153
- @actions.split(', ').map { |action| variable_to_accessor(action) }
155
+ @actions.split(', ').map { |action| variable_to_accessor(action) } if @actions
154
156
  end
155
157
 
156
158
  #
@@ -26,6 +26,39 @@ module GroupDocs
26
26
  new(json[:user])
27
27
  end
28
28
 
29
+ #
30
+ # Updates user account if it's created, otherwise creates new.
31
+ #
32
+ # @example
33
+ # user = GroupDocs::User.new
34
+ # user.primary_email = 'john@smith.com'
35
+ # user.nickname = 'johnsmith'
36
+ # user.first_name = 'John'
37
+ # user.last_name = 'Smith'
38
+ # # make sure to save user as it has updated attributes
39
+ # user = GroupDocs::User.update_account!(user)
40
+ #
41
+ # @param [GroupDocs::User] user
42
+ # @param [Hash] access Access credentials
43
+ # @option access [String] :client_id
44
+ # @option access [String] :private_key
45
+ # @return [GroupDocs::User]
46
+ #
47
+ def self.update_account!(user, access = {})
48
+ user.is_a?(GroupDocs::User) or raise ArgumentError,
49
+ "User should be GroupDocs::User object, received: #{user.inspect}"
50
+
51
+ data = user.to_hash
52
+ json = Api::Request.new do |request|
53
+ request[:access] = access
54
+ request[:method] = :PUT
55
+ request[:path] = "/mgmt/{{client_id}}/account/users/#{user.nickname}"
56
+ request[:request_body] = data
57
+ end.execute!
58
+
59
+ GroupDocs::User.new data.merge(json)
60
+ end
61
+
29
62
  # @attr [Integer] id
30
63
  attr_accessor :id
31
64
  # @attr [String] guid
@@ -1,3 +1,3 @@
1
1
  module GroupDocs
2
- VERSION = '1.2.8'
2
+ VERSION = '1.2.9'
3
3
  end # GroupDocs
@@ -128,6 +128,11 @@ describe GroupDocs::Job do
128
128
  subject.actions = 'Convert, Combine, CompressZip'
129
129
  subject.actions.should == [:convert, :combine, :compress_zip]
130
130
  end
131
+
132
+ it 'does nothing if there are no actions' do
133
+ subject.actions = nil
134
+ subject.actions.should be_nil
135
+ end
131
136
  end
132
137
 
133
138
  describe '#documents!' do
@@ -20,6 +20,28 @@ describe GroupDocs::User do
20
20
  end
21
21
  end
22
22
 
23
+ describe '.update_account!' do
24
+ before(:each) do
25
+ mock_api_server(load_json('update_account'))
26
+ end
27
+
28
+ let!(:user) { GroupDocs::User.new }
29
+
30
+ it 'accepts access credentials hash' do
31
+ lambda do
32
+ described_class.update_account!(user, client_id: 'client_id', private_key: 'private_key')
33
+ end.should_not raise_error(ArgumentError)
34
+ end
35
+
36
+ it 'raises error if user is not an instance of GroupDocs::User' do
37
+ -> { described_class.update_account!('user') }.should raise_error(ArgumentError)
38
+ end
39
+
40
+ it 'returns GroupDocs::User object' do
41
+ described_class.update_account!(user).should be_a(GroupDocs::User)
42
+ end
43
+ end
44
+
23
45
  it { should have_accessor(:id) }
24
46
  it { should have_accessor(:guid) }
25
47
  it { should have_accessor(:nickname) }
@@ -0,0 +1,10 @@
1
+ {
2
+ "result": {
3
+ "id": 510,
4
+ "guid": "2d58a57067966405",
5
+ "primary_email": "john@smith.com"
6
+ },
7
+ "status": "Ok",
8
+ "error_message": null,
9
+ "composedOn": 1360592389774
10
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groupdocs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.8
4
+ version: 1.2.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-06 00:00:00.000000000 Z
12
+ date: 2013-02-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -170,9 +170,39 @@ files:
170
170
  - examples/api-samples/Gemfile
171
171
  - examples/api-samples/README.md
172
172
  - examples/api-samples/app.rb
173
+ - examples/api-samples/public/GroupDocs_Signature_Demo.pdf
173
174
  - examples/api-samples/public/css/style.css
175
+ - examples/api-samples/public/docs/docco.css
176
+ - examples/api-samples/public/docs/envelope-sample.html
177
+ - examples/api-samples/public/docs/sample1.html
178
+ - examples/api-samples/public/docs/sample10.html
179
+ - examples/api-samples/public/docs/sample11.html
180
+ - examples/api-samples/public/docs/sample12.html
181
+ - examples/api-samples/public/docs/sample13.html
182
+ - examples/api-samples/public/docs/sample14.html
183
+ - examples/api-samples/public/docs/sample15.html
184
+ - examples/api-samples/public/docs/sample16.html
185
+ - examples/api-samples/public/docs/sample17.html
186
+ - examples/api-samples/public/docs/sample18.html
187
+ - examples/api-samples/public/docs/sample2.html
188
+ - examples/api-samples/public/docs/sample3.html
189
+ - examples/api-samples/public/docs/sample4.html
190
+ - examples/api-samples/public/docs/sample5.html
191
+ - examples/api-samples/public/docs/sample6.html
192
+ - examples/api-samples/public/docs/sample7.html
193
+ - examples/api-samples/public/docs/sample8.html
194
+ - examples/api-samples/public/docs/sample9.html
195
+ - examples/api-samples/samples/envelope-sample.rb
174
196
  - examples/api-samples/samples/sample1.rb
175
197
  - examples/api-samples/samples/sample10.rb
198
+ - examples/api-samples/samples/sample11.rb
199
+ - examples/api-samples/samples/sample12.rb
200
+ - examples/api-samples/samples/sample13.rb
201
+ - examples/api-samples/samples/sample14.rb
202
+ - examples/api-samples/samples/sample15.rb
203
+ - examples/api-samples/samples/sample16.rb
204
+ - examples/api-samples/samples/sample17.rb
205
+ - examples/api-samples/samples/sample18.rb
176
206
  - examples/api-samples/samples/sample2.rb
177
207
  - examples/api-samples/samples/sample3.rb
178
208
  - examples/api-samples/samples/sample4.rb
@@ -181,10 +211,19 @@ files:
181
211
  - examples/api-samples/samples/sample7.rb
182
212
  - examples/api-samples/samples/sample8.rb
183
213
  - examples/api-samples/samples/sample9.rb
214
+ - examples/api-samples/views/envelope_sample.haml
184
215
  - examples/api-samples/views/index.haml
185
216
  - examples/api-samples/views/layout.haml
186
217
  - examples/api-samples/views/sample1.haml
187
218
  - examples/api-samples/views/sample10.haml
219
+ - examples/api-samples/views/sample11.haml
220
+ - examples/api-samples/views/sample12.haml
221
+ - examples/api-samples/views/sample13.haml
222
+ - examples/api-samples/views/sample14.haml
223
+ - examples/api-samples/views/sample15.haml
224
+ - examples/api-samples/views/sample16.haml
225
+ - examples/api-samples/views/sample17.haml
226
+ - examples/api-samples/views/sample18.haml
188
227
  - examples/api-samples/views/sample2.haml
189
228
  - examples/api-samples/views/sample3.haml
190
229
  - examples/api-samples/views/sample4.haml
@@ -397,6 +436,7 @@ files:
397
436
  - spec/support/json/template_get_recipients.json
398
437
  - spec/support/json/templates_all.json
399
438
  - spec/support/json/templates_get.json
439
+ - spec/support/json/update_account.json
400
440
  - spec/support/json/user_profile_get.json
401
441
  - spec/support/json/user_users_get.json
402
442
  - spec/support/shared_examples/api/entity.rb
@@ -422,7 +462,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
422
462
  version: '0'
423
463
  segments:
424
464
  - 0
425
- hash: 4279493865227612838
465
+ hash: -3701528332984987950
426
466
  required_rubygems_version: !ruby/object:Gem::Requirement
427
467
  none: false
428
468
  requirements:
@@ -431,7 +471,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
431
471
  version: '0'
432
472
  segments:
433
473
  - 0
434
- hash: 4279493865227612838
474
+ hash: -3701528332984987950
435
475
  requirements: []
436
476
  rubyforge_project:
437
477
  rubygems_version: 1.8.24
@@ -580,6 +620,7 @@ test_files:
580
620
  - spec/support/json/template_get_recipients.json
581
621
  - spec/support/json/templates_all.json
582
622
  - spec/support/json/templates_get.json
623
+ - spec/support/json/update_account.json
583
624
  - spec/support/json/user_profile_get.json
584
625
  - spec/support/json/user_users_get.json
585
626
  - spec/support/shared_examples/api/entity.rb