invofox-api-ruby 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +44 -0
- data/.gitignore +1 -0
- data/.rspec +2 -0
- data/.rubocop.yml +45 -0
- data/.rubocop_exclusions.yml +0 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +87 -0
- data/README.md +42 -0
- data/Rakefile +8 -0
- data/invofox.gemspec +32 -0
- data/lib/invofox/base.rb +115 -0
- data/lib/invofox/configuration.rb +3 -0
- data/lib/invofox/error.rb +10 -0
- data/lib/invofox/resource.rb +55 -0
- data/lib/invofox/resources/company.rb +50 -0
- data/lib/invofox/resources/document.rb +67 -0
- data/lib/invofox/resources/load_batch.rb +22 -0
- data/lib/invofox/response.rb +9 -0
- data/lib/invofox/version.rb +3 -0
- data/lib/invofox.rb +10 -0
- metadata +175 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e69d4f366e946575f63b99e3e0a548a08e65e4cce642b817e6798da51b03171a
|
4
|
+
data.tar.gz: fdd5fb3ac989ef8d331a289bb230b832a630f88718d6277bdc67a55ce0353aa2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4fb6b9ab3f8dd738f536640138a40bfc147c6c6b33a3e337cad74907e53c70b4bfaf097774c41ea596da99768d9f5c53ecb7778a19cb92540821f5b2ca0fb93c
|
7
|
+
data.tar.gz: ca395634f1ac51266410fc959944e1b90cc8ba58a3aafaf4f7dd95a9399a65d02f7deca9fa7e6d99b67ed7187043e2fefbcecf23f3c2e8a7019d7a1cb527f754
|
@@ -0,0 +1,44 @@
|
|
1
|
+
version: 2.1
|
2
|
+
|
3
|
+
executors:
|
4
|
+
gem-executor:
|
5
|
+
working_directory: ~/tmp/gem
|
6
|
+
docker:
|
7
|
+
- image: cimg/ruby:3.0.6
|
8
|
+
environment:
|
9
|
+
TZ: "Europe/Madrid"
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
build-test-gem:
|
13
|
+
executor: gem-executor
|
14
|
+
steps:
|
15
|
+
- checkout
|
16
|
+
|
17
|
+
- run:
|
18
|
+
name: Update bundler
|
19
|
+
command: gem install bundler -v 2.2.25
|
20
|
+
|
21
|
+
- restore_cache:
|
22
|
+
keys:
|
23
|
+
- invofox-api-ruby-bundle-v2-{{ checksum "Gemfile.lock" }}
|
24
|
+
- invofox-api-ruby-bundle-v2-
|
25
|
+
|
26
|
+
- run: bundle install
|
27
|
+
|
28
|
+
- save_cache:
|
29
|
+
key: invofox-api-ruby-bundle-v2-{{ checksum "Gemfile.lock" }}
|
30
|
+
paths:
|
31
|
+
- vendor/bundle
|
32
|
+
|
33
|
+
- run:
|
34
|
+
name: Run rspec
|
35
|
+
command: bundle exec rspec spec/
|
36
|
+
|
37
|
+
- run:
|
38
|
+
name: Run Rubocop
|
39
|
+
command: bundle exec rubocop
|
40
|
+
|
41
|
+
workflows:
|
42
|
+
build-test-gem:
|
43
|
+
jobs:
|
44
|
+
- build-test-gem
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
pkg/*
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
inherit_from: .rubocop_exclusions.yml
|
2
|
+
|
3
|
+
# General configuration
|
4
|
+
AllCops:
|
5
|
+
DisabledByDefault: true
|
6
|
+
Include:
|
7
|
+
- 'lib/**/*.rb'
|
8
|
+
- 'spec/**/*.rb'
|
9
|
+
NewCops: enable
|
10
|
+
SuggestExtensions: false
|
11
|
+
TargetRubyVersion: 3.0.6
|
12
|
+
|
13
|
+
# Explicit configuration
|
14
|
+
Bundler:
|
15
|
+
Enabled: true
|
16
|
+
|
17
|
+
Lint:
|
18
|
+
Enabled: true
|
19
|
+
|
20
|
+
Layout:
|
21
|
+
Enabled: true
|
22
|
+
|
23
|
+
Layout/BlockAlignment:
|
24
|
+
EnforcedStyleAlignWith: start_of_block
|
25
|
+
|
26
|
+
Layout/HashAlignment:
|
27
|
+
AllowMultipleStyles: true
|
28
|
+
EnforcedHashRocketStyle: table
|
29
|
+
EnforcedColonStyle: table
|
30
|
+
|
31
|
+
Layout/MultilineMethodCallIndentation:
|
32
|
+
Enabled: true
|
33
|
+
EnforcedStyle: indented_relative_to_receiver
|
34
|
+
|
35
|
+
Security:
|
36
|
+
Enabled: true
|
37
|
+
|
38
|
+
Style/CollectionMethods:
|
39
|
+
Enabled: true
|
40
|
+
PreferredMethods:
|
41
|
+
inject: "inject"
|
42
|
+
collect: "map"
|
43
|
+
|
44
|
+
Style/Documentation:
|
45
|
+
Enabled: false
|
File without changes
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.6-jemalloc
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
invofox-api-ruby (0.1.0)
|
5
|
+
rest-client (~> 2.0.2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.8.0)
|
11
|
+
public_suffix (>= 2.0.2, < 5.0)
|
12
|
+
ast (2.4.2)
|
13
|
+
crack (0.4.3)
|
14
|
+
safe_yaml (~> 1.0.0)
|
15
|
+
diff-lcs (1.3)
|
16
|
+
domain_name (0.6.20240107)
|
17
|
+
hashdiff (1.0.0)
|
18
|
+
http-cookie (1.0.5)
|
19
|
+
domain_name (~> 0.5)
|
20
|
+
json (2.6.2)
|
21
|
+
mime-types (3.5.2)
|
22
|
+
mime-types-data (~> 3.2015)
|
23
|
+
mime-types-data (3.2024.0206)
|
24
|
+
netrc (0.11.0)
|
25
|
+
parallel (1.22.1)
|
26
|
+
parser (3.1.2.1)
|
27
|
+
ast (~> 2.4.1)
|
28
|
+
public_suffix (4.0.6)
|
29
|
+
rainbow (3.1.1)
|
30
|
+
rake (13.0.1)
|
31
|
+
regexp_parser (2.6.0)
|
32
|
+
rest-client (2.0.2)
|
33
|
+
http-cookie (>= 1.0.2, < 2.0)
|
34
|
+
mime-types (>= 1.16, < 4.0)
|
35
|
+
netrc (~> 0.8)
|
36
|
+
rexml (3.2.5)
|
37
|
+
rspec (3.9.0)
|
38
|
+
rspec-core (~> 3.9.0)
|
39
|
+
rspec-expectations (~> 3.9.0)
|
40
|
+
rspec-mocks (~> 3.9.0)
|
41
|
+
rspec-core (3.9.0)
|
42
|
+
rspec-support (~> 3.9.0)
|
43
|
+
rspec-expectations (3.9.0)
|
44
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
+
rspec-support (~> 3.9.0)
|
46
|
+
rspec-mocks (3.9.0)
|
47
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
+
rspec-support (~> 3.9.0)
|
49
|
+
rspec-support (3.9.0)
|
50
|
+
rubocop (1.36.0)
|
51
|
+
json (~> 2.3)
|
52
|
+
parallel (~> 1.10)
|
53
|
+
parser (>= 3.1.2.1)
|
54
|
+
rainbow (>= 2.2.2, < 4.0)
|
55
|
+
regexp_parser (>= 1.8, < 3.0)
|
56
|
+
rexml (>= 3.2.5, < 4.0)
|
57
|
+
rubocop-ast (>= 1.20.1, < 2.0)
|
58
|
+
ruby-progressbar (~> 1.7)
|
59
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
60
|
+
rubocop-ast (1.21.0)
|
61
|
+
parser (>= 3.1.1.0)
|
62
|
+
rubocop-rspec (2.13.2)
|
63
|
+
rubocop (~> 1.33)
|
64
|
+
ruby-progressbar (1.11.0)
|
65
|
+
safe_yaml (1.0.5)
|
66
|
+
timecop (0.9.1)
|
67
|
+
unicode-display_width (2.3.0)
|
68
|
+
webmock (3.7.6)
|
69
|
+
addressable (>= 2.3.6)
|
70
|
+
crack (>= 0.3.2)
|
71
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
72
|
+
|
73
|
+
PLATFORMS
|
74
|
+
ruby
|
75
|
+
|
76
|
+
DEPENDENCIES
|
77
|
+
bundler
|
78
|
+
invofox-api-ruby!
|
79
|
+
rake
|
80
|
+
rspec
|
81
|
+
rubocop
|
82
|
+
rubocop-rspec
|
83
|
+
timecop
|
84
|
+
webmock
|
85
|
+
|
86
|
+
BUNDLED WITH
|
87
|
+
2.2.20
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Ruby client for Invofox API
|
2
|
+
|
3
|
+
[![CircleCI](https://circleci.com/gh/quipuapp/invofox-api-ruby.svg?style=shield)](https://circleci.com/gh/quipuapp/invofox-api-ruby)
|
4
|
+
|
5
|
+
This is a Ruby client for the Invofox' API
|
6
|
+
|
7
|
+
Installation
|
8
|
+
---------
|
9
|
+
|
10
|
+
Install the gem (`gem install invofox-api-ruby`) or include it in your Gemfile and `bundle`.
|
11
|
+
|
12
|
+
Configuration
|
13
|
+
---------
|
14
|
+
|
15
|
+
Just set the API key by doing this:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
Invofox.api_key = 'your-api-key'
|
19
|
+
```
|
20
|
+
|
21
|
+
Or, if you use it in a Rails application, create an initializer with this content:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require 'invofox'
|
25
|
+
|
26
|
+
Invofox.configure do |config|
|
27
|
+
config.api_key = 'your-api-key'
|
28
|
+
end
|
29
|
+
```
|
30
|
+
|
31
|
+
You can set a `logger` as well.
|
32
|
+
|
33
|
+
Changelog
|
34
|
+
---------
|
35
|
+
|
36
|
+
* v.0.1.0 First vull version, including resource wrapping for companies (get, create and update), documents (get, bulk and update) and load batches (get), plus logger integration.
|
37
|
+
|
38
|
+
About Invofox
|
39
|
+
------------
|
40
|
+
|
41
|
+
* [Public site](https://invofox.com)
|
42
|
+
* [Documentation](https://developers.invofox.com)
|
data/Rakefile
ADDED
data/invofox.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'invofox/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "invofox-api-ruby"
|
9
|
+
spec.version = Invofox::VERSION
|
10
|
+
spec.authors = ["Albert Bellonch"]
|
11
|
+
spec.email = ["albert@getquipu.com"]
|
12
|
+
|
13
|
+
spec.summary = "Ruby client for the Invofox' API"
|
14
|
+
spec.homepage = "https://getquipu.com"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_dependency "rest-client", "~> 2.0.2"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "rspec"
|
28
|
+
spec.add_development_dependency "rubocop"
|
29
|
+
spec.add_development_dependency 'rubocop-rspec'
|
30
|
+
spec.add_development_dependency "timecop"
|
31
|
+
spec.add_development_dependency "webmock"
|
32
|
+
end
|
data/lib/invofox/base.rb
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Invofox
|
5
|
+
class << self
|
6
|
+
def configuration
|
7
|
+
@configuration ||= Configuration.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def configure
|
11
|
+
yield(configuration)
|
12
|
+
end
|
13
|
+
|
14
|
+
def api_call(clazz:, method:, path:, params: {}, &block)
|
15
|
+
# Prepare the URL
|
16
|
+
url = 'https://api.invofox.com' + path
|
17
|
+
|
18
|
+
# Prepare headers & params
|
19
|
+
request_headers = {
|
20
|
+
accept: 'application/json',
|
21
|
+
"x-api-key" => Invofox.configuration.api_key
|
22
|
+
}
|
23
|
+
|
24
|
+
request_params = {
|
25
|
+
headers: request_headers,
|
26
|
+
method: method,
|
27
|
+
url: url,
|
28
|
+
}
|
29
|
+
|
30
|
+
if method == :post || method == :put
|
31
|
+
request_params[:payload] = params
|
32
|
+
else
|
33
|
+
request_headers[:params] = params
|
34
|
+
end
|
35
|
+
|
36
|
+
# Do the request
|
37
|
+
response = begin
|
38
|
+
RestClient::Request.execute(request_params)
|
39
|
+
rescue RestClient::BadRequest, RestClient::ExpectationFailed => bad_request
|
40
|
+
bad_request.response
|
41
|
+
end
|
42
|
+
|
43
|
+
# Log it
|
44
|
+
log_request(
|
45
|
+
method: method,
|
46
|
+
url: url,
|
47
|
+
params: params
|
48
|
+
)
|
49
|
+
|
50
|
+
# Deal with the response
|
51
|
+
response_body = JSON.parse(response.body)
|
52
|
+
|
53
|
+
# 1. First, we treat errors if any
|
54
|
+
treat_errors_if_any(response_body: response_body)
|
55
|
+
|
56
|
+
# 2. If all went fine, we locate the body result
|
57
|
+
result_in_body = block.call(response_body)
|
58
|
+
|
59
|
+
# 3. Then we extract account and environment
|
60
|
+
account = result_in_body.delete("account")
|
61
|
+
environment = result_in_body.delete("environment")
|
62
|
+
|
63
|
+
# 4. We build the resource result
|
64
|
+
result = clazz.new(result_in_body)
|
65
|
+
|
66
|
+
# 4. And return everything together
|
67
|
+
Invofox::Response.new(
|
68
|
+
result: result,
|
69
|
+
account: account,
|
70
|
+
environment: environment
|
71
|
+
)
|
72
|
+
end
|
73
|
+
|
74
|
+
def log_request(method:, url:, params: {})
|
75
|
+
logger = Invofox.configuration.logger
|
76
|
+
return if logger.nil?
|
77
|
+
|
78
|
+
now = Time.now
|
79
|
+
|
80
|
+
safe_params = {}
|
81
|
+
params.each do |key, value|
|
82
|
+
safe_value = value
|
83
|
+
|
84
|
+
if safe_value.is_a?(Symbol)
|
85
|
+
safe_value = safe_value.to_s
|
86
|
+
end
|
87
|
+
|
88
|
+
safe_params[key] = safe_value
|
89
|
+
end
|
90
|
+
|
91
|
+
logger.info(
|
92
|
+
message: 'Invofox request',
|
93
|
+
method: method.upcase.to_s,
|
94
|
+
url: url,
|
95
|
+
time: now.to_s,
|
96
|
+
timestamp: now.to_i,
|
97
|
+
params: safe_params
|
98
|
+
)
|
99
|
+
end
|
100
|
+
|
101
|
+
private
|
102
|
+
|
103
|
+
def treat_errors_if_any(response_body:)
|
104
|
+
code = response_body['code']
|
105
|
+
return if code.nil?
|
106
|
+
|
107
|
+
additional_info = response_body['additionalInfo']
|
108
|
+
|
109
|
+
raise Invofox::Error.new(
|
110
|
+
code: code,
|
111
|
+
additional_info: additional_info
|
112
|
+
)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
class Invofox::Resource
|
2
|
+
def initialize(data)
|
3
|
+
generate_attr_readers
|
4
|
+
set_data(data)
|
5
|
+
end
|
6
|
+
|
7
|
+
def fields_information
|
8
|
+
self.class.fields_information
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def generate_attr_readers
|
14
|
+
fields_information.each do |field, _|
|
15
|
+
define_singleton_method(field) do
|
16
|
+
instance_variable_get("@#{field}")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def set_data(data)
|
22
|
+
fields_information.each do |field, type|
|
23
|
+
next unless data.key?(field.to_s) || data[field.to_sym]
|
24
|
+
|
25
|
+
raw_value = data[field.to_s] || data[field.to_sym]
|
26
|
+
value = value_for(raw_value, type)
|
27
|
+
instance_variable_set("@#{field}", value)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def value_for(raw_value, type)
|
32
|
+
case type
|
33
|
+
when :boolean
|
34
|
+
[true, "1", 1].include?(raw_value)
|
35
|
+
when :time
|
36
|
+
if raw_value.is_a?(Time)
|
37
|
+
raw_value
|
38
|
+
else
|
39
|
+
Time.parse(raw_value)
|
40
|
+
end
|
41
|
+
else
|
42
|
+
raw_value
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class << self
|
47
|
+
def fields_information
|
48
|
+
@fields_information
|
49
|
+
end
|
50
|
+
|
51
|
+
def has_fields(fields_information)
|
52
|
+
@fields_information = fields_information.merge("_id" => :string)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
class Invofox::Company < Invofox::Resource
|
2
|
+
has_fields name: :string,
|
3
|
+
countryCode: :string,
|
4
|
+
taxId: :string,
|
5
|
+
creator: :string,
|
6
|
+
creation: :time,
|
7
|
+
data: :hash
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def get(id:)
|
11
|
+
Invofox.api_call(
|
12
|
+
clazz: self,
|
13
|
+
method: :get,
|
14
|
+
path: "/companies/#{id}"
|
15
|
+
) do |response_body|
|
16
|
+
response_body['result']
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def create(country_code:, tax_id:, name:)
|
21
|
+
Invofox.api_call(
|
22
|
+
clazz: self,
|
23
|
+
method: :post,
|
24
|
+
path: "/companies",
|
25
|
+
params: {
|
26
|
+
countryCode: country_code,
|
27
|
+
taxId: tax_id,
|
28
|
+
name: name
|
29
|
+
}
|
30
|
+
) do |response_body|
|
31
|
+
response_body['result']
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def update(id:, country_code:, tax_id:, name:)
|
36
|
+
Invofox.api_call(
|
37
|
+
clazz: self,
|
38
|
+
method: :put,
|
39
|
+
path: "/companies/#{id}",
|
40
|
+
params: {
|
41
|
+
countryCode: country_code,
|
42
|
+
taxId: tax_id,
|
43
|
+
name: name
|
44
|
+
}
|
45
|
+
) do |response_body|
|
46
|
+
response_body['result']
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
class Invofox::Document < Invofox::Resource
|
2
|
+
has_fields company: :string,
|
3
|
+
creator: :string,
|
4
|
+
creation: :time,
|
5
|
+
name: :string,
|
6
|
+
type: :string,
|
7
|
+
clientData: :hash,
|
8
|
+
images: :array,
|
9
|
+
original: :string,
|
10
|
+
mimetype: :string,
|
11
|
+
data: :hash,
|
12
|
+
publicState: :string,
|
13
|
+
confidence: :high,
|
14
|
+
validationInfo: :hash,
|
15
|
+
approvalInfo: :hash,
|
16
|
+
approvedBy: :array,
|
17
|
+
requiredSigns: :array,
|
18
|
+
import: :hash,
|
19
|
+
exports: :array,
|
20
|
+
archived: :boolean,
|
21
|
+
geometry: :hash,
|
22
|
+
skippedBy: :array
|
23
|
+
|
24
|
+
class << self
|
25
|
+
def get(id:)
|
26
|
+
Invofox.api_call(
|
27
|
+
clazz: self,
|
28
|
+
method: :get,
|
29
|
+
path: "/documents/#{id}"
|
30
|
+
) do |response_body|
|
31
|
+
response_body['result']
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def bulk(company_id:, url:)
|
36
|
+
Invofox.api_call(
|
37
|
+
clazz: Invofox::LoadBatch,
|
38
|
+
method: :post,
|
39
|
+
path: '/documents/bulk',
|
40
|
+
params: {
|
41
|
+
company: company_id,
|
42
|
+
urls: url,
|
43
|
+
closeBatch: true,
|
44
|
+
useClassifier: true
|
45
|
+
}
|
46
|
+
) do |response_body|
|
47
|
+
response_body['result']['loadBatch']
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def update(id:, data: nil, publicState: nil)
|
52
|
+
payload = {
|
53
|
+
data: data,
|
54
|
+
publicState: publicState
|
55
|
+
}.compact
|
56
|
+
|
57
|
+
Invofox.api_call(
|
58
|
+
clazz: self,
|
59
|
+
method: :put,
|
60
|
+
path: "/documents/#{id}",
|
61
|
+
params: payload
|
62
|
+
) do |response_body|
|
63
|
+
response_body['result']
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class Invofox::LoadBatch < Invofox::Resource
|
2
|
+
has_fields company: :string,
|
3
|
+
creator: :string,
|
4
|
+
creation: :time,
|
5
|
+
lastLoad: :time,
|
6
|
+
end: :time,
|
7
|
+
documents: :array,
|
8
|
+
info: :hash,
|
9
|
+
state: :string
|
10
|
+
|
11
|
+
class << self
|
12
|
+
def get(id:)
|
13
|
+
Invofox.api_call(
|
14
|
+
clazz: self,
|
15
|
+
method: :get,
|
16
|
+
path: "/loadBatches/#{id}"
|
17
|
+
) do |response_body|
|
18
|
+
response_body['result']
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/invofox.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'invofox/version'
|
2
|
+
require 'invofox/configuration'
|
3
|
+
require 'invofox/base'
|
4
|
+
require 'invofox/error'
|
5
|
+
require 'invofox/resource'
|
6
|
+
require 'invofox/response'
|
7
|
+
|
8
|
+
require 'invofox/resources/company'
|
9
|
+
require 'invofox/resources/document'
|
10
|
+
require 'invofox/resources/load_batch'
|
metadata
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: invofox-api-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Albert Bellonch
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-03-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest-client
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.0.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: timecop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: webmock
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description:
|
126
|
+
email:
|
127
|
+
- albert@getquipu.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".circleci/config.yml"
|
133
|
+
- ".gitignore"
|
134
|
+
- ".rspec"
|
135
|
+
- ".rubocop.yml"
|
136
|
+
- ".rubocop_exclusions.yml"
|
137
|
+
- ".ruby-version"
|
138
|
+
- Gemfile
|
139
|
+
- Gemfile.lock
|
140
|
+
- README.md
|
141
|
+
- Rakefile
|
142
|
+
- invofox.gemspec
|
143
|
+
- lib/invofox.rb
|
144
|
+
- lib/invofox/base.rb
|
145
|
+
- lib/invofox/configuration.rb
|
146
|
+
- lib/invofox/error.rb
|
147
|
+
- lib/invofox/resource.rb
|
148
|
+
- lib/invofox/resources/company.rb
|
149
|
+
- lib/invofox/resources/document.rb
|
150
|
+
- lib/invofox/resources/load_batch.rb
|
151
|
+
- lib/invofox/response.rb
|
152
|
+
- lib/invofox/version.rb
|
153
|
+
homepage: https://getquipu.com
|
154
|
+
licenses: []
|
155
|
+
metadata: {}
|
156
|
+
post_install_message:
|
157
|
+
rdoc_options: []
|
158
|
+
require_paths:
|
159
|
+
- lib
|
160
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
requirements: []
|
171
|
+
rubygems_version: 3.4.12
|
172
|
+
signing_key:
|
173
|
+
specification_version: 4
|
174
|
+
summary: Ruby client for the Invofox' API
|
175
|
+
test_files: []
|