Class: FlatApi::OmrJobCreation

Inherits:
ApiModelBase show all
Defined in:
lib/flat_api/models/omr_job_creation.rb

Overview

Parameters to create an OMR job. Send without files to create a draft (then add files with addOmrJobFile and run startOmrJob), or include files and autoStart: true to import in a single request.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ OmrJobCreation

Initializes the object

Parameters:

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

    Model attributes in the form of hash



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/flat_api/models/omr_job_creation.rb', line 110

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `FlatApi::OmrJobCreation` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `FlatApi::OmrJobCreation`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'output')
    self.output = attributes[:'output']
  else
    self.output = 'library'
  end

  if attributes.key?(:'interactive_steps')
    if (value = attributes[:'interactive_steps']).is_a?(Array)
      self.interactive_steps = value
    end
  end

  if attributes.key?(:'auto_rotate')
    self.auto_rotate = attributes[:'auto_rotate']
  else
    self.auto_rotate = false
  end

  if attributes.key?(:'locales')
    if (value = attributes[:'locales']).is_a?(Array)
      self.locales = value
    end
  end

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

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

  if attributes.key?(:'files')
    if (value = attributes[:'files']).is_a?(Array)
      self.files = value
    end
  end

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

Instance Attribute Details

#auto_rotate ⇒ Object

Let the server detect and correct pages uploaded sideways or upside down (90/180/270°) before recognition. Off by default: pages are recognized in the orientation they are uploaded in, which is the right choice when your client lets the user rotate pages before upload. Enable it when it does not, for example a server-to-server integration importing scans as they come. Small tilt correction (a few degrees) always runs.



25
26
27
# File 'lib/flat_api/models/omr_job_creation.rb', line 25

def auto_rotate
  @auto_rotate
end

#auto_start ⇒ Object

Start processing immediately. Only valid when files is provided.



40
41
42
# File 'lib/flat_api/models/omr_job_creation.rb', line 40

def auto_start
  @auto_start
end

#collection ⇒ Object

Target collection ID. Only used when output is library.



31
32
33
# File 'lib/flat_api/models/omr_job_creation.rb', line 31

def collection
  @collection
end

#files ⇒ Object

Optional inline inputs for a one-shot import. For multi-image or mobile capture, omit this and use addOmrJobFile.



37
38
39
# File 'lib/flat_api/models/omr_job_creation.rb', line 37

def files
  @files
end

#idempotency_key ⇒ Object

Optional client-supplied key. A retry with the same key returns the existing job instead of creating a duplicate, for safe retries on flaky networks.



34
35
36
# File 'lib/flat_api/models/omr_job_creation.rb', line 34

def idempotency_key
  @idempotency_key
end

#interactive_steps ⇒ Object

Steps at which the pipeline should pause for this client. Omit or send [] for a fully automatic import. The server only pauses at the steps listed here; declare only steps your client can actually render.



22
23
24
# File 'lib/flat_api/models/omr_job_creation.rb', line 22

def interactive_steps
  @interactive_steps
end

#locales ⇒ Object

Locale hints (BCP 47) to improve text and lyric detection, for example [\"ja\", \"en\"]. The first entry is the primary reading language. This is the input hint; the main language can be confirmed or corrected at the details step.



28
29
30
# File 'lib/flat_api/models/omr_job_creation.rb', line 28

def locales
  @locales
end

#output ⇒ Object

Returns the value of attribute output.



19
20
21
# File 'lib/flat_api/models/omr_job_creation.rb', line 19

def output
  @output
end

Class Method Details

.acceptable_attribute_map ⇒ Object

Returns attribute mapping this model knows about



79
80
81
# File 'lib/flat_api/models/omr_job_creation.rb', line 79

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



84
85
86
# File 'lib/flat_api/models/omr_job_creation.rb', line 84

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_map ⇒ Object

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



65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/flat_api/models/omr_job_creation.rb', line 65

def self.attribute_map
  {
    :'output' => :'output',
    :'interactive_steps' => :'interactiveSteps',
    :'auto_rotate' => :'autoRotate',
    :'locales' => :'locales',
    :'collection' => :'collection',
    :'idempotency_key' => :'idempotencyKey',
    :'files' => :'files',
    :'auto_start' => :'autoStart'
  }
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



212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/flat_api/models/omr_job_creation.rb', line 212

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullable ⇒ Object

List of attributes with nullable: true



103
104
105
106
# File 'lib/flat_api/models/omr_job_creation.rb', line 103

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_types ⇒ Object

Attribute type mapping.



89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/flat_api/models/omr_job_creation.rb', line 89

def self.openapi_types
  {
    :'output' => :'OmrJobOutput',
    :'interactive_steps' => :'Array<OmrStepName>',
    :'auto_rotate' => :'Boolean',
    :'locales' => :'Array<String>',
    :'collection' => :'String',
    :'idempotency_key' => :'String',
    :'files' => :'Array<OmrJobInputFile>',
    :'auto_start' => :'Boolean'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object) —

    to be compared



184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/flat_api/models/omr_job_creation.rb', line 184

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      output == o.output &&
      interactive_steps == o.interactive_steps &&
      auto_rotate == o.auto_rotate &&
      locales == o.locales &&
      collection == o.collection &&
      idempotency_key == o.idempotency_key &&
      files == o.files &&
      auto_start == o.auto_start
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object) —

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


199
200
201
# File 'lib/flat_api/models/omr_job_creation.rb', line 199

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



205
206
207
# File 'lib/flat_api/models/omr_job_creation.rb', line 205

def hash
  [output, interactive_steps, auto_rotate, locales, collection, idempotency_key, files, auto_start].hash
end

#list_invalid_properties ⇒ Object

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



169
170
171
172
173
# File 'lib/flat_api/models/omr_job_creation.rb', line 169

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/flat_api/models/omr_job_creation.rb', line 234

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid? ⇒ Boolean

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

Returns:

  • (Boolean) —

    true if the model is valid



177
178
179
180
# File 'lib/flat_api/models/omr_job_creation.rb', line 177

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end