abbyy-cloud 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -13
- data/.travis.yml +1 -1
- data/CHANGELOG.md +11 -0
- data/README.md +29 -0
- data/abbyy-cloud.gemspec +4 -2
- data/lib/abbyy/cloud.rb +14 -26
- data/lib/abbyy/cloud/connection.rb +3 -10
- data/lib/abbyy/cloud/exceptions/response_error.rb +1 -1
- data/lib/abbyy/cloud/models/cost_type.rb +14 -0
- data/lib/abbyy/cloud/models/currency.rb +14 -0
- data/lib/abbyy/cloud/models/direction.rb +0 -1
- data/lib/abbyy/cloud/models/discount.rb +2 -1
- data/lib/abbyy/cloud/models/discount_type.rb +19 -0
- data/lib/abbyy/cloud/models/engine.rb +0 -2
- data/lib/abbyy/cloud/models/error.rb +0 -1
- data/lib/abbyy/cloud/models/file_format.rb +19 -0
- data/lib/abbyy/cloud/models/file_info.rb +33 -0
- data/lib/abbyy/cloud/models/file_link.rb +18 -0
- data/lib/abbyy/cloud/models/file_read_error.rb +20 -0
- data/lib/abbyy/cloud/models/file_read_status.rb +14 -0
- data/lib/abbyy/cloud/models/file_reference.rb +11 -0
- data/lib/abbyy/cloud/models/full_order.rb +46 -0
- data/lib/abbyy/cloud/models/label.rb +14 -0
- data/lib/abbyy/cloud/models/ocr_mode.rb +19 -0
- data/lib/abbyy/cloud/models/ocr_quality.rb +18 -0
- data/lib/abbyy/cloud/models/ocr_settings.rb +16 -0
- data/lib/abbyy/cloud/models/ocr_statistics.rb +13 -0
- data/lib/abbyy/cloud/models/ocr_warning.rb +16 -0
- data/lib/abbyy/cloud/models/ocr_warning_type.rb +29 -0
- data/lib/abbyy/cloud/models/order_statistics.rb +15 -0
- data/lib/abbyy/cloud/models/payment_type.rb +14 -0
- data/lib/abbyy/cloud/models/price.rb +1 -1
- data/lib/abbyy/cloud/models/reading_status.rb +20 -0
- data/lib/abbyy/cloud/models/source_segment.rb +0 -1
- data/lib/abbyy/cloud/models/source_tag.rb +0 -1
- data/lib/abbyy/cloud/models/status.rb +25 -0
- data/lib/abbyy/cloud/models/text_statistics.rb +15 -0
- data/lib/abbyy/cloud/models/transfer_data.rb +0 -3
- data/lib/abbyy/cloud/models/translation.rb +0 -2
- data/lib/abbyy/cloud/models/translation_link.rb +18 -0
- data/lib/abbyy/cloud/models/translation_segment.rb +0 -1
- data/lib/abbyy/cloud/models/translation_type.rb +14 -0
- data/lib/abbyy/cloud/models/unit_price.rb +3 -0
- data/lib/abbyy/cloud/models/unit_type.rb +14 -0
- data/lib/abbyy/cloud/namespaces/files.rb +19 -0
- data/lib/abbyy/cloud/namespaces/orders.rb +17 -0
- data/lib/abbyy/cloud/namespaces/prices.rb +1 -1
- data/lib/abbyy/cloud/operations/base.rb +56 -19
- data/lib/abbyy/cloud/operations/download_file.rb +12 -0
- data/lib/abbyy/cloud/operations/engines.rb +1 -1
- data/lib/abbyy/cloud/operations/find_order.rb +13 -0
- data/lib/abbyy/cloud/operations/prices.rb +1 -1
- data/lib/abbyy/cloud/operations/submit_order.rb +32 -0
- data/lib/abbyy/cloud/operations/translate.rb +1 -1
- data/lib/abbyy/cloud/operations/translate_segments.rb +1 -1
- data/lib/abbyy/cloud/operations/upload_file.rb +22 -0
- data/lib/abbyy/cloud/types.rb +8 -17
- data/spec/feature/abbyy/files_download_spec.rb +57 -0
- data/spec/feature/abbyy/files_upload_spec.rb +129 -0
- data/spec/feature/abbyy/orders_create_spec.rb +245 -0
- data/spec/feature/abbyy/orders_find_spec.rb +116 -0
- data/spec/{abbyy → unit/abbyy}/cloud/connection_spec.rb +1 -1
- data/spec/{abbyy → unit/abbyy}/cloud/models/direction_spec.rb +0 -0
- data/spec/{abbyy → unit/abbyy}/cloud/models/discount_spec.rb +0 -0
- data/spec/{abbyy → unit/abbyy}/cloud/models/engine_spec.rb +0 -0
- data/spec/{abbyy → unit/abbyy}/cloud/models/error_spec.rb +0 -0
- data/spec/unit/abbyy/cloud/models/file_link_spec.rb +51 -0
- data/spec/unit/abbyy/cloud/models/file_reference_spec.rb +24 -0
- data/spec/unit/abbyy/cloud/models/full_order_spec.rb +192 -0
- data/spec/{abbyy → unit/abbyy}/cloud/models/locale_spec.rb +0 -0
- data/spec/unit/abbyy/cloud/models/order_statistics_spec.rb +15 -0
- data/spec/{abbyy → unit/abbyy}/cloud/models/price_spec.rb +0 -8
- data/spec/{abbyy → unit/abbyy}/cloud/models/source_segment_spec.rb +0 -0
- data/spec/{abbyy → unit/abbyy}/cloud/models/source_tag_spec.rb +0 -0
- data/spec/{abbyy → unit/abbyy}/cloud/models/transfer_data_spec.rb +0 -0
- data/spec/unit/abbyy/cloud/models/translation_link_spec.rb +66 -0
- data/spec/{abbyy → unit/abbyy}/cloud/models/translation_segment_spec.rb +0 -0
- data/spec/{abbyy → unit/abbyy}/cloud/models/translation_spec.rb +0 -0
- data/spec/{abbyy → unit/abbyy}/cloud/models/unit_price_spec.rb +0 -0
- data/spec/{abbyy → unit/abbyy}/cloud/response_error_spec.rb +0 -0
- data/spec/{abbyy → unit/abbyy}/cloud/settings_spec.rb +0 -0
- data/spec/{abbyy → unit/abbyy}/cloud_spec.rb +0 -0
- metadata +114 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e315b9643988d2d779dbbe0e22deca6552111e47
|
4
|
+
data.tar.gz: 1255379a0e408cdba1c524395d8c2a3a653bf7f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71b4414e1f7f9aba1058e7bac40dc5fa38c0f14079c593ba5426b89f1b015b492a626472debad76e2282c4cf3f1ad543ab7b9f5005f7446034b8a0e831ce0153
|
7
|
+
data.tar.gz: 8fe5ec65636e196b1a9e2e1da3cd539a279b89891929414256bdc91c79d0620dee8906a0329c0756af60186b724b315fe16afb1fa82ecb87ca3a4e04a62b2877
|
data/.rubocop.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require: rubocop
|
1
|
+
require: rubocop
|
2
2
|
|
3
3
|
AllCops:
|
4
4
|
Include:
|
@@ -12,12 +12,6 @@ AllCops:
|
|
12
12
|
- vendor/**/*
|
13
13
|
TargetRubyVersion: 2.3
|
14
14
|
|
15
|
-
RSpec/NamedSubject:
|
16
|
-
Enabled: false
|
17
|
-
|
18
|
-
RSpec/DescribeClass:
|
19
|
-
Enabled: false
|
20
|
-
|
21
15
|
Documentation:
|
22
16
|
Enabled: false
|
23
17
|
|
@@ -41,21 +35,21 @@ Style/AccessorMethodName:
|
|
41
35
|
Style/Alias:
|
42
36
|
Enabled: false # `alias_method` and `alias` have diferent behaviour
|
43
37
|
|
44
|
-
Style/
|
38
|
+
Style/ClassAndModuleChildren:
|
45
39
|
Enabled: false
|
46
40
|
|
47
|
-
Style/
|
41
|
+
Style/FileName:
|
48
42
|
Enabled: false
|
49
43
|
|
50
|
-
Style/
|
44
|
+
Style/FrozenStringLiteralComment:
|
45
|
+
Enabled: false # not to be used before migration to Ruby 3+
|
46
|
+
|
47
|
+
Style/Lambda:
|
51
48
|
Enabled: false
|
52
49
|
|
53
50
|
Style/NumericLiterals:
|
54
51
|
Enabled: false
|
55
52
|
|
56
|
-
Style/FrozenStringLiteralComment:
|
57
|
-
Enabled: false # not to be used before migration to Ruby 3+
|
58
|
-
|
59
53
|
Style/RaiseArgs:
|
60
54
|
Enabled: false
|
61
55
|
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
# Master (to be released)
|
2
|
+
|
3
|
+
### Added
|
4
|
+
|
5
|
+
* Operation `files.upload` (nepalez)
|
6
|
+
* Operation `files.download` (nepalez)
|
7
|
+
* Operation `orders.create(options)` (nepalez)
|
8
|
+
* Operation `orders.find(id)` (nepalez)
|
9
|
+
|
10
|
+
[Compare v0.0.5...HEAD](https://github.com/nepalez/abbyy-cloud/compare/v0.0.5...HEAD)
|
11
|
+
|
1
12
|
# [v0.0.5 2016-08-23](https://github.com/nepalez/abbyy-cloud/tree/v0.0.5)
|
2
13
|
|
3
14
|
### Fixed
|
data/README.md
CHANGED
@@ -108,6 +108,35 @@ result.class # => ABBYY::Cloud::Models::TranslationSequence
|
|
108
108
|
result.map(&:text) # => ["Быть", "или не быть"]
|
109
109
|
```
|
110
110
|
|
111
|
+
### Files
|
112
|
+
|
113
|
+
The namespace `files` contains operations with <uploaded> files.
|
114
|
+
|
115
|
+
#### upload
|
116
|
+
|
117
|
+
Uploads a file
|
118
|
+
|
119
|
+
See [the specification](https://api.abbyy.cloud/swagger/ui/index#!/File/File_UploadFile)
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
file = File.read("file_to_upload.xml")
|
123
|
+
result = CLIENT.files.upload file
|
124
|
+
result.id # => "18323"
|
125
|
+
result.token # => "foobarbaz"
|
126
|
+
# ...
|
127
|
+
```
|
128
|
+
|
129
|
+
#### download
|
130
|
+
|
131
|
+
Dowloads a file by id and token
|
132
|
+
|
133
|
+
See [the specification](https://api.abbyy.cloud/swagger/ui/index#!/File/File_DownloadFile)
|
134
|
+
|
135
|
+
```ruby
|
136
|
+
result = CLIENT.files.download(id: "foo", token: "bar")
|
137
|
+
# => #<StringIO ...>
|
138
|
+
```
|
139
|
+
|
111
140
|
### Prices
|
112
141
|
|
113
142
|
The namespace `prices` contains operations with prices details.
|
data/abbyy-cloud.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = "abbyy-cloud"
|
3
|
-
gem.version = "0.0.
|
3
|
+
gem.version = "0.0.6"
|
4
4
|
gem.authors = ["Andrew Kozin"]
|
5
5
|
gem.email = ["andrew.kozin@gmail.com"]
|
6
6
|
gem.summary = "HTTP client to ABBYY Cloud API"
|
@@ -16,11 +16,13 @@ Gem::Specification.new do |gem|
|
|
16
16
|
|
17
17
|
gem.add_runtime_dependency "dry-initializer", "~> 0.4.0"
|
18
18
|
gem.add_runtime_dependency "dry-struct", "~> 0.0.1"
|
19
|
+
gem.add_runtime_dependency "hashie", "~> 3.4"
|
20
|
+
gem.add_runtime_dependency "multipart_body", "~> 0.2"
|
19
21
|
|
20
22
|
gem.add_development_dependency "bundler", "~> 1.12"
|
21
23
|
gem.add_development_dependency "rake", "~> 10.0"
|
22
24
|
gem.add_development_dependency "rspec", "~> 3.0"
|
23
25
|
gem.add_development_dependency "rspec-its", "~> 1.2"
|
24
|
-
gem.add_development_dependency "rubocop
|
26
|
+
gem.add_development_dependency "rubocop", "~> 0.42"
|
25
27
|
gem.add_development_dependency "webmock", "~> 2.0"
|
26
28
|
end
|
data/lib/abbyy/cloud.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
require "dry-initializer"
|
2
2
|
require "dry-struct"
|
3
|
+
require "hashie/mash"
|
3
4
|
require "json"
|
4
5
|
require "net/http"
|
5
6
|
require "net/https"
|
7
|
+
require "multipart_body"
|
6
8
|
|
7
9
|
module ABBYY
|
8
10
|
class Cloud
|
@@ -11,32 +13,10 @@ module ABBYY
|
|
11
13
|
require_relative "cloud/connection"
|
12
14
|
require_relative "cloud/settings"
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
require_relative "cloud/models/direction"
|
19
|
-
require_relative "cloud/models/discount"
|
20
|
-
require_relative "cloud/models/engine"
|
21
|
-
require_relative "cloud/models/error"
|
22
|
-
require_relative "cloud/models/locale"
|
23
|
-
require_relative "cloud/models/price"
|
24
|
-
require_relative "cloud/models/source_segment"
|
25
|
-
require_relative "cloud/models/source_tag"
|
26
|
-
require_relative "cloud/models/transfer_data"
|
27
|
-
require_relative "cloud/models/translation"
|
28
|
-
require_relative "cloud/models/translation_segment"
|
29
|
-
require_relative "cloud/models/unit_price"
|
30
|
-
|
31
|
-
require_relative "cloud/operations/base"
|
32
|
-
require_relative "cloud/operations/engines"
|
33
|
-
require_relative "cloud/operations/prices"
|
34
|
-
require_relative "cloud/operations/translate"
|
35
|
-
require_relative "cloud/operations/translate_segments"
|
36
|
-
|
37
|
-
require_relative "cloud/namespaces/base"
|
38
|
-
require_relative "cloud/namespaces/machine_translations"
|
39
|
-
require_relative "cloud/namespaces/prices"
|
16
|
+
%w(exceptions models operations namespaces).each do |dir|
|
17
|
+
path = File.expand_path("lib/abbyy/cloud/#{dir}/**")
|
18
|
+
Dir[path].each { |file| require file }
|
19
|
+
end
|
40
20
|
|
41
21
|
attr_reader :settings
|
42
22
|
|
@@ -44,10 +24,18 @@ module ABBYY
|
|
44
24
|
Namespaces::MachineTranslations.new(settings)
|
45
25
|
end
|
46
26
|
|
27
|
+
def orders
|
28
|
+
Namespaces::Orders.new(settings)
|
29
|
+
end
|
30
|
+
|
47
31
|
def prices
|
48
32
|
Namespaces::Prices.new(settings)
|
49
33
|
end
|
50
34
|
|
35
|
+
def files
|
36
|
+
Namespaces::Files.new(settings)
|
37
|
+
end
|
38
|
+
|
51
39
|
private
|
52
40
|
|
53
41
|
def initialize(*args)
|
@@ -13,11 +13,11 @@ class ABBYY::Cloud
|
|
13
13
|
|
14
14
|
attr_reader :root
|
15
15
|
|
16
|
-
def call(http_method, path, **options)
|
16
|
+
def call(http_method, path, body: nil, **options)
|
17
17
|
uri = prepare_uri(path, options)
|
18
18
|
req = Net::HTTP.const_get(http_method.capitalize).new(uri)
|
19
|
+
req.body = body
|
19
20
|
setup_headers(req, options)
|
20
|
-
setup_body(req, options)
|
21
21
|
|
22
22
|
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
|
23
23
|
http.request(req)
|
@@ -42,19 +42,12 @@ class ABBYY::Cloud
|
|
42
42
|
def setup_headers(req, headers: nil, **)
|
43
43
|
req.basic_auth id, token
|
44
44
|
req["accept-charset"] = "utf-8"
|
45
|
-
req["accept"] = "application/json"
|
46
|
-
req["content-type"] = "application/json"
|
47
45
|
headers.to_h.each { |key, value| req[key.to_s] = value }
|
48
46
|
end
|
49
47
|
|
50
|
-
def setup_body(req, body: nil, **)
|
51
|
-
return unless req["content-type"] == "application/json"
|
52
|
-
req.body = JSON(body.to_h)
|
53
|
-
end
|
54
|
-
|
55
48
|
def handle_response(response)
|
56
49
|
raise ResponseError.new(response) unless response.is_a? Net::HTTPSuccess
|
57
|
-
|
50
|
+
response.body
|
58
51
|
end
|
59
52
|
end
|
60
53
|
end
|
@@ -9,7 +9,7 @@ class ABBYY::Cloud
|
|
9
9
|
@status = response.code.to_i
|
10
10
|
|
11
11
|
super <<-MESSAGE.gsub(/ +\|/, "")
|
12
|
-
|ABBYY Cloud API responded to the request {data.request_id} with a status #{status}
|
12
|
+
|ABBYY Cloud API responded to the request #{data.request_id} with a status #{status}
|
13
13
|
| error: #{data.error}
|
14
14
|
| description: #{data.error_description}
|
15
15
|
| model_state: #{data.model_state}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class ABBYY::Cloud
|
2
|
+
module Models
|
3
|
+
class CostType < ::String
|
4
|
+
VALUES = %w(Default SomeDiscounts AllDiscounts).freeze
|
5
|
+
|
6
|
+
def self.new(string)
|
7
|
+
super Types::Strict::String.constrained(included_in: VALUES)[string]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
# Registers type Types::CostType
|
12
|
+
Types.register_type CostType
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class ABBYY::Cloud
|
2
|
+
module Models
|
3
|
+
class Currency < ::String
|
4
|
+
FORMAT = /\A[A-Z]{3}\z/
|
5
|
+
|
6
|
+
def self.new(string)
|
7
|
+
super Types::Strict::String.constrained(format: FORMAT)[string]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
# Registers type Types::Currency
|
12
|
+
Types.register_type Currency
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class ABBYY::Cloud
|
2
|
+
module Models
|
3
|
+
class DiscountType < ::String
|
4
|
+
VALUES = %w(
|
5
|
+
TMTextMatch
|
6
|
+
TMTaggedTextMatch
|
7
|
+
TMHalfContextMatch
|
8
|
+
TMFullContextMatch
|
9
|
+
).freeze
|
10
|
+
|
11
|
+
def self.new(string)
|
12
|
+
super Types::Strict::String.constrained(included_in: VALUES)[string]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Registers type Types::DiscountType
|
17
|
+
Types.register_type DiscountType
|
18
|
+
end
|
19
|
+
end
|
@@ -2,9 +2,7 @@ require_relative "locale"
|
|
2
2
|
require_relative "direction"
|
3
3
|
|
4
4
|
class ABBYY::Cloud
|
5
|
-
# Collection of models returned in requests
|
6
5
|
module Models
|
7
|
-
# Description of the engine
|
8
6
|
class Engine < Struct
|
9
7
|
attribute :name, Types::Strict::String
|
10
8
|
attribute :languages, Types::Array.member(Types::Locale)
|
@@ -1,7 +1,6 @@
|
|
1
1
|
class ABBYY::Cloud
|
2
2
|
# Collection of models returned in requests
|
3
3
|
module Models
|
4
|
-
# An error returned by the server in case of wrong response
|
5
4
|
class Error < Struct
|
6
5
|
attribute :request_id, Types::Strict::String.optional
|
7
6
|
attribute :error, Types::Strict::String.optional
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class ABBYY::Cloud
|
2
|
+
module Models
|
3
|
+
class FileFormat < ::String
|
4
|
+
VALUES = %w(
|
5
|
+
Doc
|
6
|
+
Docx
|
7
|
+
Rtf
|
8
|
+
Txt
|
9
|
+
).freeze
|
10
|
+
|
11
|
+
def self.new(string)
|
12
|
+
super Types::Strict::String.constrained(included_in: VALUES)[string]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Registers type Types::FileFormat
|
17
|
+
Types.register_type FileFormat
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require_relative "file_reference"
|
2
|
+
require_relative "locale"
|
3
|
+
require_relative "ocr_settings"
|
4
|
+
require_relative "ocr_statistics"
|
5
|
+
require_relative "ocr_warning"
|
6
|
+
require_relative "reading_status"
|
7
|
+
require_relative "text_statistics"
|
8
|
+
|
9
|
+
class ABBYY::Cloud
|
10
|
+
module Models
|
11
|
+
class FileInfo < FileReference
|
12
|
+
attribute :name, Types::Strict::String
|
13
|
+
attribute :mime, Types::Strict::String
|
14
|
+
attribute :created, Types::Form::Time
|
15
|
+
attribute :is_recognizable, Types::Form::Bool
|
16
|
+
attribute :is_deleted, Types::Form::Bool
|
17
|
+
attribute :reading_status, Types::Strict::String
|
18
|
+
attribute :reading_progress, Types::Coercible::Int
|
19
|
+
attribute :expected_languages, Types::Array.member(Types::Locale).optional
|
20
|
+
attribute :processed, Types::Form::Time.optional
|
21
|
+
attribute :deleted, Types::Form::Time.optional
|
22
|
+
attribute :error, Types::Strict::String.optional
|
23
|
+
attribute :statistics, Types::TextStatistics.optional
|
24
|
+
attribute :ocr_settings, Types::OcrSettings.optional
|
25
|
+
attribute :ocr_statistics, Types::OcrStatistics.optional
|
26
|
+
attribute :ocr_warnings,
|
27
|
+
Types::Array.member(Types::OcrWarning).optional
|
28
|
+
end
|
29
|
+
|
30
|
+
# Registers type Types::FileInfo
|
31
|
+
Types.register_type FileInfo
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative "file_reference"
|
2
|
+
require_relative "locale"
|
3
|
+
|
4
|
+
class ABBYY::Cloud
|
5
|
+
module Models
|
6
|
+
class FileLink < FileReference
|
7
|
+
attribute :name, Types::Strict::String
|
8
|
+
attribute :language, Types::Locale
|
9
|
+
attribute :is_deleted, Types::Form::Bool
|
10
|
+
attribute :chars_count, Types::Coercible::Int.optional
|
11
|
+
attribute :words_count, Types::Coercible::Int.optional
|
12
|
+
attribute :pages_count, Types::Coercible::Int.optional
|
13
|
+
end
|
14
|
+
|
15
|
+
# Registers type Types::FileLink
|
16
|
+
Types.register_type FileLink
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class ABBYY::Cloud
|
2
|
+
module Models
|
3
|
+
class FileReadError < ::String
|
4
|
+
VALUES = %w(
|
5
|
+
Unsupported
|
6
|
+
FileEmpty
|
7
|
+
FileEncrypted
|
8
|
+
FileFormatError
|
9
|
+
UnknownError
|
10
|
+
).freeze
|
11
|
+
|
12
|
+
def self.new(string)
|
13
|
+
super Types::Strict::String.constrained(included_in: VALUES)[string]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# Registers type Types::FileReadError
|
18
|
+
Types.register_type FileReadError
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class ABBYY::Cloud
|
2
|
+
module Models
|
3
|
+
class FileReadStatus < ::String
|
4
|
+
VALUES = %w(New Submitted InProgress Done Error).freeze
|
5
|
+
|
6
|
+
def self.new(string)
|
7
|
+
super Types::Strict::String.constrained(included_in: VALUES)[string]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
# Registers type Types::FileReadStatus
|
12
|
+
Types.register_type FileReadStatus
|
13
|
+
end
|
14
|
+
end
|