groupdocs 1.2.11 → 1.3.0

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.
Files changed (117) hide show
  1. data/.travis.yml +2 -0
  2. data/Gemfile +1 -1
  3. data/README.md +0 -2
  4. data/Rakefile +1 -1
  5. data/examples/api-samples/Gemfile +1 -1
  6. data/examples/api-samples/samples/annotation-sample.rb +50 -0
  7. data/examples/api-samples/samples/sample18.rb +11 -2
  8. data/examples/api-samples/samples/sample19.rb +58 -0
  9. data/examples/api-samples/samples/sample20.rb +50 -0
  10. data/examples/api-samples/samples/sample21.rb +65 -0
  11. data/examples/api-samples/samples/sample22.rb +52 -0
  12. data/examples/api-samples/views/annotation_sample.haml +64 -0
  13. data/examples/api-samples/views/index.haml +8 -0
  14. data/examples/api-samples/views/sample1.haml +9 -1
  15. data/examples/api-samples/views/sample10.haml +9 -1
  16. data/examples/api-samples/views/sample11.haml +10 -0
  17. data/examples/api-samples/views/sample12.haml +8 -0
  18. data/examples/api-samples/views/sample13.haml +8 -0
  19. data/examples/api-samples/views/sample14.haml +8 -0
  20. data/examples/api-samples/views/sample15.haml +8 -0
  21. data/examples/api-samples/views/sample16.haml +8 -0
  22. data/examples/api-samples/views/sample17.haml +8 -0
  23. data/examples/api-samples/views/sample18.haml +11 -0
  24. data/examples/api-samples/views/sample19.haml +102 -0
  25. data/examples/api-samples/views/sample2.haml +9 -1
  26. data/examples/api-samples/views/sample20.haml +89 -0
  27. data/examples/api-samples/views/sample21.haml +106 -0
  28. data/examples/api-samples/views/sample22.haml +107 -0
  29. data/examples/api-samples/views/sample3.haml +10 -2
  30. data/examples/api-samples/views/sample4.haml +8 -0
  31. data/examples/api-samples/views/sample5.haml +8 -0
  32. data/examples/api-samples/views/sample6.haml +8 -0
  33. data/examples/api-samples/views/sample7.haml +9 -1
  34. data/examples/api-samples/views/sample8.haml +10 -2
  35. data/examples/api-samples/views/sample9.haml +10 -2
  36. data/groupdocs.gemspec +4 -3
  37. data/lib/groupdocs.rb +2 -4
  38. data/lib/groupdocs/api.rb +2 -0
  39. data/lib/groupdocs/api/entity.rb +4 -36
  40. data/lib/groupdocs/api/helpers/access_rights_helper.rb +4 -4
  41. data/lib/groupdocs/api/helpers/byte_flag_helper.rb +3 -3
  42. data/lib/groupdocs/api/helpers/rest_helper.rb +5 -5
  43. data/lib/groupdocs/api/helpers/status_helper.rb +2 -2
  44. data/lib/groupdocs/api/helpers/url_helper.rb +2 -2
  45. data/lib/groupdocs/document.rb +55 -24
  46. data/lib/groupdocs/document/annotation.rb +7 -7
  47. data/lib/groupdocs/document/annotation/reply.rb +2 -2
  48. data/lib/groupdocs/document/view.rb +1 -1
  49. data/lib/groupdocs/job.rb +20 -20
  50. data/lib/groupdocs/questionnaire.rb +2 -2
  51. data/lib/groupdocs/questionnaire/collector.rb +2 -2
  52. data/lib/groupdocs/questionnaire/execution.rb +1 -1
  53. data/lib/groupdocs/questionnaire/question.rb +2 -2
  54. data/lib/groupdocs/signature.rb +1 -1
  55. data/lib/groupdocs/signature/envelope.rb +19 -19
  56. data/lib/groupdocs/signature/field.rb +6 -6
  57. data/lib/groupdocs/signature/form.rb +7 -7
  58. data/lib/groupdocs/signature/list.rb +2 -2
  59. data/lib/groupdocs/signature/recipient.rb +6 -6
  60. data/lib/groupdocs/signature/shared/document_methods.rb +5 -5
  61. data/lib/groupdocs/signature/shared/entity_methods.rb +4 -4
  62. data/lib/groupdocs/signature/shared/field_methods.rb +8 -8
  63. data/lib/groupdocs/signature/shared/recipient_methods.rb +2 -2
  64. data/lib/groupdocs/signature/shared/resource_methods.rb +1 -1
  65. data/lib/groupdocs/signature/template.rb +4 -4
  66. data/lib/groupdocs/storage.rb +4 -4
  67. data/lib/groupdocs/storage/file.rb +4 -4
  68. data/lib/groupdocs/storage/folder.rb +4 -4
  69. data/lib/groupdocs/subscription.rb +15 -15
  70. data/lib/groupdocs/version.rb +1 -1
  71. data/spec/groupdocs/api/entity_spec.rb +10 -37
  72. data/spec/groupdocs/api/helpers/access_mode_helper_spec.rb +1 -1
  73. data/spec/groupdocs/api/helpers/access_rights_helper_spec.rb +3 -3
  74. data/spec/groupdocs/api/helpers/credentials_helpers_spec.rb +5 -5
  75. data/spec/groupdocs/api/helpers/rest_helper_spec.rb +15 -15
  76. data/spec/groupdocs/api/helpers/status_helper_spec.rb +1 -1
  77. data/spec/groupdocs/api/helpers/url_helper_spec.rb +11 -11
  78. data/spec/groupdocs/api/request_spec.rb +6 -6
  79. data/spec/groupdocs/datasource_spec.rb +9 -9
  80. data/spec/groupdocs/document/annotation/reply_spec.rb +15 -15
  81. data/spec/groupdocs/document/annotation/reviewer_spec.rb +3 -3
  82. data/spec/groupdocs/document/annotation_spec.rb +17 -17
  83. data/spec/groupdocs/document/change_spec.rb +1 -1
  84. data/spec/groupdocs/document/field_spec.rb +1 -1
  85. data/spec/groupdocs/document/metadata_spec.rb +3 -3
  86. data/spec/groupdocs/document/view_spec.rb +4 -4
  87. data/spec/groupdocs/document_spec.rb +92 -66
  88. data/spec/groupdocs/job_spec.rb +29 -29
  89. data/spec/groupdocs/questionnaire/collector_spec.rb +15 -19
  90. data/spec/groupdocs/questionnaire/execution_spec.rb +12 -12
  91. data/spec/groupdocs/questionnaire/page_spec.rb +4 -4
  92. data/spec/groupdocs/questionnaire/question_spec.rb +6 -6
  93. data/spec/groupdocs/questionnaire_spec.rb +18 -18
  94. data/spec/groupdocs/signature/contact_spec.rb +9 -9
  95. data/spec/groupdocs/signature/envelope_spec.rb +34 -34
  96. data/spec/groupdocs/signature/field_spec.rb +13 -13
  97. data/spec/groupdocs/signature/form_spec.rb +9 -9
  98. data/spec/groupdocs/signature/list_spec.rb +3 -3
  99. data/spec/groupdocs/signature/role_spec.rb +2 -2
  100. data/spec/groupdocs/signature/template_spec.rb +6 -6
  101. data/spec/groupdocs/signature_spec.rb +3 -3
  102. data/spec/groupdocs/storage/file_spec.rb +20 -20
  103. data/spec/groupdocs/storage/folder_spec.rb +21 -21
  104. data/spec/groupdocs/storage/package_spec.rb +2 -2
  105. data/spec/groupdocs/storage_spec.rb +1 -1
  106. data/spec/groupdocs/subscription_spec.rb +3 -3
  107. data/spec/groupdocs/user_spec.rb +5 -5
  108. data/spec/spec_helper.rb +9 -7
  109. data/spec/support/json/document_thumbnails.json +24 -0
  110. data/spec/support/shared_examples/api/entity.rb +8 -8
  111. data/spec/support/shared_examples/signature/shared/document_methods.rb +8 -8
  112. data/spec/support/shared_examples/signature/shared/entity_fields.rb +3 -3
  113. data/spec/support/shared_examples/signature/shared/entity_methods.rb +12 -12
  114. data/spec/support/shared_examples/signature/shared/field_methods.rb +29 -29
  115. data/spec/support/shared_examples/signature/shared/recipient_methods.rb +3 -3
  116. data/spec/support/shared_examples/signature/shared/resource_methods.rb +2 -2
  117. metadata +33 -5
