Class: AsposeWordsCloud::Signature

Inherits:
Object
  • Object
show all
Defined in:
lib/aspose_words_cloud/models/signature.rb

Overview

The REST response with a document signature collection. This response is returned by the Service when handling any “api.aspose.cloud/v4.0/words/Test.doc/signatures” REST API requests.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Signature

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/aspose_words_cloud/models/signature.rb', line 81

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.key?(:'Comments')
    self.comments = attributes[:'Comments']
  end

  if attributes.key?(:'IssuerName')
    self.issuer_name = attributes[:'IssuerName']
  end

  if attributes.key?(:'IsValid')
    self.is_valid = attributes[:'IsValid']
  end

  if attributes.key?(:'SignatureType')
    self.signature_type = attributes[:'SignatureType']
  end

  if attributes.key?(:'SignatureValue')
    self.signature_value = attributes[:'SignatureValue']
  end

  if attributes.key?(:'SignTime')
    self.sign_time = attributes[:'SignTime']
  end

  if attributes.key?(:'SubjectName')
    self.subject_name = attributes[:'SubjectName']
  end
end

Instance Attribute Details

#commentsObject

Gets or sets the signing purpose comment.



34
35
36
# File 'lib/aspose_words_cloud/models/signature.rb', line 34

def comments
  @comments
end

#is_validObject

Gets or sets a value indicating whether this digital signature is valid.



40
41
42
# File 'lib/aspose_words_cloud/models/signature.rb', line 40

def is_valid
  @is_valid
end

#issuer_nameObject

Gets or sets the subject distinguished name of the certificate isuuer.



37
38
39
# File 'lib/aspose_words_cloud/models/signature.rb', line 37

def issuer_name
  @issuer_name
end

#sign_timeObject

Gets or sets the time the document was signed.



49
50
51
# File 'lib/aspose_words_cloud/models/signature.rb', line 49

def sign_time
  @sign_time
end

#signature_typeObject

Gets or sets the type of the digital signature.



43
44
45
# File 'lib/aspose_words_cloud/models/signature.rb', line 43

def signature_type
  @signature_type
end

#signature_valueObject

Gets or sets an array of bytes representing a signature value as base64 string.



46
47
48
# File 'lib/aspose_words_cloud/models/signature.rb', line 46

def signature_value
  @signature_value
end

#subject_nameObject

Gets or sets the subject distinguished name of the certificate that was used to sign the document.



52
53
54
# File 'lib/aspose_words_cloud/models/signature.rb', line 52

def subject_name
  @subject_name
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/aspose_words_cloud/models/signature.rb', line 54

def self.attribute_map
  {
    :'comments' => :'Comments',
    :'issuer_name' => :'IssuerName',
    :'is_valid' => :'IsValid',
    :'signature_type' => :'SignatureType',
    :'signature_value' => :'SignatureValue',
    :'sign_time' => :'SignTime',
    :'subject_name' => :'SubjectName'
  }
end

.swagger_typesObject

Attribute type mapping.



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/aspose_words_cloud/models/signature.rb', line 67

def self.swagger_types
  {
    :'comments' => :'String',
    :'issuer_name' => :'String',
    :'is_valid' => :'BOOLEAN',
    :'signature_type' => :'String',
    :'signature_value' => :'String',
    :'sign_time' => :'DateTime',
    :'subject_name' => :'String'
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



124
125
126
127
128
129
130
131
132
133
134
# File 'lib/aspose_words_cloud/models/signature.rb', line 124

def ==(other)
  return true if self.equal?(other)
  self.class == other.class &&
      comments == other.comments &&
      issuer_name == other.issuer_name &&
      is_valid == other.is_valid &&
      signature_type == other.signature_type &&
      signature_value == other.signature_value &&
      sign_time == other.sign_time &&
      subject_name == other.subject_name
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/aspose_words_cloud/models/signature.rb', line 173

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    Time.at(/\d/.match(value)[0].to_f).to_datetime
  when :Date
    Time.at(/\d/.match(value)[0].to_f).to_date
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else
  # model
    if value[:'$type']
        type = value[:'$type'][0..-4]
    end

    temp_model = AsposeWordsCloud.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/aspose_words_cloud/models/signature.rb', line 244

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/aspose_words_cloud/models/signature.rb', line 151

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#collectFilesContent(resultFilesContent) ⇒ Object



258
259
# File 'lib/aspose_words_cloud/models/signature.rb', line 258

def collectFilesContent(resultFilesContent)
end

#eql?(other) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


138
139
140
# File 'lib/aspose_words_cloud/models/signature.rb', line 138

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



144
145
146
# File 'lib/aspose_words_cloud/models/signature.rb', line 144

def hash
  [comments, issuer_name, is_valid, signature_type, signature_value, sign_time, subject_name].hash
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



224
225
226
# File 'lib/aspose_words_cloud/models/signature.rb', line 224

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



230
231
232
233
234
235
236
237
238
# File 'lib/aspose_words_cloud/models/signature.rb', line 230

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



218
219
220
# File 'lib/aspose_words_cloud/models/signature.rb', line 218

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



118
119
120
# File 'lib/aspose_words_cloud/models/signature.rb', line 118

def valid?
  return true
end

#validateObject

Raises:

  • (ArgumentError)


261
262
263
264
# File 'lib/aspose_words_cloud/models/signature.rb', line 261

def validate()
  raise ArgumentError, 'Property is_valid in Signature is required.' if self.is_valid.nil?
  raise ArgumentError, 'Property sign_time in Signature is required.' if self.sign_time.nil?
end