lib/groupdocs/document/annotation.rb in groupdocs-1.5.3 vs lib/groupdocs/document/annotation.rb in groupdocs-1.5.4

- old
+ new

@@ -32,10 +32,19 @@ attr_accessor :box # @attr [Array<GroupDocs::Document::Annotation::Reply>] replies attr_accessor :replies # @attr [Hash] annotationPosition attr_accessor :annotationPosition + #@attr [Double] AnnotationSizeInfo + attr_accessor :width + attr_accessor :height + #@attr [String]TextFieldInfo + attr_accessor :fieldText + attr_accessor :fontFamily + attr_accessor :fontSize + #@attr [String]Font Color + attr_accessor :fontColor # Compatibility with response JSON alias_method :annotationGuid=, :guid= # Human-readable accessors @@ -45,10 +54,11 @@ alias_accessor :reply_guid, :replyGuid alias_accessor :created_on, :createdOn alias_accessor :annotation_position, :annotationPosition alias_accessor :position, :annotationPosition + # # Creates new GroupDocs::Document::Annotation. # # @raise [ArgumentError] If document is not passed or is not an instance of GroupDocs::Document # @@ -267,9 +277,72 @@ request[:path] = "/ant/{{client_id}}/annotations/#{guid}/annotationAccess" request[:request_body] = %w(public private).index(mode.to_s) end.execute! self.access = mode + end + + # + # Resize annotation. + # + # @param [Integer, Float] x + # @param [Integer, Float] y + # @param [Hash] access Access credentials + # @option access [String] :client_id + # @option access [String] :private_key + # + def resize!(x, y, access = {}) + Api::Request.new do |request| + request[:access] = access + request[:method] = :PUT + request[:path] = "/ant/{{client_id}}/annotations/#{guid}/size" + request[:request_body] = { :x => x, :y => y } + end.execute! + + self.width = x + self.height = y + end + + # + # Save Text Of Text Field. + # + # @param [String] fieldText + # @param [String] fontFamily + # @param [Integer, Float] fontSize + # @param [Hash] access Access credentials + # @option access [String] :client_id + # @option access [String] :private_key + # + def text_info!(fieldText, fontFamily, fontSize, access = {}) + Api::Request.new do |request| + request[:access] = access + request[:method] = :PUT + request[:path] = "/ant/{{client_id}}/annotations/#{guid}/size" + request[:request_body] = { :fieldText => fieldText, :fontFamily => fontFamily, :fontSize => fontSize } + end.execute! + + self.fieldText = fieldText + self.fontFamily = fontFamily + self.fontSize = fontSize + end + + # + # Save Text Of Text Color. + # + # @param [Integer, Float] fontColor + # @param [Hash] access Access credentials + # @option access [String] :client_id + # @option access [String] :private_key + # + def text_color!(font_color, access = {}) + Api::Request.new do |request| + request[:access] = access + request[:method] = :PUT + request[:path] = "/ant/{{client_id}}/annotations/#{guid}/size" + request[:request_body] = { :fontColor => font_color } + end.execute! + + self.fontColor = font_color end end # Document::Annotation end # GroupDocs