@@ -0,0 +1,107 @@
1
+ %h3{:style => "text-align:center;"}
2
+ %a{:href => "/"} GroupDocs Ruby SDK Samples
3
+ \- Sample22
4
+ .samplecontent{:style => "padding:10px;"}
5
+ %i This sample will show how to View Document pages as images using Ruby SDK
6
+ %br/
7
+ %br/
8
+ %p
9
+ You entered:
10
+ %p
11
+ UserId = #{(defined? userId) ? userId : ""}
12
+ %p
13
+ PrivateKey = #{(defined? privateKey) ? privateKey : ""}
14
+ %p
15
+ FileId = #{(defined? fileId) ? fileId : ""}
16
+ %p
17
+ Email = #{(defined? email) ? email : ""}
18
+ %p
19
+ First Name = #{(defined? first_name) ? first_name : ""}
20
+ %p
21
+ Last Name = #{(defined? last_name) ? last_name : ""}
22
+ %p
23
+ %font{:color => "red"} #{(defined? err) ? err : ""}
24
+ %br/
25
+ #requestForm{:style => "padding:20px; border:1px solid black;"}
26
+ %p Enter data for request and press "Make request" button
27
+ %form{:action => "/sample22", :method => "post"}
28
+ %label{:for => "client_id"} GroupDocs ClientID
29
+ %br/
30
+ %input{:type=>"text", :name=>"client_id"}
31
+ %br/
32
+ %label{:for => "private_key"} GroupDocs PrivateKey
33
+ %br/
34
+ %input{:type=>"text", :name=>"private_key"}
35
+ %br/
36
+ %label{:for => "file_id"} GroupDocs FileID
37
+ %br/
38
+ %input{:type=>"text", :name=>"fileId"}
39
+ %br/
40
+ %label{:for => "email"} E-mail
41
+ %br/
42
+ %input{:type=>"text", :name=>"email"}
43
+ %br/
44
+ %label{:for => "first_name"} First name
45
+ %br/
46
+ %input{:type=>"text", :name=>"first_name"}
47
+ %br/
48
+ %label{:for => "last_name"} Last name
49
+ %br/
50
+ %input{:type=>"text", :name=>"last_name"}
51
+ %br/
52
+ %input{:type => "submit", :value => "Make request"}/
53
+ %div{:style => "padding:20px; border:1px solid black;"}
54
+ %p
55
+ Results:
56
+ #{(defined? message) ? message : ""}
57
+ #{(defined? iframe) ? iframe : ""}
58
+
59
+ %div{:style => "padding:10px;"}
60
+ Choose another one sample:
61
+ %ul
62
+ %li
63
+ %a{:href => "/sample1"} Sample1 - How to login to GroupDocs using the API
64
+ %li
65
+ %a{:href => "/sample2"} Sample2 - How to list files within GroupDocs Storage using the Storage API
66
+ %li
67
+ %a{:href => "/sample3"} Sample3 - How to upload a file to GroupDocs using the Storage API
68
+ %li
69
+ %a{:href => "/sample4"} Sample4 - How to download a file from GroupDocs Storage using the Storage API
70
+ %li
71
+ %a{:href => "/sample5"} Sample5 - How to copy / move a file using the GroupDocs Storage API
72
+ %li
73
+ %a{:href => "/sample6"} Sample6 - How to add a Signature to a document in GroupDocs Signature
74
+ %li
75
+ %a{:href => "/sample7"} Sample7 - How to create a list of thumbnails for a document
76
+ %li
77
+ %a{:href => "/sample8"} Sample8 - How to return a URL representing a single page of a Document
78
+ %li
79
+ %a{:href => "/sample9"} Sample9 - How to generate an embedded Viewer URL for a Document
80
+ %li
81
+ %a{:href => "/sample10"} Sample10 - How to share a document to other users
82
+ %li
83
+ %a{:href => "/sample11"}Sample11 - How programmatically create and post an annotation into document. How to delete the annotation
84
+ %li
85
+ %a{:href => "/sample12"}Sample12 - How to list all annotations from document
86
+ %li
87
+ %a{:href => "/sample13"}Sample13 - How to add collaborator to doc with annotations
88
+ %li
89
+ %a{:href => "/sample14"}Sample14 - How to check the list of shares for a folder
90
+ %li
91
+ %a{:href => "/sample15"}Sample15 - How to check the number of document's views
92
+ %li
93
+ %a{:href => "/sample16"}Sample16 - How to insert Assembly questionary into webpage
94
+ %li
95
+ %a{:href => "/sample17"}Sample17 - How to upload a file into the storage and compress it into zip archive
96
+ %li
97
+ %a{:href => "/sample18"}Sample18 - How to convert Doc to Docx, Docx to Doc, Docx to PDF, PPT to PDF
98
+ %li
99
+ %a{:href => "/sample19"}Sample19 - How to Compare documents using Ruby SDK
100
+ %li
101
+ %a{:href => "/sample20"}Sample20 - How to Get Compare Change list for document using Ruby SDK
102
+ %li
103
+ %a{:href => "/sample21"}Sample21 - How to Create and Upload Envelop to GroupDocs account using Ruby SDK
104
+ %li
105
+ %a{:href => "/sample22"}Sample22 - How create or update user and add him to collaborators using PHP SDK
106
+ %li
107
+ %a{:href => "/envelope-sample"}Envelope sample - How to use envelope and signature API
@@ -41,7 +41,7 @@
41
41
  #{(defined? iframe) ? iframe : ""}
