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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93709fdff9221e8360fe0c77374ff883659d5e158fc8bfa1353dad9c961470f9
4
- data.tar.gz: bf3d5191c9d1479515d665a1b36ec1e1fb420cb0f6d9823946129c475b2190de
3
+ metadata.gz: 11bf02b4f5144f73e78a0a7eeb9b1c6a49cce7420c46c303b51ad2a75d7eaa73
4
+ data.tar.gz: 8c34ec182dd11251e1db620b85622fa3face3eb9d2e9efef1b1ab69febe59a93
5
5
  SHA512:
6
- metadata.gz: f672cb89d67a4587c0bb42ea780627f28669e45bc4b92d0b0159ead56e8965e557f7a3b473c59980fcd451a8d6229d068bb2fa9b780c62bb693c357e8ba7d1f2
7
- data.tar.gz: e0a1dd775e8897a5f1c1c192e1e748315a23b8942ae05de01654c47b1fa31d77090aceb33ba8ea14399ebe5c8c12019b24aaa21b788986e3a975bb2de11f1fd2
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)
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.6)
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
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative 'omie/base_resource'
4
4
  require_relative 'omie/company'
5
+ require_relative 'omie/tax_recommendation'
5
6
  require_relative 'omie/product'
6
7
  require_relative 'omie/connection'
7
8
  require_relative 'omie/error'
@@ -11,7 +11,15 @@ module Omie
11
11
  # values
12
12
  def initialize(args = {})
13
13
  args.each do |key, value|
14
- send("#{key}=", value) if respond_to?(key)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Omie
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.6'
5
5
  end
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.5
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-03-24 00:00:00.000000000 Z
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