mindee 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18fa830bcd060b512becc4d9b3f09a211a050bae76657d061a1052e834339785
4
- data.tar.gz: 61a42fa172220704e73a54e4c6579a05a5524a4cec7c7b4dc66cbd863bba5db6
3
+ metadata.gz: c0b76bde0354208269f645114e453b15ce48569ae3ce01fd194582f67a2ef6a4
4
+ data.tar.gz: 96a22bf367165b1c06d93bc90f91ef4c71f16781dd43cb954852ca0343e583df
5
5
  SHA512:
6
- metadata.gz: 5fc179ca03cf6104262a0dece7cd1ab1637c2491d851caf961136721fa762adbf2d480241e28a679ce76f589ba9c059332fc20525795479614f0fa0fd33765f9
7
- data.tar.gz: 9a51991288ae8478567fd1b0edd1967fe08ed5fcb66cf159ad3e64dbf66d9937013747612a5c9343a736d076c9c8c51d63e8bea74924340b54c6f5f705347337
6
+ metadata.gz: 00060a15fad08a14dccbde8d29a482ae54af57458e742893cf2ac2b61a66201e7dc098a92cee4c1b6a47877fc2b9db05a391bb50fb448b49aadeeb478ce03047
7
+ data.tar.gz: 81192f06c2e143162675eb1da1caf93481be8a483d8b1dd4dd6d0f6e0eb8869a27163404f260700d5d1e936bdc6523828f8279c820a424da0d96df4a77f467da
data/.gitignore CHANGED
@@ -1,6 +1,7 @@
1
1
  # IDE
2
2
  .vscode/
3
- .idea
3
+ .idea/
4
+ *.iml
4
5
 
5
6
  # Ruby
6
7
  *.gem
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "spec/data"]
2
+ path = spec/data
3
+ url = git@github.com:mindee/client-lib-test-data.git
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Mindee Ruby API Library Changelog
2
2
 
3
+ ## v1.2.0 - 2022-12-26
4
+ ### Changes
5
+ * :arrow_up: switch to origamindee => adds support for Ruby 3
6
+
7
+ ## v1.1.2 - 2022-12-23
8
+ ### Changes
9
+ * :recycle: use of `append_page` is better for adding pages to a new PDF
10
+
3
11
  ## v1.1.1 - 2022-08-08
4
12
  ### Fixes