42
42
 
43
43
  %div{:style => "padding:10px;"}
44
- Choose anothe one sample:
44
+ Choose another one sample:
45
45
  %ul
46
46
  %li
47
47
  %a{:href => "/sample1"} Sample1 - How to login to GroupDocs using the API
@@ -78,6 +78,14 @@
78
78
  %li
79
79
  %a{:href => "/sample17"}Sample17 - How to upload a file into the storage and compress it into zip archive
80
80
  %li
81
- %a{:href => "/sample18"}Sample18 - How to convert Doc to Docx, Docx to Doc, Docx to PDF, PPT to PDFs
81
+ %a{:href => "/sample18"}Sample18 - How to convert Doc to Docx, Docx to Doc, Docx to PDF, PPT to PDF
82
+ %li
83
+ %a{:href => "/sample19"}Sample19 - How to Compare documents using Ruby SDK
84
+ %li
85
+ %a{:href => "/sample20"}Sample20 - How to Get Compare Change list for document using Ruby SDK
86
+ %li
87
+ %a{:href => "/sample21"}Sample21 - How to Create and Upload Envelop to GroupDocs account using Ruby SDK
88
+ %li
89
+ %a{:href => "/sample22"}Sample22 - How create or update user and add him to collaborators using PHP SDK
82
90
  %li
