invofox-api-ruby 0.1.1 → 0.1.2
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 +4 -4
- data/.rubocop_exclusions.yml +12 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/lib/invofox/base.rb +7 -9
- data/lib/invofox/collection.rb +7 -0
- data/lib/invofox/resource.rb +8 -1
- data/lib/invofox/resources/company.rb +15 -0
- data/lib/invofox/version.rb +1 -1
- data/lib/invofox.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eae8ebc082cdba1058d0753a39ff406d14dc0bec4f74434a2210db78287e2300
|
4
|
+
data.tar.gz: 6294b3ab459a7548702086d2cac5b1bdb0f53e71304d5b43e4de227a2cfd2c51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dea3aaf07d57a3a617c9cd468d0e6861d3f547cb6f369a2cf2ce0425a8d401e83924c960d395b79c5d7e1a5c2306a3df15a4b79d36d834dc14262a7e708fa590
|
7
|
+
data.tar.gz: 41300f3574b9bbaec5529ebcdcfe035aa71c60bbc32a5c749c2409763059049617f6ddf70e3acb6c9e4347fc5ae33d081d759ff8fbca9f1673f514a730511cf1
|
data/.rubocop_exclusions.yml
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2024-04-17 14:37:05 UTC using RuboCop version 1.36.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
Lint/MissingSuper:
|
11
|
+
Exclude:
|
12
|
+
- 'lib/invofox/collection.rb'
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -33,6 +33,7 @@ You can set a `logger` as well.
|
|
33
33
|
Changelog
|
34
34
|
---------
|
35
35
|
|
36
|
+
* v.0.1.2 Added support for companies' list endpoint.
|
36
37
|
* v.0.1.1 Added support for documents' update_type endpoint.
|
37
38
|
* 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.
|
38
39
|
|
data/lib/invofox/base.rb
CHANGED
@@ -56,18 +56,16 @@ module Invofox
|
|
56
56
|
# 2. If all went fine, we locate the body result
|
57
57
|
result_in_body = block.call(response_body)
|
58
58
|
|
59
|
-
# 3.
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
59
|
+
# 3. We build the resource result
|
60
|
+
result = if result_in_body.is_a?(Array)
|
61
|
+
Collection.new(result_in_body, clazz)
|
62
|
+
else
|
63
|
+
clazz.new(result_in_body)
|
64
|
+
end
|
65
65
|
|
66
66
|
# 4. And return everything together
|
67
67
|
Invofox::Response.new(
|
68
|
-
result: result
|
69
|
-
account: account,
|
70
|
-
environment: environment
|
68
|
+
result: result
|
71
69
|
)
|
72
70
|
end
|
73
71
|
|
data/lib/invofox/resource.rb
CHANGED
@@ -5,7 +5,14 @@ class Invofox::Resource
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def fields_information
|
8
|
-
|
8
|
+
# We add account and environment, which are common in all resources
|
9
|
+
self
|
10
|
+
.class
|
11
|
+
.fields_information
|
12
|
+
.merge(
|
13
|
+
account: :string,
|
14
|
+
environment: :string
|
15
|
+
)
|
9
16
|
end
|
10
17
|
|
11
18
|
private
|
@@ -7,6 +7,21 @@ class Invofox::Company < Invofox::Resource
|
|
7
7
|
data: :hash
|
8
8
|
|
9
9
|
class << self
|
10
|
+
# TODO allow not required fields; for now we just need this scenario at Quipu
|
11
|
+
def list(country_code:, tax_id:)
|
12
|
+
Invofox.api_call(
|
13
|
+
clazz: self,
|
14
|
+
method: :get,
|
15
|
+
path: "/companies",
|
16
|
+
params: {
|
17
|
+
countryCode: country_code,
|
18
|
+
taxId: tax_id
|
19
|
+
}
|
20
|
+
) do |response_body|
|
21
|
+
response_body['result']
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
10
25
|
def get(id:)
|
11
26
|
Invofox.api_call(
|
12
27
|
clazz: self,
|
data/lib/invofox/version.rb
CHANGED
data/lib/invofox.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: invofox-api-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Albert Bellonch
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- invofox.gemspec
|
143
143
|
- lib/invofox.rb
|
144
144
|
- lib/invofox/base.rb
|
145
|
+
- lib/invofox/collection.rb
|
145
146
|
- lib/invofox/configuration.rb
|
146
147
|
- lib/invofox/error.rb
|
147
148
|
- lib/invofox/resource.rb
|