5
13
  * :bug: Fix for missing attribute accessor
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,90 @@
1
+ # Contributing to mindee-api-ruby
2
+
3
+ :+1::tada: First off, thanks for taking the time to contribute! :tada::+1:
4
+
5
+ The following is a set of guidelines for contributing to mindee-api-ruby which are hosted on GitHub.
6
+ These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
7
+
8
+ ## Code of Conduct
9
+
10
+ This project and everyone participating in it is governed by the following [Code of Conduct](CODE_OF_CONDUCT.md).
11
+ By participating, you are expected to uphold this code.
12
+ Please report unacceptable behavior to [contact@mindee.com](mailto:contact@mindee.com).
13
+
14
+ ## How Can I Contribute
15
+
16
+ ### Reporting Bugs
17
+
18
+ Bugs are tracked as [GitHub issues](https://guides.github.com/features/issues/).
19
+
20
+ To help maintainers and the community to be efficient, follow these guidelines:
21
+
22
+ * **Use a clear and descriptive title** for the issue to identify the problem.
23
+ * **Describe the exact steps which reproduce the problem** in as many details as possible.
24
+ When listing steps, **don't just say what you did, but explain how you did it**.
25
+ For example, with canvas related problem, explain if you used the mouse or a keyboard shortcut, what kind of image input it is etc...
26
+ * **Provide specific examples to demonstrate the steps**.
27
+ Include links to files or GitHub projects, or copy/pasteable snippets, which you use in those examples.
28
+ If you're providing snippets in the issue, use [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines).
29
+ * **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior.
30
+ * **Explain which behavior you expected to see instead and why.**
31
+ * **If the problem wasn't triggered by a specific action**, describe what you were doing before the problem happened and share more information using the guidelines below.
32
+ * **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens.
33
+
34
+ > **Note:** If you find a **Closed** issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one.
35
+
36
+ Include details about your configuration and environment:
37
+
38
+ * **Which version of mindee-api-ruby are you using?**
39
+ * **What's the name and version of the browser you're using, on which OS**?
40
+
41
+ ### Suggesting Enhancements
42
+
43
+ Enhancement suggestions are tracked as [GitHub issues](https://guides.github.com/features/issues/).
44
+
45
+ Make sure to provide the following information:
46
+
47
+ * **Use a clear and descriptive title** for the issue to identify the suggestion.
48
+ * **Provide a step-by-step description of the suggested enhancement** in as many details as possible.
49
+ * **Provide specific examples to demonstrate the steps**. Include copy/pasteable snippets which you use in those examples, as [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines).
50
+ * **Describe the current behavior** and **explain which behavior you expected to see instead** and why.
51
+ * **Include screenshots and animated GIFs** which help you demonstrate the steps or point out the part of the sdk which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux.
52
+ * **Specify which version of mindee-api-ruby you're using.**
53
+ * **Specify the name and version of the browser and OS you're using.**
54
+
55
+ ### Pull Requests
56
+
57
+ The process described here has several goals:
58
+
59
+ - Maintain mindee SDK quality
60
+ - Fix problems that are important to users
61
+ - Engage the community in working toward the best possible SDK
62
+ - Enable a sustainable system for mindee's maintainers to review contributions
63
+
64
+ Please follow these steps to have your contribution considered by the maintainers:
65
+
66
+ 1. Follow all instructions in [the template](.github/PULL_REQUEST_TEMPLATE.md)
67
+ 2. Follow the [styleguides](#styleguides)
68
+
69
+ While the prerequisites above must be satisfied prior to having your pull request reviewed, the reviewer(s) may ask you to complete additional design work, tests, or other changes before your pull request can be ultimately accepted.
70
+
71
+ ## Styleguides
72
+
73
+ ### Git Commit Messages
74
+
75
+ * Use the present tense ("Add feature" not "Added feature")
76
+ * Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
77
+ * Limit the first line to 72 characters or less
78
+ * Reference issues and pull requests liberally after the first line
79
+ * Consider starting the commit message with an applicable emoji, see [gitmoji](https://gitmoji.carloscuesta.me/) as a reference.
80
+
81
+ Examples:
82
+
83
+ * :memo: Add usage section in README
84
+ * :sparkles: Add CONTRIBUTING file in repository
85
+ * :bug: MyComponent - Prevent MouseEvent from firing unexpectedly
86
+
87
+ ### Code Styleguide
88
+
89
+ We keep our code base consistent and expect Ruby code to adhere to our Rubocop styleguide,
90
+ see the `.rubocop` file.
data/Gemfile CHANGED
@@ -4,10 +4,3 @@ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in mindee.gemspec
6
6
  gemspec
7
-
8
- gem 'rake', '~> 12.0'
9
- gem 'rubocop', require: false
10
-
11
- group :test do
12
- gem 'rspec', '~> 3.10'
13
- end
data/README.md CHANGED
@@ -1,6 +1,14 @@
1
+ [![License: MIT](https://img.shields.io/github/license/mindee/mindee-api-ruby)](https://opensource.org/licenses/MIT)
2
+ [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/mindee/mindee-api-ruby/test.yml)](https://github.com/mindee/mindee-api-ruby)
3
+ [![Gem Version](https://img.shields.io/gem/v/mindee)](https://rubygems.org/gems/mindee)
4
+ [![Downloads](https://img.shields.io/gem/dt/mindee.svg)](https://rubygems.org/gems/mindee)
5
+
1
6
  # Mindee API Helper Library for Ruby
2
7
  Quickly and easily connect to Mindee's API services using Ruby.
3
8
 
9
+ ## Requirements
10
+ The following Ruby versions are tested and supported: 2.6, 2.7, 3.0, 3.1
11
+
4
12
  ## Quick Start
5
13
  Here's the TL;DR of getting started.
6
14
 
@@ -30,7 +38,8 @@ require 'mindee'
30
38
  mindee_client = Mindee::Client.new(api_key: 'my-api-key').config_invoice
31
39
 
32
40
  # Load a file from disk and parse it
33
- api_response = mindee_client.doc_from_path("/path/to/the/invoice.pdf").parse("invoice")
41
+ api_response = mindee_client.doc_from_path('/path/to/the/file.ext')
42
+ .parse('invoice')
34
43
 
35
44
  # Print a brief summary of the parsed data
36
45
  puts api_response.document
@@ -42,12 +51,13 @@ require 'mindee'
42
51
 
43
52
  # Init a new client and configure your custom document
44
53
  mindee_client = Mindee::Client.new(api_key: 'my-api-key').config_custom_doc(
45
- 'pokemon-card',
46
- 'pikachu'
54
+ 'john',
55
+ 'wnine'
47
56
  )
48
57
 
49
58
  # Load a file from disk and parse it
50
- api_response = mindee_client.doc_from_path("/path/to/the/card.jpg").parse("pokemon-card")
59
+ api_response = mindee_client.doc_from_path('/path/to/the/file.ext')
60
+ .parse('wnine')
51
61
 
52
62
  # Print a brief summary of the parsed data
53
63
  puts api_response.document
@@ -61,6 +71,6 @@ All the juicy details are described in the
61
71
  **[Official Documentation](https://developers.mindee.com/docs/ruby-getting-started)**.
62
72
 
63
73
  ## License
64
- Copyright © Mindee
74
+ Copyright © Mindee, SA
65
75
 
66
76
  Available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1,5 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/gem_tasks'
3
+ require 'rake'
4
4
 
5
- task default: spec
5
+ begin
6
+ require 'bundler/setup'
7
+ Bundler::GemHelper.install_tasks
8
+ rescue LoadError
9
+ puts 'although not required, bundler is recommended for running the tests'
10
+ end
11
+
12
+ task default: :spec
13
+
14
+ require 'rspec/core/rake_task'
15
+ RSpec::Core::RakeTask.new(:spec)
@@ -85,7 +85,7 @@ module Mindee
85
85
  company_registration = @company_registration.map(&:to_s).join('; ')
86
86
  taxes = @taxes.join("\n ")
87
87
  out_str = String.new
88
- out_str << '-----Invoice data-----'
88
+ out_str << '----- Invoice V3 -----'
89
89
  out_str << "\nFilename: #{@filename}".rstrip
90
90
  out_str << "\nInvoice number: #{@invoice_number}".rstrip
91
91
  out_str << "\nTotal amount including taxes: #{@total_incl}".rstrip
data/lib/mindee/inputs.rb CHANGED
@@ -98,8 +98,8 @@ module Mindee
98
98
  new_pdf = Origami::PDF.new
99
99
 
100
100
  to_insert = [current_pdf.pages[0], current_pdf.pages[-2], current_pdf.pages[-1]].take(max_pages)
101
- to_insert.each_with_index do |page, idx|
102
- new_pdf.insert_page(idx, page)
101
+ to_insert.each do |page|
102
+ new_pdf.append_page(page)
103
103
  end
104
104
  @io_stream = new_pdf.to_io_stream
105
105
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Mindee
4
4
  module Mindee
5
- VERSION = '1.1.1'
5
+ VERSION = '1.2.0'
6
6
 
7
7
  def self.find_platform
8
8
  host = RbConfig::CONFIG['host_os']
data/mindee.gemspec CHANGED
@@ -5,14 +5,13 @@ require_relative 'lib/mindee/version'
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'mindee'
7
7
  spec.version = Mindee::VERSION
8
- spec.authors = ['Mindee']
8
+ spec.authors = ['Mindee, SA']
9
9
  spec.email = ['devrel@mindee.co']
10
10
 
11
11
  spec.summary = 'Mindee API Helper Library for Ruby'
12
- # spec.description = %q{TODO: Write a longer description or delete this line.}
12
+ spec.description = "Quickly and easily connect to Mindee's API services using Ruby."
13
13
  spec.homepage = 'https://github.com/mindee/mindee-api-ruby'
14
14
  spec.license = 'MIT'
15
- spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
16
15
 
17
16
  spec.metadata['homepage_uri'] = 'https://mindee.com/'
18
17
  spec.metadata['source_code_uri'] = 'https://github.com/mindee/mindee-api-ruby'
@@ -28,7 +27,13 @@ Gem::Specification.new do |spec|
28
27
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
29
28
  spec.require_paths = ['lib']
30
29
 
30
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.6')
31
+
31
32
  spec.add_runtime_dependency 'marcel', '~> 1.0.2'
32
- spec.add_runtime_dependency 'mrz', '~> 0.2.0'
33
- spec.add_runtime_dependency 'origami', '~> 2.1.0'
33
+ spec.add_runtime_dependency 'mrz', '~> 0.2'
34
+ spec.add_runtime_dependency 'origamindee', '~> 3.0'
35
+
36
+ spec.add_development_dependency 'rake', '~> 12.3.1'
37
+ spec.add_development_dependency 'rspec', '~> 3.11'
38
+ spec.add_development_dependency 'rubocop', '~> 1.41'
34
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mindee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
- - Mindee
7
+ - Mindee, SA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-08 00:00:00.000000000 Z
11
+ date: 2022-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: marcel
@@ -30,29 +30,71 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.2.0
33
+ version: '0.2'
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.2.0
40
+ version: '0.2'
41
41
  - !ruby/object:Gem::Dependency
42
- name: origami
42
+ name: origamindee
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.1.0
47
+ version: '3.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 2.1.0
55
- description:
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 12.3.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 12.3.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.11'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.11'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.41'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.41'
97
+ description: Quickly and easily connect to Mindee's API services using Ruby.
56
98
  email:
57
99
  - devrel@mindee.co
58
100
  executables:
@@ -63,9 +105,11 @@ extra_rdoc_files: []
63
105
  files:
64
106
  - ".gitattributes"
65
107
  - ".gitignore"
108
+ - ".gitmodules"
66
109
  - ".rubocop.yml"
67
110
  - CHANGELOG.md
68
111
  - CODE_OF_CONDUCT.md
112
+ - CONTRIBUTING.md
69
113
  - Gemfile
70
114
  - LICENSE
71
115
  - README.md
@@ -114,14 +158,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
158
  requirements:
115
159
  - - ">="
116
160
  - !ruby/object:Gem::Version
117
- version: 2.6.0
161
+ version: '2.6'
118
162
  required_rubygems_version: !ruby/object:Gem::Requirement
119
163
  requirements:
120
164
  - - ">="
121
165
  - !ruby/object:Gem::Version
122
166
  version: '0'
123
167
  requirements: []
124
- rubygems_version: 3.1.2
168
+ rubygems_version: 3.1.6
125
169
  signing_key:
126
170
  specification_version: 4
127
171
  summary: Mindee API Helper Library for Ruby