83
91
  %a{:href => "/envelope-sample"}Envelope sample - How to use envelope and signature API
@@ -75,5 +75,13 @@
75
75
  %a{:href => "/sample17"}Sample17 - How to upload a file into the storage and compress it into zip archive
76
76
  %li
77
77
  %a{:href => "/sample18"}Sample18 - How to convert Doc to Docx, Docx to Doc, Docx to PDF, PPT to PDF
78
+ %li
79
+ %a{:href => "/sample19"}Sample19 - How to Compare documents using Ruby SDK
80
+ %li
81
+ %a{:href => "/sample20"}Sample20 - How to Get Compare Change list for document using Ruby SDK
82
+ %li
83
+ %a{:href => "/sample21"}Sample21 - How to Create and Upload Envelop to GroupDocs account using Ruby SDK
84
+ %li
85
+ %a{:href => "/sample22"}Sample22 - How create or update user and add him to collaborators using PHP SDK
78
86
  %li
79
87
  %a{:href => "/envelope-sample"}Envelope sample - How to use envelope and signature API
@@ -79,5 +79,13 @@
79
79
  %a{:href => "/sample17"}Sample17 - How to upload a file into the storage and compress it into zip archive
80
80
  %li
81
81
  %a{:href => "/sample18"}Sample18 - How to convert Doc to Docx, Docx to Doc, Docx to PDF, PPT to PDF
82
+ %li
83
+ %a{:href => "/sample19"}Sample19 - How to Compare documents using Ruby SDK
84
+ %li
85
+ %a{:href => "/sample20"}Sample20 - How to Get Compare Change list for document using Ruby SDK
86
+ %li
87
+ %a{:href => "/sample21"}Sample21 - How to Create and Upload Envelop to GroupDocs account using Ruby SDK
88
+ %li
89
+ %a{:href => "/sample22"}Sample22 - How create or update user and add him to collaborators using PHP SDK
82
90
  %li
