abbyy-cloud 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/abbyy-cloud.gemspec +3 -3
- data/lib/abbyy/cloud.rb +2 -2
- data/lib/abbyy/cloud/exceptions/response_error.rb +5 -5
- data/lib/abbyy/cloud/model.rb +61 -0
- data/lib/abbyy/cloud/models/direction.rb +3 -3
- data/lib/abbyy/cloud/models/discount.rb +3 -3
- data/lib/abbyy/cloud/models/engine.rb +5 -4
- data/lib/abbyy/cloud/models/error.rb +6 -5
- data/lib/abbyy/cloud/models/file_info.rb +18 -15
- data/lib/abbyy/cloud/models/file_link.rb +6 -6
- data/lib/abbyy/cloud/models/file_reference.rb +3 -3
- data/lib/abbyy/cloud/models/full_order.rb +30 -28
- data/lib/abbyy/cloud/models/ocr_settings.rb +4 -4
- data/lib/abbyy/cloud/models/ocr_statistics.rb +5 -5
- data/lib/abbyy/cloud/models/ocr_warning.rb +9 -6
- data/lib/abbyy/cloud/models/order_statistics.rb +5 -5
- data/lib/abbyy/cloud/models/price.rb +9 -9
- data/lib/abbyy/cloud/models/source_segment.rb +4 -3
- data/lib/abbyy/cloud/models/source_tag.rb +5 -4
- data/lib/abbyy/cloud/models/text_statistics.rb +5 -5
- data/lib/abbyy/cloud/models/transfer_data.rb +3 -3
- data/lib/abbyy/cloud/models/translation.rb +3 -3
- data/lib/abbyy/cloud/models/translation_link.rb +7 -7
- data/lib/abbyy/cloud/models/translation_segment.rb +5 -4
- data/lib/abbyy/cloud/models/unit_price.rb +4 -4
- data/lib/abbyy/cloud/operations/base.rb +12 -12
- data/lib/abbyy/cloud/operations/prices.rb +5 -5
- data/lib/abbyy/cloud/operations/submit_order.rb +20 -16
- data/lib/abbyy/cloud/operations/translate.rb +4 -4
- data/lib/abbyy/cloud/operations/translate_segments.rb +4 -4
- data/lib/abbyy/cloud/operations/upload_file.rb +5 -4
- data/spec/unit/abbyy/cloud/models/direction_spec.rb +1 -1
- data/spec/unit/abbyy/cloud/models/discount_spec.rb +1 -1
- data/spec/unit/abbyy/cloud/models/engine_spec.rb +1 -1
- data/spec/unit/abbyy/cloud/models/error_spec.rb +2 -2
- data/spec/unit/abbyy/cloud/models/file_link_spec.rb +1 -1
- data/spec/unit/abbyy/cloud/models/file_reference_spec.rb +1 -1
- data/spec/unit/abbyy/cloud/models/full_order_spec.rb +1 -1
- data/spec/unit/abbyy/cloud/models/order_statistics_spec.rb +1 -1
- data/spec/unit/abbyy/cloud/models/price_spec.rb +1 -1
- data/spec/unit/abbyy/cloud/models/source_segment_spec.rb +1 -1
- data/spec/unit/abbyy/cloud/models/source_tag_spec.rb +1 -1
- data/spec/unit/abbyy/cloud/models/transfer_data_spec.rb +1 -1
- data/spec/unit/abbyy/cloud/models/translation_link_spec.rb +1 -1
- data/spec/unit/abbyy/cloud/models/translation_segment_spec.rb +1 -1
- data/spec/unit/abbyy/cloud/models/translation_spec.rb +1 -1
- data/spec/unit/abbyy/cloud/models/unit_price_spec.rb +1 -1
- metadata +8 -8
- data/lib/abbyy/cloud/struct.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2c718870d311c032c56d09eaefe85358d8053c6
|
4
|
+
data.tar.gz: 6b5236b37d7d2362cdb46f390a99cc4ed4d84675
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e18b7be8f087be2564513df127d8676f7a0047cf807fc7ad8b12332505c69cad972c9c3ef76dcd74687ad3f57521bde7d1b27aad0f83b24729f6958d0fe87b4f
|
7
|
+
data.tar.gz: 7db9109e79a27f3100ad6e198b5e4f967e61662d181da6cb351c8e3ee5bb298f4e69a0fe60c038fdcb89699c800cce344e994fb6787d64a36510abb331803083
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
# Master (to be released)
|
2
2
|
|
3
|
-
[Compare v0.0.
|
3
|
+
[Compare v0.0.9...HEAD](https://github.com/nepalez/abbyy-cloud/compare/v0.0.9...HEAD)
|
4
|
+
|
5
|
+
# [v0.0.9 2016-10-11](https://github.com/nepalez/abbyy-cloud/tree/v0.0.9)
|
6
|
+
|
7
|
+
### Internal
|
8
|
+
|
9
|
+
* Update dependency from the `dry-initializer` gem (nepalez)
|
10
|
+
* Switch from Dry::Struct to native ABBYY::Cloud::Model (nepalez)
|
11
|
+
* Drop dependency from `dry-struct` gem (nepalez)
|
12
|
+
|
13
|
+
[Compare v0.0.8...v0.0.9](https://github.com/nepalez/abbyy-cloud/compare/v0.0.8...v0.0.9)
|
4
14
|
|
5
15
|
# [v0.0.8 2016-09-17](https://github.com/nepalez/abbyy-cloud/tree/v0.0.8)
|
6
16
|
|
data/abbyy-cloud.gemspec
CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.name = "abbyy-cloud"
|
6
|
-
gem.version = "0.0.
|
6
|
+
gem.version = "0.0.9"
|
7
7
|
gem.authors = ["Andrew Kozin"]
|
8
8
|
gem.email = ["andrew.kozin@gmail.com"]
|
9
9
|
gem.summary = "HTTP client to ABBYY Cloud API"
|
@@ -17,8 +17,8 @@ Gem::Specification.new do |gem|
|
|
17
17
|
|
18
18
|
gem.required_ruby_version = ">= 2.3.0"
|
19
19
|
|
20
|
-
gem.add_runtime_dependency "dry-initializer", "~> 0.
|
21
|
-
gem.add_runtime_dependency "dry-
|
20
|
+
gem.add_runtime_dependency "dry-initializer", "~> 0.6"
|
21
|
+
gem.add_runtime_dependency "dry-types", "~> 0.9.0"
|
22
22
|
gem.add_runtime_dependency "hashie", "~> 3.4"
|
23
23
|
gem.add_runtime_dependency "multipart_body", "~> 0.2"
|
24
24
|
gem.add_runtime_dependency "mime-types", "~> 3.1"
|
data/lib/abbyy/cloud.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require "dry-initializer"
|
2
|
-
require "dry-
|
2
|
+
require "dry-types"
|
3
3
|
require "hashie/mash"
|
4
4
|
require "json"
|
5
5
|
require "net/http"
|
@@ -9,7 +9,7 @@ require "mime-types"
|
|
9
9
|
|
10
10
|
module ABBYY
|
11
11
|
class Cloud
|
12
|
-
require_relative "cloud/
|
12
|
+
require_relative "cloud/model"
|
13
13
|
require_relative "cloud/types"
|
14
14
|
require_relative "cloud/connection"
|
15
15
|
require_relative "cloud/settings"
|
@@ -5,14 +5,14 @@ class ABBYY::Cloud
|
|
5
5
|
attr_reader :status, :data
|
6
6
|
|
7
7
|
def initialize(response)
|
8
|
-
@data = Models::Error[parse_response(response)]
|
9
8
|
@status = response.code.to_i
|
9
|
+
@data = Models::Error[parse_response(response)] unless @status == 500
|
10
10
|
|
11
11
|
super <<-MESSAGE.gsub(/ +\|/, "")
|
12
|
-
|ABBYY Cloud API responded to the request #{data
|
13
|
-
| error: #{data
|
14
|
-
| description: #{data
|
15
|
-
| model_state: #{data
|
12
|
+
|ABBYY Cloud API responded to the request #{data&.request_id} with a status #{status}
|
13
|
+
| error: #{data&.error}
|
14
|
+
| description: #{data&.error_description}
|
15
|
+
| model_state: #{data&.model_state}
|
16
16
|
MESSAGE
|
17
17
|
end
|
18
18
|
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# Base structure for models describing parts of requests and responses
|
2
|
+
#
|
3
|
+
# The initializer accepts a hash with symbol/string keys,
|
4
|
+
# from which it takes and validates necessary options.
|
5
|
+
#
|
6
|
+
# The method [#to_h] converts nested data to hash
|
7
|
+
# with symbolic keys at any level of nesting.
|
8
|
+
#
|
9
|
+
class ABBYY::Cloud
|
10
|
+
class Model
|
11
|
+
class << self
|
12
|
+
include Dry::Initializer::Mixin
|
13
|
+
alias_method :attribute, :option
|
14
|
+
alias_method :param, :option
|
15
|
+
|
16
|
+
def new(value)
|
17
|
+
return value if value.is_a? self
|
18
|
+
value = value.to_h.each_with_object({}) do |(key, val), obj|
|
19
|
+
obj[key.to_sym] = val
|
20
|
+
end
|
21
|
+
super value
|
22
|
+
end
|
23
|
+
alias_method :call, :new
|
24
|
+
alias_method :[], :new
|
25
|
+
end
|
26
|
+
|
27
|
+
tolerant_to_unknown_options
|
28
|
+
|
29
|
+
def ==(other)
|
30
|
+
return false unless other.respond_to? :to_h
|
31
|
+
to_h == other.to_h
|
32
|
+
end
|
33
|
+
|
34
|
+
def to_h
|
35
|
+
attributes = method(:initialize)
|
36
|
+
.parameters
|
37
|
+
.map { |item| item[1] unless item[0] == :keyrest }.compact
|
38
|
+
|
39
|
+
attributes.each_with_object({}) do |key, hash|
|
40
|
+
val = send(key)
|
41
|
+
hash[key] = hashify(val) unless val == Dry::Initializer::UNDEFINED
|
42
|
+
end
|
43
|
+
end
|
44
|
+
alias_method :[], :send
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def hashify(value)
|
49
|
+
if value.is_a? ABBYY::Cloud::Model
|
50
|
+
value.to_h
|
51
|
+
elsif value.respond_to? :to_hash
|
52
|
+
value.to_hash
|
53
|
+
.each_with_object({}) { |(key, val), obj| obj[key] = hashify(val) }
|
54
|
+
elsif value.is_a? Enumerable
|
55
|
+
value.map { |val| hashify(val) }
|
56
|
+
else
|
57
|
+
value
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -2,9 +2,9 @@ require_relative "locale"
|
|
2
2
|
|
3
3
|
class ABBYY::Cloud
|
4
4
|
module Models
|
5
|
-
class Direction <
|
6
|
-
attribute :source, Types::Locale
|
7
|
-
attribute :target, Types::Locale
|
5
|
+
class Direction < Model
|
6
|
+
attribute :source, type: Types::Locale
|
7
|
+
attribute :target, type: Types::Locale
|
8
8
|
end
|
9
9
|
|
10
10
|
# Registers type Types::Direction
|
@@ -2,9 +2,9 @@ require_relative "discount_type"
|
|
2
2
|
|
3
3
|
class ABBYY::Cloud
|
4
4
|
module Models
|
5
|
-
class Discount <
|
6
|
-
attribute :discount_type, Types::DiscountType
|
7
|
-
attribute :discount, Types::Coercible::Float
|
5
|
+
class Discount < Model
|
6
|
+
attribute :discount_type, type: Types::DiscountType
|
7
|
+
attribute :discount, type: Types::Coercible::Float
|
8
8
|
end
|
9
9
|
|
10
10
|
# Registers type Types::Discount
|
@@ -3,10 +3,11 @@ require_relative "direction"
|
|
3
3
|
|
4
4
|
class ABBYY::Cloud
|
5
5
|
module Models
|
6
|
-
class Engine <
|
7
|
-
attribute :name,
|
8
|
-
attribute :languages,
|
9
|
-
attribute :translation_directions,
|
6
|
+
class Engine < Model
|
7
|
+
attribute :name, type: Types::Strict::String
|
8
|
+
attribute :languages, type: Types::Array.member(Types::Locale)
|
9
|
+
attribute :translation_directions,
|
10
|
+
type: Types::Array.member(Types::Direction)
|
10
11
|
end
|
11
12
|
|
12
13
|
# Registers type Types::Engine
|
@@ -1,11 +1,12 @@
|
|
1
1
|
class ABBYY::Cloud
|
2
2
|
# Collection of models returned in requests
|
3
3
|
module Models
|
4
|
-
class Error <
|
5
|
-
attribute :request_id, Types::Strict::String
|
6
|
-
attribute :error, Types::Strict::String
|
7
|
-
attribute :error_description, Types::Strict::String
|
8
|
-
attribute :model_state, Types::Hash.
|
4
|
+
class Error < Model
|
5
|
+
attribute :request_id, type: Types::Strict::String, optional: true
|
6
|
+
attribute :error, type: Types::Strict::String, optional: true
|
7
|
+
attribute :error_description, type: Types::Strict::String, optional: true
|
8
|
+
attribute :model_state, type: Types::Hash.constrained(type: Hash),
|
9
|
+
optional: true
|
9
10
|
end
|
10
11
|
end
|
11
12
|
end
|
@@ -9,22 +9,25 @@ require_relative "text_statistics"
|
|
9
9
|
class ABBYY::Cloud
|
10
10
|
module Models
|
11
11
|
class FileInfo < FileReference
|
12
|
-
attribute :name,
|
13
|
-
attribute :mime,
|
14
|
-
attribute :created,
|
15
|
-
attribute :is_recognizable,
|
16
|
-
attribute :is_deleted,
|
17
|
-
attribute :reading_status,
|
18
|
-
attribute :reading_progress,
|
19
|
-
attribute :
|
20
|
-
attribute :
|
21
|
-
attribute :
|
22
|
-
attribute :
|
23
|
-
attribute :
|
24
|
-
attribute :
|
25
|
-
attribute :
|
12
|
+
attribute :name, type: Types::Strict::String
|
13
|
+
attribute :mime, type: Types::Strict::String
|
14
|
+
attribute :created, type: Types::Form::Time
|
15
|
+
attribute :is_recognizable, type: Types::Form::Bool
|
16
|
+
attribute :is_deleted, type: Types::Form::Bool
|
17
|
+
attribute :reading_status, type: Types::Strict::String
|
18
|
+
attribute :reading_progress, type: Types::Coercible::Int
|
19
|
+
attribute :processed, type: Types::Form::Time, optional: true
|
20
|
+
attribute :deleted, type: Types::Form::Time, optional: true
|
21
|
+
attribute :error, type: Types::Strict::String, optional: true
|
22
|
+
attribute :statistics, type: Types::TextStatistics, optional: true
|
23
|
+
attribute :ocr_settings, type: Types::OcrSettings, optional: true
|
24
|
+
attribute :ocr_statistics, type: Types::OcrStatistics, optional: true
|
25
|
+
attribute :expected_languages,
|
26
|
+
type: Types::Array.member(Types::Locale),
|
27
|
+
optional: true
|
26
28
|
attribute :ocr_warnings,
|
27
|
-
Types::Array.member(Types::OcrWarning)
|
29
|
+
type: Types::Array.member(Types::OcrWarning),
|
30
|
+
optional: true
|
28
31
|
end
|
29
32
|
|
30
33
|
# Registers type Types::FileInfo
|
@@ -4,12 +4,12 @@ require_relative "locale"
|
|
4
4
|
class ABBYY::Cloud
|
5
5
|
module Models
|
6
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
|
11
|
-
attribute :words_count, Types::Coercible::Int
|
12
|
-
attribute :pages_count, Types::Coercible::Int
|
7
|
+
attribute :name, type: Types::Strict::String
|
8
|
+
attribute :language, type: Types::Locale
|
9
|
+
attribute :is_deleted, type: Types::Form::Bool
|
10
|
+
attribute :chars_count, type: Types::Coercible::Int, optional: true
|
11
|
+
attribute :words_count, type: Types::Coercible::Int, optional: true
|
12
|
+
attribute :pages_count, type: Types::Coercible::Int, optional: true
|
13
13
|
end
|
14
14
|
|
15
15
|
# Registers type Types::FileLink
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class ABBYY::Cloud
|
2
2
|
module Models
|
3
|
-
class FileReference <
|
4
|
-
attribute :id, Types::Strict::String
|
5
|
-
attribute :token, Types::Strict::String
|
3
|
+
class FileReference < Model
|
4
|
+
attribute :id, type: Types::Strict::String
|
5
|
+
attribute :token, type: Types::Strict::String
|
6
6
|
end
|
7
7
|
|
8
8
|
# Registers type Types::FileReference
|
@@ -10,34 +10,36 @@ require_relative "unit_type"
|
|
10
10
|
|
11
11
|
class ABBYY::Cloud
|
12
12
|
module Models
|
13
|
-
class FullOrder <
|
14
|
-
attribute :amount, Types::Coercible::Float
|
15
|
-
attribute :approval_required, Types::Form::Bool
|
16
|
-
|
17
|
-
attribute :
|
18
|
-
attribute :
|
19
|
-
attribute :
|
20
|
-
attribute :
|
21
|
-
attribute :
|
22
|
-
attribute :
|
23
|
-
attribute :
|
24
|
-
attribute :
|
25
|
-
attribute :
|
26
|
-
attribute :
|
27
|
-
attribute :
|
28
|
-
|
29
|
-
attribute :
|
30
|
-
attribute :
|
31
|
-
attribute :
|
32
|
-
attribute :
|
33
|
-
attribute :
|
34
|
-
attribute :
|
35
|
-
attribute :
|
36
|
-
attribute :
|
37
|
-
attribute :
|
38
|
-
attribute :
|
39
|
-
attribute :
|
40
|
-
attribute :
|
13
|
+
class FullOrder < Model
|
14
|
+
attribute :amount, type: Types::Coercible::Float, optional: true
|
15
|
+
attribute :approval_required, type: Types::Form::Bool,
|
16
|
+
default: proc { false }
|
17
|
+
attribute :created, type: Types::Form::Time.constrained(type: Time)
|
18
|
+
attribute :currency, type: Types::Currency
|
19
|
+
attribute :deadline, type: Types::Form::Time, optional: true
|
20
|
+
attribute :deleted, type: Types::Form::Time, optional: true
|
21
|
+
attribute :delivered, type: Types::Form::Time, optional: true
|
22
|
+
attribute :email, type: Types::Strict::String
|
23
|
+
attribute :from, type: Types::Locale
|
24
|
+
attribute :id, type: Types::Strict::String
|
25
|
+
attribute :is_deleted, type: Types::Form::Bool
|
26
|
+
attribute :is_layout_required, type: Types::Form::Bool
|
27
|
+
attribute :is_manual_estimation, type: Types::Form::Bool,
|
28
|
+
default: proc { false }
|
29
|
+
attribute :label, type: Types::Label, optional: true
|
30
|
+
attribute :number, type: Types::Coercible::Int
|
31
|
+
attribute :payment_provider, type: Types::Strict::String, optional: true
|
32
|
+
attribute :payment_type, type: Types::PaymentType
|
33
|
+
attribute :progress, type: Types::Coercible::Int
|
34
|
+
attribute :started, type: Types::Form::Time, optional: true
|
35
|
+
attribute :statistics, type: Types::OrderStatistics, optional: true
|
36
|
+
attribute :status, type: Types::Status
|
37
|
+
attribute :to, type: Types::FilledArray.member(Types::Locale)
|
38
|
+
attribute :translations, type: Types::Array.member(Types::TranslationLink)
|
39
|
+
attribute :type, type: Types::TranslationType
|
40
|
+
attribute :unit_count, type: Types::Coercible::Int, optional: true
|
41
|
+
attribute :unit_type, type: Types::UnitType, optional: true
|
42
|
+
attribute :units_count, type: Types::Hash, optional: true
|
41
43
|
end
|
42
44
|
|
43
45
|
# Registers type Types::FullOrder
|
@@ -4,10 +4,10 @@ require_relative "ocr_quality"
|
|
4
4
|
|
5
5
|
class ABBYY::Cloud
|
6
6
|
module Models
|
7
|
-
class OcrSettings <
|
8
|
-
attribute :format, Types::FileFormat
|
9
|
-
attribute :mode, Types::OcrMode
|
10
|
-
attribute :quality, Types::OcrQuality
|
7
|
+
class OcrSettings < Model
|
8
|
+
attribute :format, type: Types::FileFormat
|
9
|
+
attribute :mode, type: Types::OcrMode
|
10
|
+
attribute :quality, type: Types::OcrQuality
|
11
11
|
end
|
12
12
|
|
13
13
|
# Registers type Types::OcrSettings
|
@@ -1,10 +1,10 @@
|
|
1
1
|
class ABBYY::Cloud
|
2
2
|
module Models
|
3
|
-
class OcrStatistics <
|
4
|
-
attribute :exported_pages, Types::Coercible::Int
|
5
|
-
attribute :total_characters, Types::Coercible::Int
|
6
|
-
attribute :uncertain_characters, Types::Coercible::Int
|
7
|
-
attribute :success_part, Types::Coercible::Float
|
3
|
+
class OcrStatistics < Model
|
4
|
+
attribute :exported_pages, type: Types::Coercible::Int
|
5
|
+
attribute :total_characters, type: Types::Coercible::Int
|
6
|
+
attribute :uncertain_characters, type: Types::Coercible::Int
|
7
|
+
attribute :success_part, type: Types::Coercible::Float
|
8
8
|
end
|
9
9
|
|
10
10
|
# Registers type Types::OcrStatistics
|
@@ -2,12 +2,15 @@ require_relative "ocr_warning_type"
|
|
2
2
|
|
3
3
|
class ABBYY::Cloud
|
4
4
|
module Models
|
5
|
-
class OcrWarning <
|
6
|
-
attribute :warning_type, Types::OcrWarningType
|
7
|
-
attribute :page_number, Types::Coercible::Int
|
8
|
-
attribute :dpi, Types::Coercible::Int
|
9
|
-
|
10
|
-
attribute :
|
5
|
+
class OcrWarning < Model
|
6
|
+
attribute :warning_type, type: Types::OcrWarningType
|
7
|
+
attribute :page_number, type: Types::Coercible::Int
|
8
|
+
attribute :dpi, type: Types::Coercible::Int,
|
9
|
+
optional: true
|
10
|
+
attribute :language_count, type: Types::Coercible::Int,
|
11
|
+
optional: true
|
12
|
+
attribute :full_warning_message, type: Types::Strict::String,
|
13
|
+
optional: true
|
11
14
|
end
|
12
15
|
|
13
16
|
# Registers type Types::OcrWarning
|
@@ -2,11 +2,11 @@ require_relative "source_tag"
|
|
2
2
|
|
3
3
|
class ABBYY::Cloud
|
4
4
|
module Models
|
5
|
-
class OrderStatistics <
|
6
|
-
attribute :documents_count, Types::Coercible::Int
|
7
|
-
attribute :pages_count, Types::Coercible::Int
|
8
|
-
attribute :words_count, Types::Coercible::Int
|
9
|
-
attribute :chars_count, Types::Coercible::Int
|
5
|
+
class OrderStatistics < Model
|
6
|
+
attribute :documents_count, type: Types::Coercible::Int
|
7
|
+
attribute :pages_count, type: Types::Coercible::Int
|
8
|
+
attribute :words_count, type: Types::Coercible::Int
|
9
|
+
attribute :chars_count, type: Types::Coercible::Int
|
10
10
|
end
|
11
11
|
|
12
12
|
# Registers type Types::OrderStatistics
|
@@ -5,15 +5,15 @@ require_relative "discount"
|
|
5
5
|
class ABBYY::Cloud
|
6
6
|
module Models
|
7
7
|
# Price details
|
8
|
-
class Price <
|
9
|
-
attribute :id, Types::Strict::String
|
10
|
-
attribute :account_id, Types::Strict::String
|
11
|
-
attribute :type, Types::Strict::String
|
12
|
-
attribute :from, Types::Locale
|
13
|
-
attribute :to, Types::Locale
|
14
|
-
attribute :unit_prices, Types::Array.member(Types::UnitPrice)
|
15
|
-
attribute :discounts, Types::Array.member(Types::Discount)
|
16
|
-
attribute :created, Types::Coercible::Time
|
8
|
+
class Price < Model
|
9
|
+
attribute :id, type: Types::Strict::String
|
10
|
+
attribute :account_id, type: Types::Strict::String, optional: true
|
11
|
+
attribute :type, type: Types::Strict::String
|
12
|
+
attribute :from, type: Types::Locale
|
13
|
+
attribute :to, type: Types::Locale
|
14
|
+
attribute :unit_prices, type: Types::Array.member(Types::UnitPrice)
|
15
|
+
attribute :discounts, type: Types::Array.member(Types::Discount)
|
16
|
+
attribute :created, type: Types::Coercible::Time
|
17
17
|
end
|
18
18
|
|
19
19
|
# Registers type Types::Price
|
@@ -2,9 +2,10 @@ require_relative "source_tag"
|
|
2
2
|
|
3
3
|
class ABBYY::Cloud
|
4
4
|
module Models
|
5
|
-
class SourceSegment <
|
6
|
-
attribute :text, Types::Strict::String
|
7
|
-
attribute :tags, Types::Array.member(Types::SourceTag)
|
5
|
+
class SourceSegment < Model
|
6
|
+
attribute :text, type: Types::Strict::String
|
7
|
+
attribute :tags, type: Types::Array.member(Types::SourceTag),
|
8
|
+
default: proc { [] }
|
8
9
|
end
|
9
10
|
|
10
11
|
# Registers type Types::SourceSegment
|
@@ -2,10 +2,11 @@ class ABBYY::Cloud
|
|
2
2
|
module Models
|
3
3
|
TYPES = %w(Start End Placeholder).freeze
|
4
4
|
|
5
|
-
class SourceTag <
|
6
|
-
attribute :number, Types::Strict::Int
|
7
|
-
attribute :position, Types::Strict::Int
|
8
|
-
attribute :type,
|
5
|
+
class SourceTag < Model
|
6
|
+
attribute :number, type: Types::Strict::Int
|
7
|
+
attribute :position, type: Types::Strict::Int
|
8
|
+
attribute :type,
|
9
|
+
type: Types::Strict::String.constrained(included_in: TYPES)
|
9
10
|
end
|
10
11
|
|
11
12
|
# Registers type Types::SourceTag
|
@@ -2,11 +2,11 @@ require_relative "source_tag"
|
|
2
2
|
|
3
3
|
class ABBYY::Cloud
|
4
4
|
module Models
|
5
|
-
class TextStatistics <
|
6
|
-
attribute :language, Types::Locale
|
7
|
-
attribute :pages_count, Types::Coercible::Int
|
8
|
-
attribute :words_count, Types::Coercible::Int
|
9
|
-
attribute :chars_count, Types::Coercible::Int
|
5
|
+
class TextStatistics < Model
|
6
|
+
attribute :language, type: Types::Locale
|
7
|
+
attribute :pages_count, type: Types::Coercible::Int
|
8
|
+
attribute :words_count, type: Types::Coercible::Int
|
9
|
+
attribute :chars_count, type: Types::Coercible::Int
|
10
10
|
end
|
11
11
|
|
12
12
|
# Registers type Types::TextStatistics
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class ABBYY::Cloud
|
2
2
|
module Models
|
3
|
-
class TransferData <
|
4
|
-
attribute :position, Types::Strict::Int
|
5
|
-
attribute :order, Types::Strict::Int
|
3
|
+
class TransferData < Model
|
4
|
+
attribute :position, type: Types::Strict::Int
|
5
|
+
attribute :order, type: Types::Strict::Int
|
6
6
|
end
|
7
7
|
|
8
8
|
# Registers type Types::TransferData
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class ABBYY::Cloud
|
2
2
|
module Models
|
3
|
-
class Translation <
|
4
|
-
attribute :id, Types::Strict::String
|
5
|
-
attribute :translation, Types::Strict::String
|
3
|
+
class Translation < Model
|
4
|
+
attribute :id, type: Types::Strict::String
|
5
|
+
attribute :translation, type: Types::Strict::String
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -3,13 +3,13 @@ require_relative "file_link"
|
|
3
3
|
|
4
4
|
class ABBYY::Cloud
|
5
5
|
module Models
|
6
|
-
class TranslationLink <
|
7
|
-
attribute :delivered, Types::Form::Time
|
8
|
-
attribute :started, Types::Form::Time
|
9
|
-
attribute :progress, Types::Hash
|
10
|
-
attribute :status, Types::Status
|
11
|
-
attribute :source_file, Types::FileLink
|
12
|
-
attribute :target_file, Types::FileLink
|
6
|
+
class TranslationLink < Model
|
7
|
+
attribute :delivered, type: Types::Form::Time, optional: true
|
8
|
+
attribute :started, type: Types::Form::Time, optional: true
|
9
|
+
attribute :progress, type: Types::Hash, default: proc { {} }
|
10
|
+
attribute :status, type: Types::Status
|
11
|
+
attribute :source_file, type: Types::FileLink
|
12
|
+
attribute :target_file, type: Types::FileLink
|
13
13
|
end
|
14
14
|
|
15
15
|
# Registers type Types::TranslationLink
|
@@ -2,11 +2,12 @@ require_relative "transfer_data"
|
|
2
2
|
|
3
3
|
class ABBYY::Cloud
|
4
4
|
module Models
|
5
|
-
class TranslationSegment <
|
6
|
-
attribute :id, Types::Strict::String
|
7
|
-
attribute :text, Types::Strict::String
|
5
|
+
class TranslationSegment < Model
|
6
|
+
attribute :id, type: Types::Strict::String
|
7
|
+
attribute :text, type: Types::Strict::String
|
8
8
|
attribute :tags_transfer_data,
|
9
|
-
Types::Array.member(Types::TransferData)
|
9
|
+
type: Types::Array.member(Types::TransferData),
|
10
|
+
default: proc { [] }
|
10
11
|
end
|
11
12
|
|
12
13
|
# Registers type Types::TranslationSegment
|
@@ -4,10 +4,10 @@ require_relative "unit_type"
|
|
4
4
|
class ABBYY::Cloud
|
5
5
|
module Models
|
6
6
|
# Price details
|
7
|
-
class UnitPrice <
|
8
|
-
attribute :unit_type, Types::UnitType
|
9
|
-
attribute :currency, Types::Currency
|
10
|
-
attribute :amount, Types::Coercible::Float
|
7
|
+
class UnitPrice < Model
|
8
|
+
attribute :unit_type, type: Types::UnitType
|
9
|
+
attribute :currency, type: Types::Currency
|
10
|
+
attribute :amount, type: Types::Coercible::Float
|
11
11
|
end
|
12
12
|
|
13
13
|
# Registers type Types::UnitPrice
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative "file"
|
2
2
|
|
3
3
|
# Base class for specific operations
|
4
|
-
# It validates request and response using corresponding
|
4
|
+
# It validates request and response using corresponding models
|
5
5
|
#
|
6
6
|
# @abstract
|
7
7
|
#
|
@@ -28,32 +28,32 @@ class ABBYY::Cloud
|
|
28
28
|
value ? (@request_type = value) : (@request_type || :json)
|
29
29
|
end
|
30
30
|
|
31
|
-
def request_body(
|
32
|
-
|
31
|
+
def request_body(model = nil, &block)
|
32
|
+
provide_model :@request_body, model, &block
|
33
33
|
end
|
34
34
|
|
35
|
-
def request_query(
|
36
|
-
|
35
|
+
def request_query(model = nil, &block)
|
36
|
+
provide_model :@request_query, model, &block
|
37
37
|
end
|
38
38
|
|
39
39
|
def response_type(value = nil)
|
40
40
|
value ? (@response_type = value) : (@response_type || :json)
|
41
41
|
end
|
42
42
|
|
43
|
-
def response_body(
|
44
|
-
|
43
|
+
def response_body(model = nil, &block)
|
44
|
+
provide_model :@response_body, model, &block
|
45
45
|
end
|
46
46
|
|
47
47
|
private
|
48
48
|
|
49
|
-
def
|
49
|
+
def provide_model(variable, model, &block)
|
50
50
|
value = instance_variable_get(variable)
|
51
|
-
return value if value &&
|
51
|
+
return value if value && model.nil? && block.nil?
|
52
52
|
|
53
|
-
|
54
|
-
|
53
|
+
model ||= Class.new(Model)
|
54
|
+
.tap { |obj| obj.instance_eval(&block) if block }
|
55
55
|
|
56
|
-
instance_variable_set(variable,
|
56
|
+
instance_variable_set(variable, model)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -10,11 +10,11 @@ class ABBYY::Cloud
|
|
10
10
|
http_method "get"
|
11
11
|
|
12
12
|
request_query do
|
13
|
-
attribute :skip, Types::Strict::Int
|
14
|
-
attribute :take, Types::Strict::Int
|
15
|
-
attribute :type, Types::Strict::String
|
16
|
-
attribute :from, Types::Locale
|
17
|
-
attribute :to, Types::Locale
|
13
|
+
attribute :skip, type: Types::Strict::Int
|
14
|
+
attribute :take, type: Types::Strict::Int
|
15
|
+
attribute :type, type: Types::Strict::String, optional: true
|
16
|
+
attribute :from, type: Types::Locale, optional: true
|
17
|
+
attribute :to, type: Types::Locale, optional: true
|
18
18
|
end
|
19
19
|
|
20
20
|
response_body Types::Array.member(Types::Price)
|
@@ -10,22 +10,26 @@ class ABBYY::Cloud
|
|
10
10
|
http_method "post"
|
11
11
|
|
12
12
|
request_body do
|
13
|
-
attribute :type, Types::TranslationType
|
14
|
-
attribute :email, Types::Strict::String
|
15
|
-
attribute :contact_culture, Types::Strict::String
|
16
|
-
attribute :contact_utc_offset, Types::Coercible::String
|
17
|
-
|
18
|
-
attribute :
|
19
|
-
|
20
|
-
attribute :
|
21
|
-
|
22
|
-
attribute :
|
23
|
-
|
24
|
-
attribute :
|
25
|
-
attribute :
|
26
|
-
attribute :
|
27
|
-
attribute :
|
28
|
-
|
13
|
+
attribute :type, type: Types::TranslationType
|
14
|
+
attribute :email, type: Types::Strict::String, optional: true
|
15
|
+
attribute :contact_culture, type: Types::Strict::String, optional: true
|
16
|
+
attribute :contact_utc_offset, type: Types::Coercible::String,
|
17
|
+
optional: true
|
18
|
+
attribute :mt_engine, type: Types::Strict::String,
|
19
|
+
default: proc { false }
|
20
|
+
attribute :approval_required, type: Types::Form::Bool,
|
21
|
+
default: proc { false }
|
22
|
+
attribute :is_manual_estimation, type: Types::Form::Bool,
|
23
|
+
optional: proc { false }
|
24
|
+
attribute :unit_type, type: Types::UnitType
|
25
|
+
attribute :currency, type: Types::Currency
|
26
|
+
attribute :from, type: Types::Locale
|
27
|
+
attribute :label, type: Types::Label, optional: true
|
28
|
+
attribute :to, type: Types::FilledArray.member(Types::Locale)
|
29
|
+
attribute :files, type: Types::FilledArray.member(Types::FileReference)
|
30
|
+
attribute :category, type: Types::Strict::String, optional: true
|
31
|
+
attribute :cost_type, type: Types::CostType,
|
32
|
+
default: proc { Models::CostType.new("Default") }
|
29
33
|
end
|
30
34
|
|
31
35
|
response_body Models::FullOrder
|
@@ -8,10 +8,10 @@ class ABBYY::Cloud
|
|
8
8
|
http_method "post"
|
9
9
|
|
10
10
|
request_body do
|
11
|
-
attribute :engine, Types::Strict::String
|
12
|
-
attribute :source_language, Types::Locale
|
13
|
-
attribute :target_language, Types::Locale
|
14
|
-
attribute :source_text, Types::Strict::String
|
11
|
+
attribute :engine, type: Types::Strict::String
|
12
|
+
attribute :source_language, type: Types::Locale
|
13
|
+
attribute :target_language, type: Types::Locale
|
14
|
+
attribute :source_text, type: Types::Strict::String
|
15
15
|
end
|
16
16
|
|
17
17
|
response_body Models::Translation
|
@@ -10,10 +10,10 @@ class ABBYY::Cloud
|
|
10
10
|
http_method "post"
|
11
11
|
|
12
12
|
request_body do
|
13
|
-
attribute :engine, Types::Strict::String
|
14
|
-
attribute :from, Types::Locale
|
15
|
-
attribute :to, Types::Locale
|
16
|
-
attribute :sources, Types::Array.member(Types::SourceSegment)
|
13
|
+
attribute :engine, type: Types::Strict::String
|
14
|
+
attribute :from, type: Types::Locale
|
15
|
+
attribute :to, type: Types::Locale
|
16
|
+
attribute :sources, type: Types::Array.member(Types::SourceSegment)
|
17
17
|
end
|
18
18
|
|
19
19
|
response_body Types::Array.member(Types::TranslationSegment)
|
@@ -10,10 +10,11 @@ class ABBYY::Cloud
|
|
10
10
|
request_type :file
|
11
11
|
|
12
12
|
request_query do
|
13
|
-
attribute :quality, Types::OcrQuality
|
14
|
-
attribute :synthesisMode, Types::OcrMode
|
15
|
-
attribute :exportFormat, Types::FileFormat
|
16
|
-
attribute :languages, Types::Array.member(Types::Locale)
|
13
|
+
attribute :quality, type: Types::OcrQuality, optional: true
|
14
|
+
attribute :synthesisMode, type: Types::OcrMode, optional: true
|
15
|
+
attribute :exportFormat, type: Types::FileFormat, optional: true
|
16
|
+
attribute :languages, type: Types::Array.member(Types::Locale),
|
17
|
+
optional: true
|
17
18
|
end
|
18
19
|
|
19
20
|
response_body Types::Array.member(Types::FileInfo)
|
@@ -3,7 +3,7 @@ RSpec.describe ABBYY::Cloud::Models::Direction do
|
|
3
3
|
|
4
4
|
subject { described_class.new(data) }
|
5
5
|
|
6
|
-
it { is_expected.to be_kind_of ABBYY::Cloud::
|
6
|
+
it { is_expected.to be_kind_of ABBYY::Cloud::Model }
|
7
7
|
its(:to_h) { is_expected.to eq data }
|
8
8
|
|
9
9
|
context "with invalid source:" do
|
@@ -3,7 +3,7 @@ RSpec.describe ABBYY::Cloud::Models::Discount do
|
|
3
3
|
|
4
4
|
subject { described_class.new(data) }
|
5
5
|
|
6
|
-
it { is_expected.to be_kind_of ABBYY::Cloud::
|
6
|
+
it { is_expected.to be_kind_of ABBYY::Cloud::Model }
|
7
7
|
its(:to_h) { is_expected.to eq data }
|
8
8
|
|
9
9
|
context "with invalid discount_type:" do
|
@@ -9,7 +9,7 @@ RSpec.describe ABBYY::Cloud::Models::Engine do
|
|
9
9
|
|
10
10
|
subject { described_class.new(data) }
|
11
11
|
|
12
|
-
it { is_expected.to be_kind_of ABBYY::Cloud::
|
12
|
+
it { is_expected.to be_kind_of ABBYY::Cloud::Model }
|
13
13
|
its(:to_h) { is_expected.to eq data }
|
14
14
|
|
15
15
|
context "without name:" do
|
@@ -13,12 +13,12 @@ RSpec.describe ABBYY::Cloud::Models::Error do
|
|
13
13
|
|
14
14
|
subject { described_class.new(data) }
|
15
15
|
|
16
|
-
it { is_expected.to be_kind_of ABBYY::Cloud::
|
16
|
+
it { is_expected.to be_kind_of ABBYY::Cloud::Model }
|
17
17
|
its(:to_h) { is_expected.to eq data }
|
18
18
|
|
19
19
|
context "without params" do
|
20
20
|
let(:data) { {} }
|
21
|
-
it { is_expected.to be_kind_of ABBYY::Cloud::
|
21
|
+
it { is_expected.to be_kind_of ABBYY::Cloud::Model }
|
22
22
|
end
|
23
23
|
|
24
24
|
context "with invalid request_id:" do
|
@@ -14,7 +14,7 @@ RSpec.describe ABBYY::Cloud::Models::FileLink do
|
|
14
14
|
|
15
15
|
subject { described_class.new(data) }
|
16
16
|
|
17
|
-
it { is_expected.to be_kind_of ABBYY::Cloud::
|
17
|
+
it { is_expected.to be_kind_of ABBYY::Cloud::Model }
|
18
18
|
its(:to_h) { is_expected.to eq data }
|
19
19
|
|
20
20
|
context "without id:" do
|
@@ -3,7 +3,7 @@ RSpec.describe ABBYY::Cloud::Models::FileReference do
|
|
3
3
|
|
4
4
|
subject { described_class.new(data) }
|
5
5
|
|
6
|
-
it { is_expected.to be_kind_of ABBYY::Cloud::
|
6
|
+
it { is_expected.to be_kind_of ABBYY::Cloud::Model }
|
7
7
|
its(:to_h) { is_expected.to eq data }
|
8
8
|
|
9
9
|
context "without id:" do
|
@@ -68,7 +68,7 @@ RSpec.describe ABBYY::Cloud::Models::FullOrder do
|
|
68
68
|
|
69
69
|
subject { described_class.new(data) }
|
70
70
|
|
71
|
-
it { is_expected.to be_kind_of ABBYY::Cloud::
|
71
|
+
it { is_expected.to be_kind_of ABBYY::Cloud::Model }
|
72
72
|
|
73
73
|
context "without translations:" do
|
74
74
|
before { data.delete :translations }
|
@@ -10,6 +10,6 @@ RSpec.describe ABBYY::Cloud::Models::OrderStatistics do
|
|
10
10
|
|
11
11
|
subject { described_class.new(data) }
|
12
12
|
|
13
|
-
it { is_expected.to be_kind_of ABBYY::Cloud::
|
13
|
+
it { is_expected.to be_kind_of ABBYY::Cloud::Model }
|
14
14
|
its(:to_h) { is_expected.to eq data }
|
15
15
|
end
|
@@ -14,7 +14,7 @@ RSpec.describe ABBYY::Cloud::Models::Price do
|
|
14
14
|
|
15
15
|
subject { described_class.new(data) }
|
16
16
|
|
17
|
-
it { is_expected.to be_kind_of ABBYY::Cloud::
|
17
|
+
it { is_expected.to be_kind_of ABBYY::Cloud::Model }
|
18
18
|
its(:to_h) { is_expected.to eq data }
|
19
19
|
|
20
20
|
context "without id:" do
|
@@ -8,7 +8,7 @@ RSpec.describe ABBYY::Cloud::Models::SourceSegment do
|
|
8
8
|
|
9
9
|
subject { described_class.new(data) }
|
10
10
|
|
11
|
-
it { is_expected.to be_kind_of ABBYY::Cloud::
|
11
|
+
it { is_expected.to be_kind_of ABBYY::Cloud::Model }
|
12
12
|
its(:to_h) { is_expected.to eq data }
|
13
13
|
|
14
14
|
context "without text:" do
|
@@ -3,7 +3,7 @@ RSpec.describe ABBYY::Cloud::Models::SourceTag do
|
|
3
3
|
|
4
4
|
subject { described_class.new(data) }
|
5
5
|
|
6
|
-
it { is_expected.to be_kind_of ABBYY::Cloud::
|
6
|
+
it { is_expected.to be_kind_of ABBYY::Cloud::Model }
|
7
7
|
its(:to_h) { is_expected.to eq data }
|
8
8
|
|
9
9
|
context "with invalid number:" do
|
@@ -3,7 +3,7 @@ RSpec.describe ABBYY::Cloud::Models::TransferData do
|
|
3
3
|
|
4
4
|
subject { described_class.new(data) }
|
5
5
|
|
6
|
-
it { is_expected.to be_kind_of ABBYY::Cloud::
|
6
|
+
it { is_expected.to be_kind_of ABBYY::Cloud::Model }
|
7
7
|
its(:to_h) { is_expected.to eq data }
|
8
8
|
|
9
9
|
context "with invalid order:" do
|
@@ -29,7 +29,7 @@ RSpec.describe ABBYY::Cloud::Models::TranslationLink do
|
|
29
29
|
|
30
30
|
subject { described_class.new(data) }
|
31
31
|
|
32
|
-
it { is_expected.to be_kind_of ABBYY::Cloud::
|
32
|
+
it { is_expected.to be_kind_of ABBYY::Cloud::Model }
|
33
33
|
|
34
34
|
context "without source_file:" do
|
35
35
|
before { data.delete :source_file }
|
@@ -9,7 +9,7 @@ RSpec.describe ABBYY::Cloud::Models::TranslationSegment do
|
|
9
9
|
|
10
10
|
subject { described_class.new(data) }
|
11
11
|
|
12
|
-
it { is_expected.to be_kind_of ABBYY::Cloud::
|
12
|
+
it { is_expected.to be_kind_of ABBYY::Cloud::Model }
|
13
13
|
its(:to_h) { is_expected.to eq data }
|
14
14
|
|
15
15
|
context "without text:" do
|
@@ -3,7 +3,7 @@ RSpec.describe ABBYY::Cloud::Models::Translation do
|
|
3
3
|
|
4
4
|
subject { described_class.new(data) }
|
5
5
|
|
6
|
-
it { is_expected.to be_kind_of ABBYY::Cloud::
|
6
|
+
it { is_expected.to be_kind_of ABBYY::Cloud::Model }
|
7
7
|
its(:to_h) { is_expected.to eq data }
|
8
8
|
|
9
9
|
context "with invalid id:" do
|
@@ -3,7 +3,7 @@ RSpec.describe ABBYY::Cloud::Models::UnitPrice do
|
|
3
3
|
|
4
4
|
subject { described_class.new(data) }
|
5
5
|
|
6
|
-
it { is_expected.to be_kind_of ABBYY::Cloud::
|
6
|
+
it { is_expected.to be_kind_of ABBYY::Cloud::Model }
|
7
7
|
its(:to_h) { is_expected.to eq data }
|
8
8
|
|
9
9
|
context "with invalid unit_type:" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abbyy-cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kozin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-initializer
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: '0.6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: '0.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: dry-
|
28
|
+
name: dry-types
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.0
|
33
|
+
version: 0.9.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.0
|
40
|
+
version: 0.9.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hashie
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -188,6 +188,7 @@ files:
|
|
188
188
|
- lib/abbyy/cloud/exceptions/argument_error.rb
|
189
189
|
- lib/abbyy/cloud/exceptions/response_error.rb
|
190
190
|
- lib/abbyy/cloud/exceptions/type_error.rb
|
191
|
+
- lib/abbyy/cloud/model.rb
|
191
192
|
- lib/abbyy/cloud/models/cost_type.rb
|
192
193
|
- lib/abbyy/cloud/models/currency.rb
|
193
194
|
- lib/abbyy/cloud/models/direction.rb
|
@@ -241,7 +242,6 @@ files:
|
|
241
242
|
- lib/abbyy/cloud/operations/translate_segments.rb
|
242
243
|
- lib/abbyy/cloud/operations/upload_file.rb
|
243
244
|
- lib/abbyy/cloud/settings.rb
|
244
|
-
- lib/abbyy/cloud/struct.rb
|
245
245
|
- lib/abbyy/cloud/types.rb
|
246
246
|
- spec/feature/abbyy/files_download_spec.rb
|
247
247
|
- spec/feature/abbyy/files_upload_spec.rb
|
data/lib/abbyy/cloud/struct.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
class ABBYY::Cloud::Struct < Dry::Struct
|
2
|
-
class << self
|
3
|
-
def new(data)
|
4
|
-
default = schema.keys.each_with_object({}) { |key, hash| hash[key] = nil }
|
5
|
-
actual = data.to_hash.each_with_object({}) do |(key, val), hash|
|
6
|
-
hash[key.to_sym] = val
|
7
|
-
end
|
8
|
-
|
9
|
-
super default.merge(actual)
|
10
|
-
end
|
11
|
-
alias_method :[], :new
|
12
|
-
end
|
13
|
-
end
|