sigiss 0.1.0 → 0.1.1
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/.travis.yml +5 -2
- data/README.md +112 -15
- data/bin/console +4 -4
- data/lib/sigiss/gateway.rb +17 -4
- data/lib/sigiss/ibge.rb +1 -0
- data/lib/sigiss/invoice.rb +4 -11
- data/lib/sigiss/invoice_data/cancel_data.rb +2 -5
- data/lib/sigiss/invoice_data/fetch_data.rb +2 -9
- data/lib/sigiss/invoice_data/invoice_data.rb +2 -2
- data/lib/sigiss/invoice_data/issue_data.rb +1 -4
- data/lib/sigiss/provider.rb +2 -5
- data/lib/sigiss/taker.rb +10 -10
- data/lib/sigiss/version.rb +1 -1
- data/sigiss.gemspec +3 -1
- metadata +33 -6
- data/sigiss.txt +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: acd989e2d61471742743e41de43c18c778bb4987
|
4
|
+
data.tar.gz: f3115a0132707911b1ca26bef9aadef5832a6499
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 884512b737b5a73bdd069a9ec0b6fd193a99cc9d2e9d25304ea9551ad82649de96b5687dbad6597a872c8ea2d6f5a2c6b6b4a13eb22c76f5ff4b6a456cd83432
|
7
|
+
data.tar.gz: 8a8fdcd7ce38190e4eb29e863adca1d32e8025eda1b0a1c724299217c476162aa987b00935c69360a6aa2ac70b0b39b4f228ea2001c5b431c3fd572acb5e66a5
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,41 +1,138 @@
|
|
1
1
|
# Sigiss
|
2
2
|
|
3
|
-
|
3
|
+
[](https://travis-ci.org/gabrielpedepera/sigiss) [](https://codeclimate.com/github/gabrielpedepera/sigiss) [](https://codeclimate.com/github/gabrielpedepera/sigiss/coverage)
|
4
4
|
|
5
|
-
|
5
|
+
Ruby gem para integração com o WebService para NFS-e do SIGISS.
|
6
6
|
|
7
|
-
|
7
|
+
Atualmente suportando as seguintes cidades:
|
8
8
|
|
9
|
-
|
9
|
+
- Bauru - SP
|
10
|
+
- Botucatu - SP
|
11
|
+
- Marília - SP
|
12
|
+
- Londrina - SP
|
13
|
+
- Rio Grande - RS
|
14
|
+
|
15
|
+
Obs.: A gem foi desenvolvida baseada no WebService de [Marília-SP](https://marilia.sigiss.com.br/marilia/ws/sigiss_ws.php) e [Manual]( http://www.bauru.sp.gov.br/arquivos/arquivos_site/sec_financas/nfse_manual_webservice.pdf).
|
16
|
+
Caso exista divergências na integrações com outras cidades ou a gem contemple outras para integração,
|
17
|
+
seu PR ou sua informação será muito bem vinda para atualização.
|
18
|
+
|
19
|
+
## Instalação
|
20
|
+
|
21
|
+
Adicionar ao Gemfile:
|
10
22
|
|
11
23
|
```ruby
|
12
24
|
gem 'sigiss'
|
13
25
|
```
|
14
26
|
|
15
|
-
|
27
|
+
Executar:
|
16
28
|
|
17
29
|
$ bundle
|
18
30
|
|
19
|
-
|
31
|
+
Ou instalar como:
|
20
32
|
|
21
33
|
$ gem install sigiss
|
22
34
|
|
23
|
-
##
|
35
|
+
## Uso
|
36
|
+
|
37
|
+
#### Definir a cidade (gateway) para emissão da Nota Fiscal:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
gateway = Sigiss::Gateway.new(:marilia, :test) # Ambiente de teste
|
41
|
+
gateway = Sigiss::Gateway.new(:marilia, :production) # Ambiente de Produção
|
42
|
+
```
|
43
|
+
|
44
|
+
#### Definir os dados referente ao prestador:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
params = {
|
48
|
+
ccm: '31000',
|
49
|
+
cnpj: '90082563000169',
|
50
|
+
senha: '12345',
|
51
|
+
crc: '',
|
52
|
+
crc_estado: ''
|
53
|
+
}
|
54
|
+
```
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
provider = Sigiss::Provider.new(params)
|
58
|
+
```
|
59
|
+
|
60
|
+
#### Definir os dados referente ao tomador:
|
24
61
|
|
25
|
-
|
62
|
+
```ruby
|
63
|
+
params = {
|
64
|
+
tomador_tipo: '2',
|
65
|
+
tomador_cnpj: '08600061822',
|
66
|
+
tomador_email: 'email@tomador.com',
|
67
|
+
tomador_im: '',
|
68
|
+
tomador_ie: '',
|
69
|
+
tomador_razao: 'Pagador de Impostos',
|
70
|
+
tomador_fantasia: '',
|
71
|
+
tomador_endereco: 'Rua de Asfalto',
|
72
|
+
tomador_numero: '100',
|
73
|
+
tomador_complemento: 'Fundos',
|
74
|
+
tomador_bairro: 'Bairro Feliz',
|
75
|
+
tomador_CEP: '17512752',
|
76
|
+
tomador_cod_cidade: '3127107',
|
77
|
+
tomador_fone: '1499998888',
|
78
|
+
tomador_ramal: '',
|
79
|
+
tomador_fax: '',
|
80
|
+
tomador_ramal_fax: ''
|
81
|
+
}
|
82
|
+
```
|
26
83
|
|
27
|
-
|
84
|
+
```ruby
|
85
|
+
taker = Sigiss::Taker.new(params)
|
86
|
+
```
|
28
87
|
|
29
|
-
|
88
|
+
### APIs
|
30
89
|
|
31
|
-
|
90
|
+
#### Emissão
|
91
|
+
```ruby
|
92
|
+
invoice = Sigiss::Invoice.new(gateway: gateway, provider: provider, taker: taker)
|
93
|
+
params = {
|
94
|
+
aliquota_simples: '',
|
95
|
+
id_sis_legado: '',
|
96
|
+
servico: '105',
|
97
|
+
situacao: 'tp',
|
98
|
+
valor: '10,00',
|
99
|
+
base: '10,00',
|
100
|
+
descricaoNF: 'Teste NF'
|
101
|
+
}
|
102
|
+
invoice.build(issue: params)
|
103
|
+
invoice.issue!
|
104
|
+
```
|
105
|
+
|
106
|
+
#### Consulta
|
107
|
+
```ruby
|
108
|
+
invoice = Sigiss::Invoice.new(gateway: gateway, provider: provider)
|
109
|
+
params = {
|
110
|
+
nota: '13114',
|
111
|
+
serie: '1',
|
112
|
+
autenticidade: '2ZZGUTL0',
|
113
|
+
valor: '10,00'
|
114
|
+
}
|
115
|
+
invoice.build(fetch: params)
|
116
|
+
invoice.fetch!
|
117
|
+
```
|
32
118
|
|
33
|
-
|
119
|
+
#### Cancelamento
|
120
|
+
```ruby
|
121
|
+
invoice = Sigiss::Invoice.new(gateway: gateway, provider: provider)
|
122
|
+
params = {
|
123
|
+
nota: '13114',
|
124
|
+
motivo: 'Falha no Engano',
|
125
|
+
email: 'email@tomador.com'
|
126
|
+
}
|
127
|
+
invoice.build(cancel: params)
|
128
|
+
invoice.cancel!
|
129
|
+
```
|
34
130
|
|
35
|
-
|
131
|
+
## Contribuição
|
36
132
|
|
133
|
+
Reportar bugs e Pull Requests são bem vindos no Github em https://github.com/gabrielpedepera/sigiss.
|
37
134
|
|
38
|
-
## License
|
39
135
|
|
40
|
-
|
136
|
+
## Licença
|
41
137
|
|
138
|
+
A gem está disponível como open source sobre os termos de [MIT License](http://opensource.org/licenses/MIT).
|
data/bin/console
CHANGED
@@ -7,8 +7,8 @@ require "sigiss"
|
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
9
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
|
11
|
-
|
10
|
+
require "pry"
|
11
|
+
Pry.start
|
12
12
|
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
13
|
+
# require "irb"
|
14
|
+
# IRB.start
|
data/lib/sigiss/gateway.rb
CHANGED
@@ -1,17 +1,30 @@
|
|
1
1
|
require 'yaml'
|
2
|
+
require 'active_model'
|
2
3
|
module Sigiss
|
3
4
|
class Gateway
|
4
|
-
|
5
|
+
include ActiveModel::Validations
|
6
|
+
include ActiveModel::Validations::Callbacks
|
5
7
|
|
6
|
-
|
8
|
+
attr_accessor :environment
|
9
|
+
attr_reader :name, :url
|
10
|
+
|
11
|
+
validates_presence_of :name, :url, :environment
|
12
|
+
|
13
|
+
before_validation :validate_if_gateway_exists
|
14
|
+
|
15
|
+
def initialize(name = nil, environment = :test)
|
7
16
|
@name = name
|
8
|
-
@url =
|
17
|
+
@url = url_webservice(name, environment)
|
9
18
|
@environment = environment
|
10
19
|
end
|
11
20
|
|
12
|
-
def
|
21
|
+
def url_webservice(name, environment)
|
13
22
|
YAML.load_file(File.join(Sigiss.root, 'configs.yml'))[environment.to_s][name.to_s]
|
14
23
|
end
|
15
24
|
|
25
|
+
def validate_if_gateway_exists
|
26
|
+
errors.add(:name, :invalid) if @url.nil?
|
27
|
+
end
|
28
|
+
|
16
29
|
end
|
17
30
|
end
|
data/lib/sigiss/ibge.rb
CHANGED
data/lib/sigiss/invoice.rb
CHANGED
@@ -1,20 +1,13 @@
|
|
1
|
-
require 'lotus/validations'
|
2
1
|
require 'sigiss/integration'
|
3
|
-
|
2
|
+
require 'active_model'
|
4
3
|
module Sigiss
|
5
4
|
class Invoice
|
6
|
-
include
|
5
|
+
include ActiveModel::Validations
|
7
6
|
include Sigiss::Integration
|
8
7
|
|
9
|
-
attr_accessor :gateway,
|
10
|
-
:provider,
|
11
|
-
:taker,
|
12
|
-
:data
|
8
|
+
attr_accessor :gateway, :provider, :taker, :data
|
13
9
|
|
14
|
-
|
15
|
-
validates :provider, type: Provider, presence: true
|
16
|
-
validates :taker, type: Taker
|
17
|
-
validates :data, presence: true
|
10
|
+
validates_presence_of :gateway, :provider, :taker, :data
|
18
11
|
|
19
12
|
def initialize(attributes = {})
|
20
13
|
@gateway = attributes[:gateway]
|
@@ -1,12 +1,9 @@
|
|
1
1
|
module Sigiss
|
2
2
|
class CancelData < InvoiceData
|
3
3
|
|
4
|
-
attr_accessor :nota,
|
5
|
-
:motivo,
|
6
|
-
:email
|
4
|
+
attr_accessor :nota, :motivo, :email
|
7
5
|
|
8
|
-
|
9
|
-
validates :motivo, presence: true
|
6
|
+
validates_presence_of :nota, :motivo
|
10
7
|
|
11
8
|
def initialize(attributes = {})
|
12
9
|
@nota = attributes[:nota]
|
@@ -1,15 +1,8 @@
|
|
1
1
|
module Sigiss
|
2
2
|
class FetchData < InvoiceData
|
3
3
|
|
4
|
-
attr_accessor :nota,
|
5
|
-
|
6
|
-
:autenticidade,
|
7
|
-
:valor
|
8
|
-
|
9
|
-
validates :nota, presence: true
|
10
|
-
validates :serie, presence: true
|
11
|
-
validates :autenticidade, presence: true
|
12
|
-
validates :valor, presence: true
|
4
|
+
attr_accessor :nota, :serie, :autenticidade, :valor
|
5
|
+
validates_presence_of :nota, :serie, :autenticidade, :valor
|
13
6
|
|
14
7
|
def initialize(attributes = {})
|
15
8
|
@nota = attributes[:nota]
|
@@ -9,10 +9,7 @@ module Sigiss
|
|
9
9
|
:base,
|
10
10
|
:descricaoNF
|
11
11
|
|
12
|
-
|
13
|
-
validates :situacao, presence: true
|
14
|
-
validates :valor, presence: true
|
15
|
-
validates :base, presence: true
|
12
|
+
validates_presence_of :servico, :situacao, :valor, :base
|
16
13
|
|
17
14
|
def initialize(attributes = {})
|
18
15
|
@aliquota_simples = attributes[:aliquota_simples]
|
data/lib/sigiss/provider.rb
CHANGED
@@ -1,15 +1,12 @@
|
|
1
|
-
require 'lotus/validations'
|
2
1
|
require 'sigiss/extension'
|
3
2
|
module Sigiss
|
4
3
|
class Provider
|
5
|
-
include
|
4
|
+
include ActiveModel::Validations
|
6
5
|
include Sigiss::Extension
|
7
6
|
|
8
7
|
attr_accessor :ccm, :cnpj, :senha, :crc, :crc_estado
|
9
8
|
|
10
|
-
|
11
|
-
validates :cnpj, presence: true
|
12
|
-
validates :senha, presence: true
|
9
|
+
validates_presence_of :ccm, :cnpj, :senha
|
13
10
|
|
14
11
|
def initialize(attributes = {})
|
15
12
|
@ccm = attributes[:ccm]
|
data/lib/sigiss/taker.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require 'lotus/validations'
|
2
1
|
require 'sigiss/extension'
|
2
|
+
require 'active_model'
|
3
3
|
module Sigiss
|
4
4
|
class Taker
|
5
|
-
include
|
5
|
+
include ActiveModel::Validations
|
6
6
|
include Sigiss::Extension
|
7
7
|
|
8
8
|
attr_accessor :tomador_tipo,
|
@@ -23,14 +23,14 @@ module Sigiss
|
|
23
23
|
:tomador_fax,
|
24
24
|
:tomador_ramal_fax
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
26
|
+
validates_presence_of :tomador_tipo,
|
27
|
+
:tomador_cnpj,
|
28
|
+
:tomador_razao,
|
29
|
+
:tomador_endereco,
|
30
|
+
:tomador_numero,
|
31
|
+
:tomador_bairro,
|
32
|
+
:tomador_CEP,
|
33
|
+
:tomador_cod_cidade,
|
34
34
|
|
35
35
|
def initialize(attributes = {})
|
36
36
|
@tomador_tipo = attributes[:tomador_tipo]
|
data/lib/sigiss/version.rb
CHANGED
data/sigiss.gemspec
CHANGED
@@ -21,9 +21,11 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.10"
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
-
spec.add_development_dependency "
|
24
|
+
spec.add_development_dependency "activemodel", "~> 4.2.5"
|
25
25
|
spec.add_development_dependency "savon"
|
26
26
|
spec.add_development_dependency "rspec"
|
27
|
+
spec.add_development_dependency "vcr"
|
28
|
+
spec.add_development_dependency "webmock"
|
27
29
|
spec.add_development_dependency "pry"
|
28
30
|
spec.add_development_dependency "codeclimate-test-reporter"
|
29
31
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sigiss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Pereira
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -39,7 +39,21 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: activemodel
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 4.2.5
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.2.5
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: savon
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - ">="
|
@@ -53,7 +67,7 @@ dependencies:
|
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - ">="
|
@@ -67,7 +81,21 @@ dependencies:
|
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: vcr
|
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: webmock
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
72
100
|
requirements:
|
73
101
|
- - ">="
|
@@ -140,7 +168,6 @@ files:
|
|
140
168
|
- lib/sigiss/taker.rb
|
141
169
|
- lib/sigiss/version.rb
|
142
170
|
- sigiss.gemspec
|
143
|
-
- sigiss.txt
|
144
171
|
homepage: https://github.com/gabrielpedepera/sigiss
|
145
172
|
licenses:
|
146
173
|
- MIT
|
data/sigiss.txt
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
SIGISS
|
2
|
-
|
3
|
-
Ruby gem para integração com o sistema SIGISS para emissão de Notas Fiscais Eletrônicas.
|
4
|
-
|
5
|
-
gateway = Sigiss::Gateway.new(:marilia, :test|:production)
|
6
|
-
|
7
|
-
provider = Sigiss::Provider.new(params) # Prestador
|
8
|
-
|
9
|
-
taker = Sigiss::Taker.new(params) # Tomador
|
10
|
-
|
11
|
-
# Criar
|
12
|
-
invoice = Sigiss::Invoice.new(gateway: gateway, provider: provider, taker: taker)
|
13
|
-
invoice.build(issue: params)
|
14
|
-
invoice.issue!
|
15
|
-
|
16
|
-
# Consultar
|
17
|
-
invoice = Sigiss::Invoice.new(gateway: gateway, provider: provider)
|
18
|
-
invoice.build(fetch: params)
|
19
|
-
invoice.fetch!
|
20
|
-
|
21
|
-
# Cancelar
|
22
|
-
invoice = Sigiss::Invoice.new(gateway: gateway, provider: provider)
|
23
|
-
invoice.build(cancel: params)
|
24
|
-
invoice.cancel!
|