83
91
  %a{:href => "/envelope-sample"}Envelope sample - How to use envelope and signature API
@@ -84,5 +84,13 @@
84
84
  %a{:href => "/sample17"}Sample17 - How to upload a file into the storage and compress it into zip archive
85
85
  %li
86
86
  %a{:href => "/sample18"}Sample18 - How to convert Doc to Docx, Docx to Doc, Docx to PDF, PPT to PDF
87
+ %li
88
+ %a{:href => "/sample19"}Sample19 - How to Compare documents using Ruby SDK
89
+ %li
90
+ %a{:href => "/sample20"}Sample20 - How to Get Compare Change list for document using Ruby SDK
91
+ %li
92
+ %a{:href => "/sample21"}Sample21 - How to Create and Upload Envelop to GroupDocs account using Ruby SDK
93
+ %li
94
+ %a{:href => "/sample22"}Sample22 - How create or update user and add him to collaborators using PHP SDK
87
95
  %li
88
96
  %a{:href => "/envelope-sample"}Envelope sample - How to use envelope and signature API
@@ -38,7 +38,7 @@
38
38
  %td #{(defined? thumbnailList) ? thumbnailList : ""} #{(defined? file_List) ? file_List : ""}
39
39
  %br/
40
40
  %div{:style => "padding:10px;"}
41
- Choose anothe one sample:
41
+ Choose another one sample:
42
42
  %ul
43
43
  %li
44
44
  %a{:href => "/sample1"} Sample1 - How to login to GroupDocs using the API
@@ -76,5 +76,13 @@
76
76
  %a{:href => "/sample17"}Sample17 - How to upload a file into the storage and compress it into zip archive
77
77
  %li
78
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 => "/sample19"}Sample19 - How to Compare documents using Ruby SDK
81
+ %li
82
+ %a{:href => "/sample20"}Sample20 - How to Get Compare Change list for document using Ruby SDK
83
+ %li
84
+ %a{:href => "/sample21"}Sample21 - How to Create and Upload Envelop to GroupDocs account using Ruby SDK
85
+ %li
86
+ %a{:href => "/sample22"}Sample22 - How create or update user and add him to collaborators using PHP SDK
79
87
  %li
80
88
  %a{:href => "/envelope-sample"}Envelope sample - How to use envelope and signature API
@@ -54,7 +54,7 @@
54
54
  %img{:src => "#{(defined? image) ? image : ""}"}
55
55
  %br/
56
56
  %div{:style => "padding:10px;"}
57
- Choose anothe one sample:
57
+ Choose another one sample:
58
58
  %ul
59
59
  %li
60
60
  %a{:href => "/sample1"} Sample1 - How to login to GroupDocs using the API
@@ -75,7 +75,7 @@
75
75
  %li
76
76
  %a{:href => "/sample9"} Sample9 - How to generate an embedded Viewer URL for a Document
77
77
  %li
78
- %a{:href => "/sample10"} Sample10 - How to share a document to other userss
78
+ %a{:href => "/sample10"} Sample10 - How to share a document to other users
79
79
  %li
80
80
  %a{:href => "/sample11"}Sample11 - How programmatically create and post an annotation into document. How to delete the annotation
81
81
  %li
@@ -92,5 +92,13 @@
92
92
  %a{:href => "/sample17"}Sample17 - How to upload a file into the storage and compress it into zip archive
93
93
  %li
94
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 => "/sample19"}Sample19 - How to Compare documents using Ruby SDK
97
+ %li
98
+ %a{:href => "/sample20"}Sample20 - How to Get Compare Change list for document using Ruby SDK
99
+ %li
100
+ %a{:href => "/sample21"}Sample21 - How to Create and Upload Envelop to GroupDocs account using Ruby SDK
101
+ %li
102
+ %a{:href => "/sample22"}Sample22 - How create or update user and add him to collaborators using PHP SDK
95
103
  %li
96
104
  %a{:href => "/envelope-sample"}Envelope sample - How to use envelope and signature API
@@ -40,7 +40,7 @@
40
40
  %iframe{:src => "#{(defined? v_url) ? v_url : ""}", :width=> "#{(defined? width) ? width : ""}", :height=>"#{(defined? height) ? height : ""}"}
