omie-client 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/omie.rb +1 -0
- data/lib/omie/base_resource.rb +10 -1
- data/lib/omie/product.rb +5 -0
- data/lib/omie/tax_recommendation.rb +18 -0
- data/lib/omie/version.rb +1 -1
- 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: 11bf02b4f5144f73e78a0a7eeb9b1c6a49cce7420c46c303b51ad2a75d7eaa73
|
4
|
+
data.tar.gz: 8c34ec182dd11251e1db620b85622fa3face3eb9d2e9efef1b1ab69febe59a93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2186edbc7e24d8b8466e1a1a3474c9acd3b4c2cfcd1453e1694f92785ab64718520889ff08599047ef99a6de730ff0d973ed02be4554a69e72f092634ad5fdb
|
7
|
+
data.tar.gz: 70521bb00881096c46ee836f6806672d5b7cfa74868276365ac5c5243264309c94804c18623d880cb5a7fa8141748f4ed99235bf75f4468cc88f8aae9ee553d7
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
omie-client (0.1.
|
4
|
+
omie-client (0.1.6)
|
5
5
|
activesupport (>= 5.0)
|
6
6
|
rest-client (>= 2.0)
|
7
7
|
|
@@ -70,7 +70,7 @@ GEM
|
|
70
70
|
thread_safe (~> 0.1)
|
71
71
|
unf (0.1.4)
|
72
72
|
unf_ext
|
73
|
-
unf_ext (0.0.7.
|
73
|
+
unf_ext (0.0.7.7)
|
74
74
|
unicode-display_width (1.6.1)
|
75
75
|
|
76
76
|
PLATFORMS
|
data/lib/omie.rb
CHANGED
data/lib/omie/base_resource.rb
CHANGED
@@ -11,7 +11,15 @@ module Omie
|
|
11
11
|
# values
|
12
12
|
def initialize(args = {})
|
13
13
|
args.each do |key, value|
|
14
|
-
|
14
|
+
key_s = key.to_sym
|
15
|
+
has_internal_const = self.class.const_defined?('INTERNAL_MODELS')
|
16
|
+
if has_internal_const && self.class::INTERNAL_MODELS.key?(key_s)
|
17
|
+
klass = self.class::INTERNAL_MODELS[key_s]
|
18
|
+
instance = klass.new(value)
|
19
|
+
send("#{key}=", instance)
|
20
|
+
elsif respond_to?(key_s)
|
21
|
+
send("#{key}=", value)
|
22
|
+
end
|
15
23
|
end
|
16
24
|
end
|
17
25
|
|
@@ -28,6 +36,7 @@ module Omie
|
|
28
36
|
|
29
37
|
def self.request_and_initialize(uri, call, params)
|
30
38
|
response = request(uri, call, params)
|
39
|
+
|
31
40
|
new(response)
|
32
41
|
end
|
33
42
|
end
|
data/lib/omie/product.rb
CHANGED
@@ -20,11 +20,16 @@ module Omie
|
|
20
20
|
associate: 'AssociarCodIntProduto'
|
21
21
|
}.freeze
|
22
22
|
|
23
|
+
INTERNAL_MODELS = {
|
24
|
+
recomendacoes_fiscais: Omie::TaxRecommendation
|
25
|
+
}.freeze
|
26
|
+
|
23
27
|
URI = '/v1/geral/produtos/'
|
24
28
|
|
25
29
|
attr_accessor :ncm, :valor_unitario, :unidade, :descricao_status
|
26
30
|
attr_accessor :codigo_produto_integracao, :codigo_produto, :descricao
|
27
31
|
attr_accessor :codigo, :tipoItem # They do not keep the same name style =(
|
32
|
+
attr_accessor :recomendacoes_fiscais # {Omie::TaxRecommendation}
|
28
33
|
|
29
34
|
# Record a new product using the
|
30
35
|
# {https://app.omie.com.br/api/v1/geral/produtos/#IncluirProduto
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Omie
|
4
|
+
# This class abstracts tax recommendations related to the Product resource
|
5
|
+
# from Omie (Ref: Produto). It works as an embedded object inside Product
|
6
|
+
# payload. Take a look at this link for more details:
|
7
|
+
# {https://app.omie.com.br/api/v1/geral/produtos/}.
|
8
|
+
#
|
9
|
+
# Different from traditional resources that inherit from {Omie::BaseResource},
|
10
|
+
# internal objects does nothing but declares attributes that will comprise
|
11
|
+
# a higher level resource's payload. They usually does not have specific
|
12
|
+
# endpoints.
|
13
|
+
class TaxRecommendation < Omie::BaseResource
|
14
|
+
attr_accessor :origem_mercadoria, :id_preco_tabelado, :id_cest,
|
15
|
+
:cupom_fiscal, :market_place, :indicador_escala,
|
16
|
+
:cnpj_fabricante
|
17
|
+
end
|
18
|
+
end
|
data/lib/omie/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omie-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peerdustry
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- lib/omie/error.rb
|
148
148
|
- lib/omie/info.rb
|
149
149
|
- lib/omie/product.rb
|
150
|
+
- lib/omie/tax_recommendation.rb
|
150
151
|
- lib/omie/version.rb
|
151
152
|
- omie-client.gemspec
|
152
153
|
homepage: https://gitlab.com/peerdustry/floss/omie-client
|