groupdocs 1.5.3 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +0 -1
- data/README.md +2 -0
- data/examples/api-samples/public/docs/annotation-sample.html +167 -57
- data/examples/api-samples/public/docs/docco.css +459 -151
- data/examples/api-samples/public/docs/envelope-sample.html +373 -131
- data/examples/api-samples/public/docs/sample1.html +126 -26
- data/examples/api-samples/public/docs/sample10.html +213 -50
- data/examples/api-samples/public/docs/sample11.html +319 -87
- data/examples/api-samples/public/docs/sample12.html +165 -40
- data/examples/api-samples/public/docs/sample13.html +166 -41
- data/examples/api-samples/public/docs/sample14.html +142 -30
- data/examples/api-samples/public/docs/sample15.html +127 -27
- data/examples/api-samples/public/docs/sample16.html +125 -25
- data/examples/api-samples/public/docs/sample17.html +188 -37
- data/examples/api-samples/public/docs/sample18.html +614 -157
- data/examples/api-samples/public/docs/sample19.html +221 -59
- data/examples/api-samples/public/docs/sample2.html +142 -30
- data/examples/api-samples/public/docs/sample20.html +176 -51
- data/examples/api-samples/public/docs/sample21.html +287 -66
- data/examples/api-samples/public/docs/sample22.html +224 -53
- data/examples/api-samples/public/docs/sample23.html +256 -0
- data/examples/api-samples/public/docs/sample24.html +143 -0
- data/examples/api-samples/public/docs/sample25.html +429 -0
- data/examples/api-samples/public/docs/sample26.html +113 -0
- data/examples/api-samples/public/docs/sample27.html +433 -0
- data/examples/api-samples/public/docs/sample28.html +185 -0
- data/examples/api-samples/public/docs/sample29.html +175 -0
- data/examples/api-samples/public/docs/sample3.html +172 -34
- data/examples/api-samples/public/docs/sample30.html +144 -0
- data/examples/api-samples/public/docs/sample31.html +734 -0
- data/examples/api-samples/public/docs/sample4.html +204 -52
- data/examples/api-samples/public/docs/sample5.html +241 -63
- data/examples/api-samples/public/docs/sample6.html +209 -48
- data/examples/api-samples/public/docs/sample7.html +155 -43
- data/examples/api-samples/public/docs/sample8.html +235 -62
- data/examples/api-samples/public/docs/sample9.html +200 -49
- data/examples/api-samples/public/templates/merge_field1_doc.docx +0 -0
- data/examples/api-samples/public/templates/merge_field2_doc.docx +0 -0
- data/examples/api-samples/samples/sample23.rb +54 -0
- data/examples/api-samples/samples/sample24.rb +30 -0
- data/examples/api-samples/samples/sample25.rb +4 -4
- data/examples/api-samples/samples/sample26.rb +25 -0
- data/examples/api-samples/samples/sample27.rb +100 -0
- data/examples/api-samples/samples/sample28.rb +47 -0
- data/examples/api-samples/samples/sample29.rb +52 -0
- data/examples/api-samples/samples/sample30.rb +39 -0
- data/examples/api-samples/samples/sample31.rb +204 -0
- data/examples/api-samples/samples/sample5.rb +5 -3
- data/examples/api-samples/samples/sample6.rb +2 -0
- data/examples/api-samples/views/_others_samples.haml +12 -0
- data/examples/api-samples/views/index.haml +12 -0
- data/examples/api-samples/views/layout.haml +1 -0
- data/examples/api-samples/views/sample1.haml +3 -2
- data/examples/api-samples/views/sample10.haml +3 -2
- data/examples/api-samples/views/sample11.haml +4 -0
- data/examples/api-samples/views/sample12.haml +4 -0
- data/examples/api-samples/views/sample13.haml +4 -0
- data/examples/api-samples/views/sample14.haml +4 -0
- data/examples/api-samples/views/sample15.haml +4 -0
- data/examples/api-samples/views/sample16.haml +4 -0
- data/examples/api-samples/views/sample17.haml +4 -0
- data/examples/api-samples/views/sample19.haml +4 -0
- data/examples/api-samples/views/sample2.haml +3 -2
- data/examples/api-samples/views/sample20.haml +4 -0
- data/examples/api-samples/views/sample21.haml +4 -0
- data/examples/api-samples/views/sample22.haml +4 -0
- data/examples/api-samples/views/sample23.haml +87 -0
- data/examples/api-samples/views/sample24.haml +44 -0
- data/examples/api-samples/views/sample26.haml +54 -0
- data/examples/api-samples/views/sample27.haml +122 -0
- data/examples/api-samples/views/sample28.haml +47 -0
- data/examples/api-samples/views/sample29.haml +70 -0
- data/examples/api-samples/views/sample3.haml +3 -2
- data/examples/api-samples/views/sample30.haml +46 -0
- data/examples/api-samples/views/sample31.haml +114 -0
- data/examples/api-samples/views/sample4.haml +3 -2
- data/examples/api-samples/views/sample5.haml +3 -2
- data/examples/api-samples/views/sample6.haml +3 -2
- data/examples/api-samples/views/sample7.haml +3 -2
- data/examples/api-samples/views/sample8.haml +3 -2
- data/examples/api-samples/views/sample9.haml +3 -2
- data/examples/viewer/Gemfile +1 -1
- data/groupdocs.gemspec +3 -3
- data/lib/groupdocs/datasource.rb +22 -0
- data/lib/groupdocs/document.rb +493 -43
- data/lib/groupdocs/document/annotation.rb +73 -0
- data/lib/groupdocs/job.rb +82 -1
- data/lib/groupdocs/post.rb +83 -0
- data/lib/groupdocs/questionnaire.rb +41 -0
- data/lib/groupdocs/signature.rb +342 -0
- data/lib/groupdocs/signature/envelope.rb +56 -0
- data/lib/groupdocs/signature/form.rb +47 -5
- data/lib/groupdocs/signature/shared/field_methods.rb +37 -0
- data/lib/groupdocs/storage/file.rb +83 -0
- data/lib/groupdocs/subscription.rb +218 -0
- data/lib/groupdocs/user.rb +422 -1
- data/lib/groupdocs/version.rb +1 -1
- data/spec/groupdocs/job_spec.rb +4 -5
- data/spec/groupdocs/user_spec.rb +157 -0
- data/spec/support/json/annotation_resize.json +11 -0
- data/spec/support/json/annotation_text_color.json +10 -0
- data/spec/support/json/annotation_text_info.json +11 -0
- data/spec/support/json/document_content_get.json +8 -0
- data/spec/support/json/document_edit_lock_get.json +10 -0
- data/spec/support/json/document_editlock_remove.json +8 -0
- data/spec/support/json/document_page_html_urls_get.json +14 -0
- data/spec/support/json/document_password_set.json +19 -0
- data/spec/support/json/document_representations.json +25 -0
- data/spec/support/json/document_shared_documents_get.json +32 -0
- data/spec/support/json/document_tags_get.json +9 -0
- data/spec/support/json/document_tags_remove.json +8 -0
- data/spec/support/json/document_tags_set.json +8 -0
- data/spec/support/json/document_user_status_set.json +12 -0
- data/spec/support/json/job_documents.json +103 -35
- data/spec/support/json/job_xml_get.json +30 -0
- data/spec/support/json/jobs_documents.json +40 -0
- data/spec/support/json/user_get_profile.json +73 -0
- metadata +49 -177
@@ -460,5 +460,61 @@ module GroupDocs
|
|
460
460
|
end.execute!
|
461
461
|
end
|
462
462
|
|
463
|
+
#
|
464
|
+
# Get signed envelope document.
|
465
|
+
#
|
466
|
+
# @example
|
467
|
+
# envelope = GroupDocs::Signature::Envelope.get!("g94h5g84hj9g4gf23i40j")
|
468
|
+
# document = GroupDocs::Storage::Folder.list!.last.to_document
|
469
|
+
# envelope.add_document! document
|
470
|
+
#
|
471
|
+
# @param [GroupDocs::Document] document
|
472
|
+
# @param [Hash] access Access credentials
|
473
|
+
# @option access [String] :client_id
|
474
|
+
# @option access [String] :private_key
|
475
|
+
# @raise [ArgumentError] if document is not GroupDocs::Document
|
476
|
+
#
|
477
|
+
def get_envelope!(document, access = {})
|
478
|
+
document.is_a?(GroupDocs::Document) or raise ArgumentError,
|
479
|
+
"Document should be GroupDocs::Document object, received: #{document.inspect}"
|
480
|
+
|
481
|
+
Api::Request.new do |request|
|
482
|
+
request[:access] = access
|
483
|
+
request[:method] = :GET
|
484
|
+
request[:path] = "/signature/{{client_id}}/#{class_name.pluralize}/#{id}/document/#{document.file.guid}"
|
485
|
+
end.execute!
|
486
|
+
|
487
|
+
end
|
488
|
+
|
489
|
+
#
|
490
|
+
# Cancel envelope.
|
491
|
+
#
|
492
|
+
# @param [Hash] access Access credentials
|
493
|
+
# @option access [String] :client_id
|
494
|
+
# @option access [String] :private_key
|
495
|
+
#
|
496
|
+
def cancel!( access = {})
|
497
|
+
Api::Request.new do |request|
|
498
|
+
request[:access] = access
|
499
|
+
request[:method] = :PUT
|
500
|
+
request[:path] = "/signature/{{client_id}}/envelopes/#{id}/cancel"
|
501
|
+
end.execute!
|
502
|
+
end
|
503
|
+
|
504
|
+
#
|
505
|
+
# Retry sign envelope.
|
506
|
+
#
|
507
|
+
# @param [Hash] access Access credentials
|
508
|
+
# @option access [String] :client_id
|
509
|
+
# @option access [String] :private_key
|
510
|
+
#
|
511
|
+
def retry!(access = {})
|
512
|
+
Api::Request.new do |request|
|
513
|
+
request[:access] = access
|
514
|
+
request[:method] = :PUT
|
515
|
+
request[:path] = "/signature/{{client_id}}/envelopes/#{id}/retry"
|
516
|
+
end.execute!
|
517
|
+
end
|
518
|
+
|
463
519
|
end # Signature::Envelope
|
464
520
|
end # GroupDocs
|
@@ -102,6 +102,9 @@ module GroupDocs
|
|
102
102
|
attr_accessor :waterMarkText
|
103
103
|
# @attr [String] waterMarkImage
|
104
104
|
attr_accessor :waterMarkImage
|
105
|
+
# @attr [Boolean] notifyOwnerOnSign
|
106
|
+
attr_accessor :notifyOwnerOnSign
|
107
|
+
|
105
108
|
|
106
109
|
# Human-readable accessors
|
107
110
|
alias_accessor :owner_guid, :ownerGuid
|
@@ -114,6 +117,8 @@ module GroupDocs
|
|
114
117
|
alias_accessor :can_participant_download_form, :canParticipantDownloadForm
|
115
118
|
alias_accessor :water_mark_text, :waterMarkText
|
116
119
|
alias_accessor :water_mark_image, :waterMarkImage
|
120
|
+
alias_accessor :notifyOwnerOnSign, :notifyOwnerOnSign
|
121
|
+
|
117
122
|
|
118
123
|
#
|
119
124
|
# Converts status to human-readable format.
|
@@ -160,17 +165,19 @@ module GroupDocs
|
|
160
165
|
# @raise [ArgumentError] if template is not GroupDocs::Signature::Template
|
161
166
|
#
|
162
167
|
def create!(options = {}, access = {})
|
163
|
-
template_id = options.delete(:template_id)
|
164
|
-
assembly_id = options.delete(:assembly_id)
|
165
|
-
options[:templateId] = template_id if template_id
|
166
|
-
options[:assemblyId] = assembly_id if assembly_id
|
168
|
+
#template_id = options.delete(:template_id)
|
169
|
+
#assembly_id = options.delete(:assembly_id)
|
170
|
+
#options[:templateId] = template_id if template_id
|
171
|
+
#options[:assemblyId] = assembly_id if assembly_id
|
167
172
|
|
168
173
|
api = Api::Request.new do |request|
|
169
174
|
request[:access] = access
|
170
175
|
request[:method] = :POST
|
171
176
|
request[:path] = '/signature/{{client_id}}/form'
|
172
177
|
request[:request_body] = to_hash
|
178
|
+
|
173
179
|
end
|
180
|
+
|
174
181
|
api.add_params(options.merge(:name => name))
|
175
182
|
json = api.execute!
|
176
183
|
|
@@ -209,12 +216,14 @@ module GroupDocs
|
|
209
216
|
# @param [Hash] access Access credentials
|
210
217
|
# @option access [String] :client_id
|
211
218
|
# @option access [String] :private_key
|
219
|
+
# @param callbackUrl [String]:callbackUrl Webhook Callback Url
|
212
220
|
#
|
213
|
-
def publish!(access = {})
|
221
|
+
def publish!(callbackUrl, access = {})
|
214
222
|
Api::Request.new do |request|
|
215
223
|
request[:access] = access
|
216
224
|
request[:method] = :PUT
|
217
225
|
request[:path] = "/signature/{{client_id}}/forms/#{id}/publish"
|
226
|
+
request[:request_body] = callbackUrl
|
218
227
|
end.execute!
|
219
228
|
end
|
220
229
|
|
@@ -373,5 +382,38 @@ module GroupDocs
|
|
373
382
|
end.execute!
|
374
383
|
end
|
375
384
|
|
385
|
+
#
|
386
|
+
# Modify signature form document
|
387
|
+
#
|
388
|
+
# @example
|
389
|
+
# form = GroupDocs::Signature::Form.get!("g94h5g84hj9g4gf23i40j")
|
390
|
+
# document = envelope.documents!.first
|
391
|
+
# recipient = envelope.recipients!.first
|
392
|
+
# field = envelope.fields!(document, recipient).first
|
393
|
+
# field.name = "Field"
|
394
|
+
# envelope.modify_field! field, document
|
395
|
+
#
|
396
|
+
#
|
397
|
+
# @param [GroupDocs::Document] document
|
398
|
+
# @param [Hash] options
|
399
|
+
# @option options [Integer] Order
|
400
|
+
# @option options [String] newDocumentGuid
|
401
|
+
# @param [Hash] access Access credentials
|
402
|
+
# @option access [String] :client_id
|
403
|
+
# @option access [String] :private_key
|
404
|
+
# @raise [ArgumentError] if document is not GroupDocs::Document
|
405
|
+
#
|
406
|
+
def modify_form_document!(document, options = {}, access = {})
|
407
|
+
document.is_a?(GroupDocs::Document) or raise ArgumentError,
|
408
|
+
"Document should be GroupDocs::Document object, received: #{document.inspect}"
|
409
|
+
|
410
|
+
Api::Request.new do |request|
|
411
|
+
request[:access] = access
|
412
|
+
request[:method] = :PUT
|
413
|
+
request[:path] = "/signature/{{client_id}}/forms/#{form}/document/#{document.file.guid}/"
|
414
|
+
request[:request_body] = options
|
415
|
+
end.execute!
|
416
|
+
end
|
417
|
+
|
376
418
|
end # Signature::Form
|
377
419
|
end # GroupDocs
|
@@ -233,6 +233,43 @@ module GroupDocs
|
|
233
233
|
end.execute!
|
234
234
|
end
|
235
235
|
|
236
|
+
#
|
237
|
+
# Rename signature template document
|
238
|
+
#
|
239
|
+
# @example Rename field from template
|
240
|
+
# template = GroupDocs::Signature::Template.get!("g94h5g84hj9g4gf23i40j")
|
241
|
+
# document = template.documents!.first
|
242
|
+
# template.rename_field! (new_name, document)
|
243
|
+
#
|
244
|
+
# @example Rename field from envelope
|
245
|
+
# envelope = GroupDocs::Signature::Envelope.get!("g94h5g84hj9g4gf23i40j")
|
246
|
+
# document = envelope.documents!.first
|
247
|
+
# envelope.rename_field! (new_name, document)
|
248
|
+
#
|
249
|
+
# @example Rename field from form
|
250
|
+
# envelope = GroupDocs::Signature::Form.get!("g94h5g84hj9g4gf23i40j")
|
251
|
+
# document = envelope.documents!.first
|
252
|
+
# envelope.rename_field! (new_name, document)
|
253
|
+
#
|
254
|
+
# @param [GroupDocs::Signature::Field] field
|
255
|
+
# @param [Hash] access Access credentials
|
256
|
+
# @option access [String] :client_id
|
257
|
+
# @option access [String] :private_key
|
258
|
+
# @raise [ArgumentError] if field is not GroupDocs::Signature::Field
|
259
|
+
#
|
260
|
+
def rename_field!(new_name, document, access = {})
|
261
|
+
field.is_a?(GroupDocs::Signature::Field) or raise ArgumentError,
|
262
|
+
"Field should be GroupDocs::Signature::Field object, received: #{field.inspect}"
|
263
|
+
|
264
|
+
api = Api::Request.new do |request|
|
265
|
+
request[:access] = access
|
266
|
+
request[:method] = :PUT
|
267
|
+
request[:path] = "/signature/{{client_id}}/#{class_name.pluralize}/#{id}/document/#{document.file.id}"
|
268
|
+
end
|
269
|
+
api.add_params(new_name).execute!
|
270
|
+
|
271
|
+
end
|
272
|
+
|
236
273
|
#
|
237
274
|
# Modifies field location.
|
238
275
|
#
|
@@ -53,6 +53,27 @@ module GroupDocs
|
|
53
53
|
Storage::File.new(json)
|
54
54
|
end
|
55
55
|
|
56
|
+
|
57
|
+
#
|
58
|
+
# Get shared file.
|
59
|
+
#
|
60
|
+
# @param [String] file_path
|
61
|
+
# @param [String] user_email
|
62
|
+
#
|
63
|
+
def get_shared_file!(user_email, file_path)
|
64
|
+
response = Api::Request.new do |request|
|
65
|
+
request[:access] = access
|
66
|
+
request[:method] = :GET
|
67
|
+
request[:path] = "/storage/shared/#{user_email}/#{file_path}"
|
68
|
+
end.execute!
|
69
|
+
|
70
|
+
Object::File.open(file_path, 'wb') do |file|
|
71
|
+
file.write(response)
|
72
|
+
end
|
73
|
+
|
74
|
+
file_path
|
75
|
+
end
|
76
|
+
|
56
77
|
#
|
57
78
|
# Uploads web page as file.
|
58
79
|
#
|
@@ -74,6 +95,53 @@ module GroupDocs
|
|
74
95
|
Storage::File.new(json)
|
75
96
|
end
|
76
97
|
|
98
|
+
#
|
99
|
+
# Uploads google page as file.
|
100
|
+
#
|
101
|
+
# @param [String] path
|
102
|
+
# @param [Hash] access Access credentials
|
103
|
+
# @option access [String] :client_id
|
104
|
+
# @option access [String] :private_key
|
105
|
+
# @return [GroupDocs::Storage::File]
|
106
|
+
#
|
107
|
+
def upload_google!(path, file_id, access = {})
|
108
|
+
api = Api::Request.new do |request|
|
109
|
+
request[:access] = access
|
110
|
+
request[:method] = :POST
|
111
|
+
request[:path] = "/storage/{{client_id}}/google/files/#{path}/"
|
112
|
+
end
|
113
|
+
|
114
|
+
api.add_params(:file_id => file_id)
|
115
|
+
json = api.execute!
|
116
|
+
|
117
|
+
Storage::File.new(json)
|
118
|
+
end
|
119
|
+
|
120
|
+
#
|
121
|
+
# Uploads and unzip as file.
|
122
|
+
#
|
123
|
+
# @param [String] path
|
124
|
+
# @param [Hash] options
|
125
|
+
# @option description [String]
|
126
|
+
# @option archiveType [String]
|
127
|
+
# @param [Hash] access Access credentials
|
128
|
+
# @option access [String] :client_id
|
129
|
+
# @option access [String] :private_key
|
130
|
+
# @return [GroupDocs::Storage::File]
|
131
|
+
#
|
132
|
+
def decompress!(path, file_zip, options = {}, access = {})
|
133
|
+
api = Api::Request.new do |request|
|
134
|
+
request[:access] = access
|
135
|
+
request[:method] = :POST
|
136
|
+
request[:path] = "/storage/{{client_id}}/decompress/#{path}/"
|
137
|
+
request[:request_body] = file_zip
|
138
|
+
end
|
139
|
+
api.add_params(options)
|
140
|
+
json = api.execute!
|
141
|
+
|
142
|
+
Storage::File.new(json)
|
143
|
+
end
|
144
|
+
|
77
145
|
# @attr [Integer] id
|
78
146
|
attr_accessor :id
|
79
147
|
# @attr [String] guid
|
@@ -305,6 +373,21 @@ module GroupDocs
|
|
305
373
|
end.execute!
|
306
374
|
end
|
307
375
|
|
376
|
+
#
|
377
|
+
# Restore file from trash on server.
|
378
|
+
#
|
379
|
+
# @param [Hash] access Access credentials
|
380
|
+
# @option access [String] :client_id
|
381
|
+
# @option access [String] :private_key
|
382
|
+
#
|
383
|
+
def restore_to_trash!(path, access = {})
|
384
|
+
Api::Request.new do |request|
|
385
|
+
request[:access] = access
|
386
|
+
request[:method] = :DELETE
|
387
|
+
request[:path] = "/storage/{{client_id}}/trash/#{path}/"
|
388
|
+
end.execute!
|
389
|
+
end
|
390
|
+
|
308
391
|
#
|
309
392
|
# Converts file to GroupDocs::Document.
|
310
393
|
#
|
@@ -43,6 +43,201 @@ module GroupDocs
|
|
43
43
|
new(json)
|
44
44
|
end
|
45
45
|
|
46
|
+
#
|
47
|
+
# Simulate Assess For Pricing Plan.
|
48
|
+
#
|
49
|
+
# @param [String] discount_code Discount code
|
50
|
+
# @param [String] plan_id Subscription Plan Id
|
51
|
+
# @param [Hash] access Access credentials
|
52
|
+
# @option access [String] :client_id
|
53
|
+
# @option access [String] :private_key
|
54
|
+
# @return [Array] Invoices
|
55
|
+
#
|
56
|
+
def self.invoices!(discount_code, plan_id, access = {})
|
57
|
+
json = Api::Request.new do |request|
|
58
|
+
request[:access] = access
|
59
|
+
request[:method] = :GET
|
60
|
+
request[:path] = "/system/{{client_id}}/plans/#{plan_id}/discounts/#{discount_code}"
|
61
|
+
end.execute!
|
62
|
+
|
63
|
+
json[:invoices]
|
64
|
+
end
|
65
|
+
|
66
|
+
#
|
67
|
+
# Returns user subscription plan.
|
68
|
+
#
|
69
|
+
# @param [Hash] access Access credentials
|
70
|
+
# @option access [String] :client_id
|
71
|
+
# @option access [String] :private_key
|
72
|
+
# @return [GroupDocs::Subscription]
|
73
|
+
#
|
74
|
+
def self.subscription!(access = {})
|
75
|
+
Api::Request.new do |request|
|
76
|
+
request[:access] = access
|
77
|
+
request[:method] = :GET
|
78
|
+
request[:path] = '/system/{{client_id}}/subscription'
|
79
|
+
end.execute!
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
#
|
84
|
+
# Set subscription plan user plan.
|
85
|
+
# @param [Hash] plan Subscription Plan Info
|
86
|
+
# @param [String] product_id
|
87
|
+
# @param [Hash] access Access credentials
|
88
|
+
# @option access [String] :client_id
|
89
|
+
# @option access [String] :private_key
|
90
|
+
# @return [GroupDocs::Subscription]
|
91
|
+
#
|
92
|
+
def self.set_subscription!(plan, product_id, access = {})
|
93
|
+
json = Api::Request.new do |request|
|
94
|
+
request[:access] = access
|
95
|
+
request[:method] = :PUT
|
96
|
+
request[:path] = "/system/{{client_id}}/subscriptions/#{product_id}"
|
97
|
+
request[:request_body] = plan
|
98
|
+
end.execute!
|
99
|
+
|
100
|
+
new(json)
|
101
|
+
end
|
102
|
+
|
103
|
+
#
|
104
|
+
# Set subscription plan user plan.
|
105
|
+
# @param [Hash] plan Update Subscription Plan Info
|
106
|
+
# @param [String] product_id
|
107
|
+
# @param [Hash] access Access credentials
|
108
|
+
# @option access [String] :client_id
|
109
|
+
# @option access [String] :private_key
|
110
|
+
# @return [GroupDocs::Subscription]
|
111
|
+
#
|
112
|
+
def self.update_subscription!(plan, product_id, access = {})
|
113
|
+
json = Api::Request.new do |request|
|
114
|
+
request[:access] = access
|
115
|
+
request[:method] = :POST
|
116
|
+
request[:path] = "/system/{{client_id}}/subscriptions/#{product_id}"
|
117
|
+
request[:request_body] = plan
|
118
|
+
end.execute!
|
119
|
+
|
120
|
+
new(json)
|
121
|
+
end
|
122
|
+
|
123
|
+
#
|
124
|
+
# Returns countries.
|
125
|
+
#
|
126
|
+
# @param [Hash] access Access credentials
|
127
|
+
# @option access [String] :client_id
|
128
|
+
# @option access [String] :private_key
|
129
|
+
# @return [GroupDocs::Subscription]
|
130
|
+
#
|
131
|
+
def self.get_countries!(access = {})
|
132
|
+
json = Api::Request.new do |request|
|
133
|
+
request[:access] = access
|
134
|
+
request[:method] = :GET
|
135
|
+
request[:path] = '/system/{{client_id}}/countries'
|
136
|
+
end.execute!
|
137
|
+
|
138
|
+
json[:countries]
|
139
|
+
end
|
140
|
+
|
141
|
+
#
|
142
|
+
# Returns states.
|
143
|
+
#
|
144
|
+
# @param [String] name Country name
|
145
|
+
# @param [Hash] access Access credentials
|
146
|
+
# @option access [String] :client_id
|
147
|
+
# @option access [String] :private_key
|
148
|
+
# @return [GroupDocs::Subscription]
|
149
|
+
#
|
150
|
+
def self.get_states!(name, access = {})
|
151
|
+
json = Api::Request.new do |request|
|
152
|
+
request[:access] = access
|
153
|
+
request[:method] = :GET
|
154
|
+
request[:path] = "/system/{{client_id}}/countries/#{name}/states"
|
155
|
+
end.execute!
|
156
|
+
|
157
|
+
json[:states]
|
158
|
+
end
|
159
|
+
|
160
|
+
#
|
161
|
+
# Set user billing address.
|
162
|
+
#
|
163
|
+
# @param [Hash] billing Billing address info
|
164
|
+
# @param [Hash] access Access credentials
|
165
|
+
# @option access [String] :client_id
|
166
|
+
# @option access [String] :private_key
|
167
|
+
# @return [GroupDocs::Subscription]
|
168
|
+
#
|
169
|
+
def self.set_billing!(billing = {}, access = {})
|
170
|
+
json = Api::Request.new do |request|
|
171
|
+
request[:access] = access
|
172
|
+
request[:method] = :GET
|
173
|
+
request[:path] = "/system/{{client_id}}/billingaddress"
|
174
|
+
request[:request_body] = billing
|
175
|
+
end.execute!
|
176
|
+
|
177
|
+
json[:billing_address]
|
178
|
+
end
|
179
|
+
|
180
|
+
#
|
181
|
+
# Get invoices.
|
182
|
+
#
|
183
|
+
# @param [Hash] options
|
184
|
+
# @option options [String] :pageNumber
|
185
|
+
# @option options [String] :pageSize
|
186
|
+
# @param [Hash] access Access credentials
|
187
|
+
# @option access [String] :client_id
|
188
|
+
# @option access [String] :private_key
|
189
|
+
# @return [Array] Invoices
|
190
|
+
#
|
191
|
+
def self.get_invoices!(options = {}, access = {})
|
192
|
+
api = Api::Request.new do |request|
|
193
|
+
request[:access] = access
|
194
|
+
request[:method] = :GET
|
195
|
+
request[:path] = "/system/{{client_id}}/invoices"
|
196
|
+
end
|
197
|
+
api.add_params(options)
|
198
|
+
json = api.execute!
|
199
|
+
|
200
|
+
json[:invoices]
|
201
|
+
end
|
202
|
+
|
203
|
+
#
|
204
|
+
# Get subscription plans.
|
205
|
+
#
|
206
|
+
# @param [Hash] access Access credentials
|
207
|
+
# @option access [String] :client_id
|
208
|
+
# @option access [String] :private_key
|
209
|
+
#
|
210
|
+
def self.get_plans!(access = {})
|
211
|
+
json = Api::Request.new do |request|
|
212
|
+
request[:access] = access
|
213
|
+
request[:method] = :GET
|
214
|
+
request[:path] = "/system/{{client_id}}/usage"
|
215
|
+
end
|
216
|
+
|
217
|
+
new(json)
|
218
|
+
end
|
219
|
+
|
220
|
+
#
|
221
|
+
# Returns purchase wizard info from billing provider.
|
222
|
+
#
|
223
|
+
# @param [Hash] access Access credentials
|
224
|
+
# @option access [String] :client_id
|
225
|
+
# @option access [String] :private_key
|
226
|
+
# @return [String] Url
|
227
|
+
#
|
228
|
+
def self.get_wizard!(access = {})
|
229
|
+
json = Api::Request.new do |request|
|
230
|
+
request[:access] = access
|
231
|
+
request[:method] = :GET
|
232
|
+
request[:path] = "/system/{{client_id}}/purchase/wizard"
|
233
|
+
end
|
234
|
+
|
235
|
+
json[:url]
|
236
|
+
end
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
46
241
|
#
|
47
242
|
# Returns all subscription plans for family.
|
48
243
|
#
|
@@ -63,6 +258,29 @@ module GroupDocs
|
|
63
258
|
end
|
64
259
|
end
|
65
260
|
|
261
|
+
#
|
262
|
+
# Returns suggestions for a specified term
|
263
|
+
#
|
264
|
+
# @param [String] term A term to return suggestions for
|
265
|
+
# @param [Hash] access Access credentials
|
266
|
+
# @option access [String] :client_id
|
267
|
+
# @option access [String] :private_key
|
268
|
+
# @return [Array<GroupDocs::Subscription>]
|
269
|
+
#
|
270
|
+
def self.get_term!(term , access = {})
|
271
|
+
json = Api::Request.new do |request|
|
272
|
+
request[:access] = access
|
273
|
+
request[:method] = :GET
|
274
|
+
request[:path] = "/system/{{client_id}}/terms/#{term}/suggestions"
|
275
|
+
end.execute!
|
276
|
+
|
277
|
+
json[:suggestions].map do |element|
|
278
|
+
new(element)
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
|
283
|
+
|
66
284
|
# @attr [Integer] Id
|
67
285
|
attr_accessor :Id
|
68
286
|
# @attr [String] Name
|