41
41
  %br/
42
42
  %div{:style => "padding:10px;"}
43
- Choose anothe one sample:
43
+ Choose another one sample:
44
44
  %ul
45
45
  %li
46
46
  %a{:href => "/sample1"} Sample1 - How to login to GroupDocs using the API
@@ -59,7 +59,7 @@
59
59
  %li
60
60
  %a{:href => "/sample8"} Sample8 - How to return a URL representing a single page of a Document
61
61
  %li
62
- %a{:href => "/sample9"} Sample9 - How to generate a embedded Viewer URL for a DocumentI
62
+ %a{:href => "/sample9"} Sample9 - How to generate an embedded Viewer URL for a Document
63
63
  %li
64
64
  %a{:href => "/sample10"} Sample10 - How to share a document to other users
65
65
  %li
@@ -78,5 +78,13 @@
78
78
  %a{:href => "/sample17"}Sample17 - How to upload a file into the storage and compress it into zip archive
79
79
  %li
80
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 => "/sample19"}Sample19 - How to Compare documents using Ruby SDK
83
+ %li
84
+ %a{:href => "/sample20"}Sample20 - How to Get Compare Change list for document using Ruby SDK
85
+ %li
86
+ %a{:href => "/sample21"}Sample21 - How to Create and Upload Envelop to GroupDocs account using Ruby SDK
87
+ %li
88
+ %a{:href => "/sample22"}Sample22 - How create or update user and add him to collaborators using PHP SDK
81
89
  %li
82
90
  %a{:href => "/envelope-sample"}Envelope sample - How to use envelope and signature API
@@ -15,9 +15,10 @@ Gem::Specification.new do |s|
15
15
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
16
16
  s.require_path = 'lib'
17
17
 
18
- s.add_runtime_dependency 'rest-client', '~> 1.6'
19
- s.add_runtime_dependency 'json' , '~> 1.7'
20
- s.add_runtime_dependency 'mime-types' , '~> 1.19'
18
+ s.add_runtime_dependency 'rest-client' , '~> 1.6'
19
+ s.add_runtime_dependency 'json' , '~> 1.7'
20
+ s.add_runtime_dependency 'mime-types' , '~> 1.19'
21
+ s.add_runtime_dependency 'activesupport'
21
22
 
22
23
  s.add_development_dependency 'rspec' , '~> 2.12'
23
24
  s.add_development_dependency 'fuubar' , '~> 1.1'
@@ -27,20 +27,18 @@ module GroupDocs
27
27
 
28
28
  #
29
29
  # Returns hostname of API server.
30
- #
31
30
  # @return [String] API hostname. Default one if it has not been explicitly set
32
31
  #
33
32
  def api_server
34
- @api_server || 'https://api.groupdocs.com'
33
+ @api_server ||= 'https://api.groupdocs.com'
35
34
  end
36
35
 
37
36
  #
38
37
  # Returns version of API.
39
- #
40
38
  # @return [String] API version. Default one if it has not been explicitly set
41
39
  #
42
40
  def api_version
43
- @api_version || '2.0'
41
+ @api_version ||= '2.0'
44
42
  end
45
43
 
46
44
  #
@@ -1,3 +1,5 @@
1
+ require 'active_support/core_ext'
2
+
1
3
  require 'groupdocs/api/helpers'
2
4
  require 'groupdocs/api/entity'
3
5
  require 'groupdocs/api/request'
@@ -49,7 +49,7 @@ module GroupDocs
49
49
  def to_hash
50
50
  hash = {}
51
51
  instance_variables.each do |variable|
52
- key = variable.to_s.delete(?@).to_sym
52
+ key = variable.to_s.delete('@').to_sym
53
53
  value = instance_variable_get(variable)
54
54
 
55
55
  hash[key] = case value
@@ -69,16 +69,15 @@ module GroupDocs
69
69
 
70
70
  #
71
71
  # Inspects object using accessors instead of instance variables values.
72
- #
73
72
  # @api private
74
73
  #
75
74
  def inspect
76
75
  not_nil_variables = instance_variables.select do |variable|
77
- !send(variable_to_accessor(variable)).nil?
76
+ !send(variable.to_s.underscore.delete('@')).nil?
78
77
  end
79
78
 
80
79
  variables = not_nil_variables.map do |variable|
