Skip to content

Commit 38a0650

Browse files
sebastianMindeeianardee
authored andcommitted
🎨 move loose modules to a better spot (#41)
1 parent baaf1ef commit 38a0650

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

docs/code_samples/invoice_splitter_v1_async.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def get_doc_from_async_queue(
4848
parsed_result = mindee_client.parse_queued(queue_id, doc_class)
4949

5050
# Check whether the result is ready
51-
if parsed_result.job.status == Mindee::JobStatus::COMPLETED
51+
if parsed_result.job.status == Mindee::Parsing::Common::JobStatus::COMPLETED
5252
# Print a brief summary of the parsed data
5353
puts parsed_result.document
5454
return

lib/mindee.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
require 'mindee/client'
44

55
module Mindee
6-
class HttpError < StandardError
6+
module HTTP
7+
class HttpError < StandardError
8+
end
79
end
810
end

lib/mindee/parsing/common/api_response.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
require 'time'
55

66
module Mindee
7-
module JobStatus
8-
WAITING = :waiting
9-
PROCESSING = :processing
10-
COMPLETED = :completed
11-
end
12-
13-
module RequestStatus
14-
FAILURE = :failure
15-
SUCCESS = :success
16-
end
17-
187
module Parsing
198
module Common
9+
module JobStatus
10+
WAITING = :waiting
11+
PROCESSING = :processing
12+
COMPLETED = :completed
13+
end
14+
15+
module RequestStatus
16+
FAILURE = :failure
17+
SUCCESS = :success
18+
end
19+
2020
# Job (queue) information on async parsing.
2121
class Job
2222
# @return [String] Mindee ID of the document

spec/async_rseponse_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
response = load_json(DIR_ASYNC, 'post_success.json')
1212
parsed_response = Mindee::Parsing::Common::ApiResponse.new(Mindee::Product::InvoiceSplitter::InvoiceSplitterV1,
1313
response)
14-
expect(parsed_response.job.status).to eq(Mindee::JobStatus::WAITING)
14+
expect(parsed_response.job.status).to eq(Mindee::Parsing::Common::JobStatus::WAITING)
1515
expect(parsed_response.job.id).to eq('76c90710-3a1b-4b91-8a39-31a6543e347c')
1616
expect(parsed_response.job.status).to_not respond_to(:available_at)
1717
expect(parsed_response.job.status).to_not respond_to(:millisecs_taken)
@@ -26,7 +26,7 @@
2626
expect(parsed_response.job.id).to be(nil)
2727
expect(parsed_response.job.status).to_not respond_to(:available_at)
2828
expect(parsed_response.job.status).to_not respond_to(:millisecs_taken)
29-
expect(parsed_response.api_request.status).to eq(Mindee::RequestStatus::FAILURE)
29+
expect(parsed_response.api_request.status).to eq(Mindee::Parsing::Common::RequestStatus::FAILURE)
3030
expect(parsed_response.api_request.error['code']).to eq('Forbidden')
3131
end
3232

@@ -35,7 +35,7 @@
3535
parsed_response = Mindee::Parsing::Common::ApiResponse.new(Mindee::Product::InvoiceSplitter::InvoiceSplitterV1,
3636
response)
3737
expect(parsed_response.job.issued_at.strftime('%Y-%m-%dT%H:%M:%S.%6N')).to eq('2023-03-16T12:33:49.602947')
38-
expect(parsed_response.job.status).to eq(Mindee::JobStatus::PROCESSING)
38+
expect(parsed_response.job.status).to eq(Mindee::Parsing::Common::JobStatus::PROCESSING)
3939
expect(parsed_response.job.id).to eq('76c90710-3a1b-4b91-8a39-31a6543e347c')
4040
expect(parsed_response.job.status).to_not respond_to(:available_at)
4141
expect(parsed_response.job.status).to_not respond_to(:millisecs_taken)
@@ -47,7 +47,7 @@
4747
parsed_response = Mindee::Parsing::Common::ApiResponse.new(Mindee::Product::InvoiceSplitter::InvoiceSplitterV1,
4848
response)
4949
expect(parsed_response.job.issued_at.strftime('%Y-%m-%dT%H:%M:%S.%6N')).to eq('2023-03-21T13:52:56.326107')
50-
expect(parsed_response.job.status).to eq(Mindee::JobStatus::COMPLETED)
50+
expect(parsed_response.job.status).to eq(Mindee::Parsing::Common::JobStatus::COMPLETED)
5151
expect(parsed_response.job.id).to eq('b6caf9e8-9bcc-4412-bcb7-f5b416678f0d')
5252
expect(parsed_response.job.available_at.strftime('%Y-%m-%dT%H:%M:%S.%6N')).to eq('2023-03-21T13:53:00.990339')
5353
expect(parsed_response.job.millisecs_taken).to eq(4664)

0 commit comments

Comments
 (0)