groupdocs 0.1.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.
- data/.travis.yml +5 -0
- data/Gemfile +3 -0
- data/README.md +141 -0
- data/Rakefile +9 -0
- data/groupdocs.gemspec +28 -0
- data/lib/groupdocs.rb +53 -0
- data/lib/groupdocs/api.rb +3 -0
- data/lib/groupdocs/api/entity.rb +113 -0
- data/lib/groupdocs/api/helpers.rb +5 -0
- data/lib/groupdocs/api/helpers/access_helper.rb +56 -0
- data/lib/groupdocs/api/helpers/actions_helper.rb +48 -0
- data/lib/groupdocs/api/helpers/rest_helper.rb +89 -0
- data/lib/groupdocs/api/helpers/status_helper.rb +48 -0
- data/lib/groupdocs/api/helpers/url_helper.rb +89 -0
- data/lib/groupdocs/api/request.rb +73 -0
- data/lib/groupdocs/api/sugar/lookup.rb +48 -0
- data/lib/groupdocs/datasource.rb +162 -0
- data/lib/groupdocs/datasource/field.rb +44 -0
- data/lib/groupdocs/document.rb +513 -0
- data/lib/groupdocs/document/annotation.rb +215 -0
- data/lib/groupdocs/document/annotation/reply.rb +167 -0
- data/lib/groupdocs/document/change.rb +35 -0
- data/lib/groupdocs/document/field.rb +27 -0
- data/lib/groupdocs/document/metadata.rb +26 -0
- data/lib/groupdocs/document/rectangle.rb +24 -0
- data/lib/groupdocs/document/view.rb +36 -0
- data/lib/groupdocs/errors.rb +10 -0
- data/lib/groupdocs/job.rb +201 -0
- data/lib/groupdocs/questionnaire.rb +221 -0
- data/lib/groupdocs/questionnaire/execution.rb +120 -0
- data/lib/groupdocs/questionnaire/page.rb +43 -0
- data/lib/groupdocs/questionnaire/question.rb +75 -0
- data/lib/groupdocs/questionnaire/question/answer.rb +10 -0
- data/lib/groupdocs/storage.rb +37 -0
- data/lib/groupdocs/storage/file.rb +248 -0
- data/lib/groupdocs/storage/folder.rb +314 -0
- data/lib/groupdocs/storage/package.rb +42 -0
- data/lib/groupdocs/user.rb +50 -0
- data/lib/groupdocs/version.rb +3 -0
- data/spec/groupdocs/api/entity_spec.rb +54 -0
- data/spec/groupdocs/api/helpers/access_helper_spec.rb +89 -0
- data/spec/groupdocs/api/helpers/actions_helper_spec.rb +51 -0
- data/spec/groupdocs/api/helpers/rest_helper_spec.rb +187 -0
- data/spec/groupdocs/api/helpers/status_helper_spec.rb +85 -0
- data/spec/groupdocs/api/helpers/url_helper_spec.rb +93 -0
- data/spec/groupdocs/api/request_spec.rb +85 -0
- data/spec/groupdocs/datasource/field_spec.rb +50 -0
- data/spec/groupdocs/datasource_spec.rb +156 -0
- data/spec/groupdocs/document/annotation/reply_spec.rb +179 -0
- data/spec/groupdocs/document/annotation_spec.rb +226 -0
- data/spec/groupdocs/document/change_spec.rb +35 -0
- data/spec/groupdocs/document/field_spec.rb +31 -0
- data/spec/groupdocs/document/metadata_spec.rb +26 -0
- data/spec/groupdocs/document/rectangle_spec.rb +34 -0
- data/spec/groupdocs/document/view_spec.rb +36 -0
- data/spec/groupdocs/document_spec.rb +509 -0
- data/spec/groupdocs/errors_spec.rb +7 -0
- data/spec/groupdocs/job_spec.rb +196 -0
- data/spec/groupdocs/questionnaire/execution_spec.rb +136 -0
- data/spec/groupdocs/questionnaire/page_spec.rb +50 -0
- data/spec/groupdocs/questionnaire/question/answer_spec.rb +11 -0
- data/spec/groupdocs/questionnaire/question_spec.rb +84 -0
- data/spec/groupdocs/questionnaire_spec.rb +217 -0
- data/spec/groupdocs/storage/file_spec.rb +242 -0
- data/spec/groupdocs/storage/folder_spec.rb +310 -0
- data/spec/groupdocs/storage/package_spec.rb +41 -0
- data/spec/groupdocs/storage_spec.rb +27 -0
- data/spec/groupdocs/user_spec.rb +53 -0
- data/spec/groupdocs_spec.rb +56 -0
- data/spec/spec_helper.rb +46 -0
- data/spec/support/files/resume.pdf +0 -0
- data/spec/support/json/annotation_collaborators_set.json +16 -0
- data/spec/support/json/annotation_create.json +12 -0
- data/spec/support/json/annotation_list.json +32 -0
- data/spec/support/json/annotation_remove.json +9 -0
- data/spec/support/json/annotation_replies_create.json +9 -0
- data/spec/support/json/annotation_replies_get.json +25 -0
- data/spec/support/json/comparison_changes.json +46 -0
- data/spec/support/json/comparison_compare.json +8 -0
- data/spec/support/json/comparison_document.json +10 -0
- data/spec/support/json/datasource_add.json +8 -0
- data/spec/support/json/datasource_get.json +22 -0
- data/spec/support/json/datasource_remove.json +8 -0
- data/spec/support/json/datasource_update.json +8 -0
- data/spec/support/json/document_access_info_get.json +14 -0
- data/spec/support/json/document_convert.json +8 -0
- data/spec/support/json/document_datasource.json +10 -0
- data/spec/support/json/document_fields.json +34 -0
- data/spec/support/json/document_formats.json +8 -0
- data/spec/support/json/document_metadata.json +15 -0
- data/spec/support/json/document_questionnaire_create.json +9 -0
- data/spec/support/json/document_questionnaires.json +23 -0
- data/spec/support/json/document_sharers_remove.json +8 -0
- data/spec/support/json/document_sharers_set.json +16 -0
- data/spec/support/json/document_views.json +32 -0
- data/spec/support/json/file_compress.json +8 -0
- data/spec/support/json/file_copy.json +14 -0
- data/spec/support/json/file_delete.json +5 -0
- data/spec/support/json/file_move.json +14 -0
- data/spec/support/json/file_upload.json +8 -0
- data/spec/support/json/folder_create.json +8 -0
- data/spec/support/json/folder_delete.json +5 -0
- data/spec/support/json/folder_list.json +21 -0
- data/spec/support/json/folder_move.json +8 -0
- data/spec/support/json/folder_sharers_get.json +16 -0
- data/spec/support/json/folder_sharers_remove.json +8 -0
- data/spec/support/json/folder_sharers_set.json +16 -0
- data/spec/support/json/job_add_url.json +8 -0
- data/spec/support/json/job_create.json +8 -0
- data/spec/support/json/job_documents.json +39 -0
- data/spec/support/json/job_file_add.json +8 -0
- data/spec/support/json/job_update.json +7 -0
- data/spec/support/json/jobs_get.json +52 -0
- data/spec/support/json/package_create.json +7 -0
- data/spec/support/json/questionnaire_create.json +8 -0
- data/spec/support/json/questionnaire_datasources.json +26 -0
- data/spec/support/json/questionnaire_execution_create.json +9 -0
- data/spec/support/json/questionnaire_execution_status_set.json +8 -0
- data/spec/support/json/questionnaire_execution_update.json +8 -0
- data/spec/support/json/questionnaire_executions.json +24 -0
- data/spec/support/json/questionnaire_get.json +14 -0
- data/spec/support/json/questionnaire_remove.json +8 -0
- data/spec/support/json/questionnaire_update.json +8 -0
- data/spec/support/json/questionnaires_get.json +22 -0
- data/spec/support/json/storage_info.json +10 -0
- data/spec/support/shared_examples/api/entity.rb +37 -0
- data/spec/support/shared_examples/api/helpers/status_helper.rb +12 -0
- data/spec/support/shared_examples/api/sugar/lookup.rb +57 -0
- metadata +356 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
module GroupDocs
|
|
2
|
+
class Document::Annotation < GroupDocs::Api::Entity
|
|
3
|
+
|
|
4
|
+
TYPES = {
|
|
5
|
+
text: 0,
|
|
6
|
+
area: 1,
|
|
7
|
+
point: 2,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
require 'groupdocs/document/annotation/reply'
|
|
11
|
+
|
|
12
|
+
# @attr [GroupDocs::Document] document
|
|
13
|
+
attr_accessor :document
|
|
14
|
+
# @attr [Integer] id
|
|
15
|
+
attr_accessor :id
|
|
16
|
+
# @attr [String] guid
|
|
17
|
+
attr_accessor :guid
|
|
18
|
+
# @attr [String] sessionGuid
|
|
19
|
+
attr_accessor :sessionGuid
|
|
20
|
+
# @attr [String] documentGuid
|
|
21
|
+
attr_accessor :documentGuid
|
|
22
|
+
# @attr [String] replyGuid
|
|
23
|
+
attr_accessor :replyGuid
|
|
24
|
+
# @attr [Time] createdOn
|
|
25
|
+
attr_accessor :createdOn
|
|
26
|
+
# @attr [Symbol] type
|
|
27
|
+
attr_accessor :type
|
|
28
|
+
# @attr [Symbol] access
|
|
29
|
+
attr_accessor :access
|
|
30
|
+
# @attr [GroupDocs::Document::Rectangle] box
|
|
31
|
+
attr_accessor :box
|
|
32
|
+
# @attr [Array<GroupDocs::Document::Annotation::Reply>] replies
|
|
33
|
+
attr_accessor :replies
|
|
34
|
+
|
|
35
|
+
# Compatibility with response JSON
|
|
36
|
+
alias_method :annotationGuid=, :guid=
|
|
37
|
+
|
|
38
|
+
# Human-readable accessors
|
|
39
|
+
alias_method :session_guid, :sessionGuid
|
|
40
|
+
alias_method :session_guid=, :sessionGuid=
|
|
41
|
+
alias_method :document_guid, :documentGuid
|
|
42
|
+
alias_method :document_guid=, :documentGuid=
|
|
43
|
+
alias_method :reply_guid, :replyGuid
|
|
44
|
+
alias_method :reply_guid=, :replyGuid=
|
|
45
|
+
alias_method :created_on, :createdOn
|
|
46
|
+
alias_method :created_on=, :createdOn=
|
|
47
|
+
|
|
48
|
+
#
|
|
49
|
+
# Creates new GroupDocs::Document::Annotation.
|
|
50
|
+
#
|
|
51
|
+
# @raise [ArgumentError] If document is not passed or is not an instance of GroupDocs::Document
|
|
52
|
+
#
|
|
53
|
+
def initialize(options = {}, &blk)
|
|
54
|
+
super(options, &blk)
|
|
55
|
+
document.is_a?(GroupDocs::Document) or raise ArgumentError,
|
|
56
|
+
"You have to pass GroupDocs::Document object: #{document.inspect}."
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
#
|
|
60
|
+
# Updates type with machine-readable format.
|
|
61
|
+
#
|
|
62
|
+
# @param [Symbol] type
|
|
63
|
+
# @raise [ArgumentError] if type is unknown
|
|
64
|
+
#
|
|
65
|
+
def type=(type)
|
|
66
|
+
if type.is_a?(Symbol)
|
|
67
|
+
TYPES.keys.include?(type) or raise ArgumentError, "Unknown type: #{type.inspect}"
|
|
68
|
+
type = TYPES[type]
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
@type = type
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
#
|
|
75
|
+
# Returns field type in human-readable format.
|
|
76
|
+
#
|
|
77
|
+
# @return [Symbol]
|
|
78
|
+
#
|
|
79
|
+
def type
|
|
80
|
+
TYPES.invert[@type]
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
#
|
|
84
|
+
# Converts timestamp which is return by API server to Time object.
|
|
85
|
+
#
|
|
86
|
+
# @return [Time]
|
|
87
|
+
#
|
|
88
|
+
def created_on
|
|
89
|
+
Time.at(@createdOn / 1000)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
#
|
|
93
|
+
# Coverts passed hash to GroupDocs::Document::Rectangle object.
|
|
94
|
+
#
|
|
95
|
+
# @param [Hash] options
|
|
96
|
+
# @return [GroupDocs::Document::Rectangle]
|
|
97
|
+
#
|
|
98
|
+
def box=(options)
|
|
99
|
+
@box = GroupDocs::Document::Rectangle.new(options)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
#
|
|
103
|
+
# Converts each reply to GroupDocs::Document::Annotation::Reply object.
|
|
104
|
+
#
|
|
105
|
+
# @param [Array<GroupDocs::Document::Annotation::Reply, Hash>] replies
|
|
106
|
+
#
|
|
107
|
+
def replies=(replies)
|
|
108
|
+
if replies
|
|
109
|
+
@replies = replies.map do |reply|
|
|
110
|
+
if reply.is_a?(GroupDocs::Document::Annotation::Reply)
|
|
111
|
+
reply
|
|
112
|
+
else
|
|
113
|
+
reply.merge!(annotation: self)
|
|
114
|
+
GroupDocs::Document::Annotation::Reply.new(reply)
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
#
|
|
121
|
+
# Adds reply to annotation.
|
|
122
|
+
#
|
|
123
|
+
# @param [GroupDocs::Document::Annotation::Reply] reply
|
|
124
|
+
# @raise [ArgumentError] if reply is not GroupDocs::Document::Annotation::Reply object
|
|
125
|
+
#
|
|
126
|
+
def add_reply(reply)
|
|
127
|
+
reply.is_a?(GroupDocs::Document::Annotation::Reply) or raise ArgumentError,
|
|
128
|
+
"Reply should be GroupDocs::Document::Annotation::Reply object, received: #{reply.inspect}"
|
|
129
|
+
|
|
130
|
+
@replies ||= Array.new
|
|
131
|
+
@replies << reply
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
#
|
|
135
|
+
# Creates new annotation.
|
|
136
|
+
#
|
|
137
|
+
# @example
|
|
138
|
+
# document = GroupDocs::Document.find!(:name, 'CV.doc')
|
|
139
|
+
# annotation = GroupDocs::Document::Annotation.new(document: document)
|
|
140
|
+
# annotation.create!
|
|
141
|
+
#
|
|
142
|
+
# @param [Hash] access Access credentials
|
|
143
|
+
# @option access [String] :client_id
|
|
144
|
+
# @option access [String] :private_key
|
|
145
|
+
#
|
|
146
|
+
def create!(access = {})
|
|
147
|
+
json = GroupDocs::Api::Request.new do |request|
|
|
148
|
+
request[:access] = access
|
|
149
|
+
request[:method] = :POST
|
|
150
|
+
request[:path] = "/ant/{{client_id}}/files/#{document.file.guid}/annotations"
|
|
151
|
+
request[:request_body] = to_hash
|
|
152
|
+
end.execute!
|
|
153
|
+
|
|
154
|
+
json.each do |field, value|
|
|
155
|
+
send(:"#{field}=", value) if respond_to?(:"#{field}=")
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
#
|
|
160
|
+
# Sets annotation collaborators to given emails.
|
|
161
|
+
#
|
|
162
|
+
# @param [Array] emails List of collaborators' email addresses
|
|
163
|
+
# @param [Hash] access Access credentials
|
|
164
|
+
# @option access [String] :client_id
|
|
165
|
+
# @option access [String] :private_key
|
|
166
|
+
# @return [Array<GroupDocs::User>]
|
|
167
|
+
#
|
|
168
|
+
def collaborators_set!(emails, access = {})
|
|
169
|
+
json = GroupDocs::Api::Request.new do |request|
|
|
170
|
+
request[:access] = access
|
|
171
|
+
request[:method] = :PUT
|
|
172
|
+
request[:path] = "/ant/{{client_id}}/files/#{document.file.guid}/collaborators"
|
|
173
|
+
request[:request_body] = emails
|
|
174
|
+
end.execute!
|
|
175
|
+
|
|
176
|
+
json[:collaborators].map do |collaborator|
|
|
177
|
+
GroupDocs::User.new(collaborator)
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
# note that aliased version cannot accept access credentials hash
|
|
181
|
+
alias_method :collaborators=, :collaborators_set!
|
|
182
|
+
|
|
183
|
+
#
|
|
184
|
+
# Removes annotation.
|
|
185
|
+
#
|
|
186
|
+
# @param [Hash] access Access credentials
|
|
187
|
+
# @option access [String] :client_id
|
|
188
|
+
# @option access [String] :private_key
|
|
189
|
+
#
|
|
190
|
+
def remove!(access = {})
|
|
191
|
+
GroupDocs::Api::Request.new do |request|
|
|
192
|
+
request[:access] = access
|
|
193
|
+
request[:method] = :DELETE
|
|
194
|
+
request[:path] = "/ant/{{client_id}}/annotations/#{guid}"
|
|
195
|
+
end.execute!
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
#
|
|
199
|
+
# Return an array of replies..
|
|
200
|
+
#
|
|
201
|
+
# @param [Hash] options
|
|
202
|
+
# @option options [Time] :after
|
|
203
|
+
# @param [Hash] access Access credentials
|
|
204
|
+
# @option access [String] :client_id
|
|
205
|
+
# @option access [String] :private_key
|
|
206
|
+
# @return [Array<GroupDocs::Document::Annotation::Reply>]
|
|
207
|
+
#
|
|
208
|
+
# @raise [ArgumentError] If :after option is passed but it's not an instance of Time
|
|
209
|
+
#
|
|
210
|
+
def replies!(options = {}, access = {})
|
|
211
|
+
GroupDocs::Document::Annotation::Reply.get!(self, options, access)
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
end # Document::Annotation
|
|
215
|
+
end # GroupDocs
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
module GroupDocs
|
|
2
|
+
class Document::Annotation::Reply < GroupDocs::Api::Entity
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# Return an array of replies for given annotation.
|
|
6
|
+
#
|
|
7
|
+
# @param [GroupDocs::Document::Annotation] annotation
|
|
8
|
+
# @param [Hash] options
|
|
9
|
+
# @option options [Time] :after
|
|
10
|
+
# @param [Hash] access Access credentials
|
|
11
|
+
# @option access [String] :client_id
|
|
12
|
+
# @option access [String] :private_key
|
|
13
|
+
# @return [Array<GroupDocs::Document::Annotation::Reply>]
|
|
14
|
+
#
|
|
15
|
+
# @raise [ArgumentError] If annotation is not passed or is not an instance of GroupDocs::Document::Annotation
|
|
16
|
+
# @raise [ArgumentError] If :after option is passed but it's not an instance of Time
|
|
17
|
+
#
|
|
18
|
+
def self.get!(annotation, options = {}, access = {})
|
|
19
|
+
annotation.is_a?(GroupDocs::Document::Annotation) or raise ArgumentError,
|
|
20
|
+
"You have to pass GroupDocs::Document::Annotation object: #{annotation.inspect}."
|
|
21
|
+
(options[:after] && !options[:after].is_a?(Time)) and raise ArgumentError,
|
|
22
|
+
"Option :after should be an instance of Time, received: #{options[:after].inspect}"
|
|
23
|
+
|
|
24
|
+
options[:after] = (options[:after].to_i * 1000) if options[:after]
|
|
25
|
+
|
|
26
|
+
api = GroupDocs::Api::Request.new do |request|
|
|
27
|
+
request[:access] = access
|
|
28
|
+
request[:method] = :GET
|
|
29
|
+
request[:path] = "/ant/{{client_id}}/annotations/#{annotation.guid}/replies"
|
|
30
|
+
end
|
|
31
|
+
api.add_params(options)
|
|
32
|
+
json = api.execute!
|
|
33
|
+
|
|
34
|
+
json[:replies].map do |reply|
|
|
35
|
+
reply.merge!(annotation: annotation)
|
|
36
|
+
GroupDocs::Document::Annotation::Reply.new(reply)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# @attr [GroupDocs::Document::Annotation] annotation
|
|
41
|
+
attr_accessor :annotation
|
|
42
|
+
# @attr [String] text
|
|
43
|
+
attr_accessor :text
|
|
44
|
+
# @attr [String] guid
|
|
45
|
+
attr_accessor :guid
|
|
46
|
+
# @attr [String] annotationGuid
|
|
47
|
+
attr_accessor :annotationGuid
|
|
48
|
+
# @attr [String] userGuid
|
|
49
|
+
attr_accessor :userGuid
|
|
50
|
+
# @attr [String] userName
|
|
51
|
+
attr_accessor :userName
|
|
52
|
+
# @attr [String] text
|
|
53
|
+
attr_accessor :text
|
|
54
|
+
# @attr [Time] repliedOn
|
|
55
|
+
attr_accessor :repliedOn
|
|
56
|
+
|
|
57
|
+
# Human-readable accessors
|
|
58
|
+
alias_method :annotation_guid, :annotationGuid
|
|
59
|
+
alias_method :annotation_guid=, :annotationGuid=
|
|
60
|
+
alias_method :user_guid, :userGuid
|
|
61
|
+
alias_method :user_guid=, :userGuid=
|
|
62
|
+
alias_method :user_name, :userName
|
|
63
|
+
alias_method :user_name=, :userName=
|
|
64
|
+
alias_method :replied_on, :repliedOn
|
|
65
|
+
alias_method :replied_on=, :repliedOn=
|
|
66
|
+
|
|
67
|
+
#
|
|
68
|
+
# Creates new GroupDocs::Document::Annotation.
|
|
69
|
+
#
|
|
70
|
+
# @raise [ArgumentError] If annotation is not passed or is not an instance of GroupDocs::Document::Annotation
|
|
71
|
+
#
|
|
72
|
+
def initialize(options = {}, &blk)
|
|
73
|
+
super(options, &blk)
|
|
74
|
+
annotation.is_a?(GroupDocs::Document::Annotation) or raise ArgumentError,
|
|
75
|
+
"You have to pass GroupDocs::Document::Annotation object: #{annotation.inspect}."
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
#
|
|
79
|
+
# Converts timestamp which is return by API server to Time object.
|
|
80
|
+
#
|
|
81
|
+
# @return [Time]
|
|
82
|
+
#
|
|
83
|
+
def replied_on
|
|
84
|
+
Time.at(@repliedOn / 1000)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
#
|
|
88
|
+
# Creates reply.
|
|
89
|
+
#
|
|
90
|
+
# @example
|
|
91
|
+
# document = GroupDocs::Document.find!(:name, 'CV.doc')
|
|
92
|
+
# annotation = GroupDocs::Document::Annotation.new(document: document)
|
|
93
|
+
# reply = GroupDocs::Document::Annotation::Reply.new(annotation: annotation)
|
|
94
|
+
# reply.text = "Reply text"
|
|
95
|
+
# reply.create!
|
|
96
|
+
#
|
|
97
|
+
# @param [Hash] access Access credentials
|
|
98
|
+
# @option access [String] :client_id
|
|
99
|
+
# @option access [String] :private_key
|
|
100
|
+
#
|
|
101
|
+
# @raise [NameError] if annotation or annotation_guid are not set
|
|
102
|
+
#
|
|
103
|
+
def create!(access = {})
|
|
104
|
+
json = GroupDocs::Api::Request.new do |request|
|
|
105
|
+
request[:access] = access
|
|
106
|
+
request[:method] = :POST
|
|
107
|
+
request[:path] = "/ant/{{client_id}}/annotations/#{get_annotation_guid}/replies"
|
|
108
|
+
request[:request_body] = text
|
|
109
|
+
end.execute!
|
|
110
|
+
|
|
111
|
+
self.guid = json[:replyGuid]
|
|
112
|
+
self.annotation_guid = json[:annotationGuid]
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
#
|
|
116
|
+
# Edits reply.
|
|
117
|
+
#
|
|
118
|
+
# @example
|
|
119
|
+
# document = GroupDocs::Document.find!(:name, 'CV.doc')
|
|
120
|
+
# annotation = document.annotations!.first
|
|
121
|
+
# reply = annotation.replies!.first
|
|
122
|
+
# reply.text = "New reply text"
|
|
123
|
+
# reply.edit!
|
|
124
|
+
#
|
|
125
|
+
# @param [Hash] access Access credentials
|
|
126
|
+
# @option access [String] :client_id
|
|
127
|
+
# @option access [String] :private_key
|
|
128
|
+
#
|
|
129
|
+
def edit!(access = {})
|
|
130
|
+
GroupDocs::Api::Request.new do |request|
|
|
131
|
+
request[:access] = access
|
|
132
|
+
request[:method] = :PUT
|
|
133
|
+
request[:path] = "/ant/{{client_id}}/replies/#{guid}"
|
|
134
|
+
request[:request_body] = text
|
|
135
|
+
end.execute!
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
#
|
|
139
|
+
# Removes reply.
|
|
140
|
+
#
|
|
141
|
+
# @param [Hash] access Access credentials
|
|
142
|
+
# @option access [String] :client_id
|
|
143
|
+
# @option access [String] :private_key
|
|
144
|
+
#
|
|
145
|
+
# @todo currently not implemented in API
|
|
146
|
+
#
|
|
147
|
+
def remove!(access = {})
|
|
148
|
+
GroupDocs::Api::Request.new do |request|
|
|
149
|
+
request[:access] = access
|
|
150
|
+
request[:method] = :DELETE
|
|
151
|
+
request[:path] = "/ant/{{client_id}}/replies/#{guid}"
|
|
152
|
+
end.execute!
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
private
|
|
156
|
+
|
|
157
|
+
#
|
|
158
|
+
# Returns annotation guid.
|
|
159
|
+
#
|
|
160
|
+
# @returns [String]
|
|
161
|
+
#
|
|
162
|
+
def get_annotation_guid
|
|
163
|
+
annotation_guid || annotation.guid
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
end # Document::Annotation::Reply
|
|
167
|
+
end # GroupDocs
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module GroupDocs
|
|
2
|
+
class Document::Change < GroupDocs::Api::Entity
|
|
3
|
+
|
|
4
|
+
# @attr [Integer] id
|
|
5
|
+
attr_accessor :id
|
|
6
|
+
# @attr [Symbol] type
|
|
7
|
+
attr_accessor :type
|
|
8
|
+
# @attr [GroupDocs::Document::Rectangle] box
|
|
9
|
+
attr_accessor :box
|
|
10
|
+
# @attr [String] text
|
|
11
|
+
attr_accessor :text
|
|
12
|
+
# @attr [Integer] page
|
|
13
|
+
attr_accessor :page
|
|
14
|
+
|
|
15
|
+
#
|
|
16
|
+
# Returns type as symbol.
|
|
17
|
+
#
|
|
18
|
+
# @return [Symbol]
|
|
19
|
+
#
|
|
20
|
+
def type
|
|
21
|
+
@type.to_sym
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
#
|
|
25
|
+
# Coverts passed hash to GroupDocs::Document::Rectangle object.
|
|
26
|
+
#
|
|
27
|
+
# @param [Hash] options
|
|
28
|
+
# @return [GroupDocs::Document::Rectangle]
|
|
29
|
+
#
|
|
30
|
+
def box=(options)
|
|
31
|
+
@box = GroupDocs::Document::Rectangle.new(options)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
end # Document::Change
|
|
35
|
+
end # GroupDocs
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module GroupDocs
|
|
2
|
+
class Document::Field < GroupDocs::Api::Entity
|
|
3
|
+
|
|
4
|
+
# @attr [Integer] page
|
|
5
|
+
attr_accessor :page
|
|
6
|
+
# @attr [String] name
|
|
7
|
+
attr_accessor :name
|
|
8
|
+
# @attr [String] type
|
|
9
|
+
attr_accessor :type
|
|
10
|
+
# @attr [GroupDocs::Document::Rectangle] rectangle
|
|
11
|
+
attr_accessor :rectangle
|
|
12
|
+
|
|
13
|
+
#
|
|
14
|
+
# Coverts passed hash to GroupDocs::Document::Rectangle object.
|
|
15
|
+
#
|
|
16
|
+
# @param [Hash] options
|
|
17
|
+
# @return [GroupDocs::Document::Rectangle]
|
|
18
|
+
#
|
|
19
|
+
def rectangle=(options)
|
|
20
|
+
@rectangle = GroupDocs::Document::Rectangle.new(options)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Compatibility with response JSON
|
|
24
|
+
alias_method :rect=, :rectangle=
|
|
25
|
+
|
|
26
|
+
end # Document::Field
|
|
27
|
+
end # GroupDocs
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module GroupDocs
|
|
2
|
+
class Document::MetaData < GroupDocs::Api::Entity
|
|
3
|
+
|
|
4
|
+
# @attr [Integer] id
|
|
5
|
+
attr_accessor :id
|
|
6
|
+
# @attr [String] guid
|
|
7
|
+
attr_accessor :guid
|
|
8
|
+
# @attr [Integer] page_count
|
|
9
|
+
attr_accessor :page_count
|
|
10
|
+
# @attr [Integer] views_count
|
|
11
|
+
attr_accessor :views_count
|
|
12
|
+
# @attr [Hash] last_view
|
|
13
|
+
attr_accessor :last_view
|
|
14
|
+
|
|
15
|
+
#
|
|
16
|
+
# Coverts passed hash to GroupDocs::Document::View object.
|
|
17
|
+
#
|
|
18
|
+
# @param [Hash] options
|
|
19
|
+
# @return [GroupDocs::Document::View]
|
|
20
|
+
#
|
|
21
|
+
def last_view=(options)
|
|
22
|
+
@last_view = GroupDocs::Document::View.new(options)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end # Document::Metadata
|
|
26
|
+
end # GroupDocs
|