81
- accessor = variable_to_accessor(variable)
80
+ accessor = variable.to_s.underscore.delete('@').to_sym
82
81
  value = send(accessor)
83
82
  value = case value
84
83
  when Symbol then ":#{value}"
@@ -100,43 +99,12 @@ module GroupDocs
100
99
 
101
100
  private
102
101
 
103
- #
104
- # Converts instance variable symbol to accessor method symbol.
105
- # @api private
106
- #
107
- def variable_to_accessor(variable)
108
- word = variable.to_s.delete(?@)
109
- word.gsub!(/(?<=[a-z])[A-Z]/) { |match| "_#{match}" }
110
- word.downcase!
111
- word.to_sym
112
- end
113
-
114
- #
115
- # Converts accessor symbol to instance variable symbol.
116
- # @api private
117
- #
118
- def accessor_to_variable(accessor)
119
- word = accessor.to_s
120
- word.capitalize!
121
- word.gsub!(/_([a-z])/) { |match| match.upcase }
122
- word.gsub!(/_/, '')
123
- "@#{word}".to_sym
124
- end
125
-
126
102
  #
127
103
  # Returns class name.
128
104
  # @api private
129
105
  #
130
106
  def class_name
131
- self.class.name.split('::').last.downcase
132
- end
133
-
134
- #
135
- # Returns pluralized class name.
136
- # @api private
137
- #
138
- def pluralized_class_name
139
- "#{class_name}s"
107
+ self.class.name.demodulize.downcase
140
108
  end
141
109
 
142
110
  end # Entity
@@ -6,10 +6,10 @@ module GroupDocs
6
6
  include Api::Helpers::ByteFlag
7
7
 
8
8
  ACCESS_RIGHTS = {
9
- export: 1,
10
- download: 2,
11
- proof: 4,
12
- view: 8,
9
+ :export => 1,
10
+ :download => 2,
11
+ :proof => 4,
12
+ :view => 8,
13
13
  }
14
14
 
15
15
  private
@@ -32,10 +32,10 @@ module GroupDocs
32
32
  def array_from_byte(byte, value_byte_hash)
33
33
  values = []
34
34
 
35
- value_byte_hash.reverse_each do |value, flag|
36
- decreased_byte = byte - flag
35
+ value_byte_hash.sort { |a, b| b[1] <=> a[1] }.each do |value_byte|
36
+ decreased_byte = byte - value_byte[1]
37
37
  if decreased_byte >= 0
38
- values << value
38
+ values << value_byte[0]
39
39
  byte = decreased_byte
40
40
  end
41
41
  end
@@ -7,9 +7,9 @@ module GroupDocs
7
7
  module REST
8
8
 
9
9
  DEFAULT_HEADERS = {
10
- accept: 'application/json',
11
- content_length: 0,
12
- groupdocs_referrer: "ruby/#{VERSION}"
10
+ :accept => 'application/json',
11
+ :content_length => 0,
12
+ :groupdocs_referrer => "ruby/#{VERSION}"
13
13
  }
14
14
 
15
15
  private
@@ -26,7 +26,7 @@ module GroupDocs
26
26
  options[:headers] = DEFAULT_HEADERS.dup
27
27
  end
28
28
 
29
- options[:method] = options[:method].downcase.to_sym
29
+ options[:method] = options[:method].to_s.downcase.to_sym
30
30
 
31
31
  if options[:request_body] && !options[:request_body].is_a?(Object::File)
32
32
  unless options[:plain]
@@ -68,7 +68,7 @@ module GroupDocs
68
68
  response
69
69
  # for all other requests, parse JSON
70
70
  else
71
- json = JSON.parse(response, symbolize_names: true)
71
+ json = JSON.parse(response, :symbolize_names => true)
72
72
  json[:status] == 'Ok' ? json[:result] : raise_bad_request_error(json)
73
73
  end
74
74
  end
@@ -15,8 +15,8 @@ module GroupDocs
15
15
  #
16
16
  def parse_status(status)
17
17
  case status
18
- when Symbol then accessor_to_variable(status).to_s.delete(?@)
19
- when String then variable_to_accessor(status)
18
+ when Symbol then status.to_s.camelize
19
+ when String then status.underscore.to_sym
20
20
  else raise ArgumentError, "Expected string/symbol, received: #{status.class}"
21
21
  end
22
22
  end