tiny_erp_api 0.1.7 → 1.0.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/README.md +102 -37
- data/lib/tiny_erp_api/customer.rb +0 -8
- data/lib/tiny_erp_api/order.rb +1 -1
- data/lib/tiny_erp_api/seller.rb +1 -1
- data/lib/tiny_erp_api/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfbcf2efac012916d000a8efb6bdfded99741005d57f0b8228bc0841a7c6ddba
|
4
|
+
data.tar.gz: bb65436e2819e862cae78e4e8b13dda74fd267b06b7cf62ba476dd8e6042dc90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cee43ee15dc40e288b11a7f00f9bb04dd07705f5bb772eb6fd1198c860f9c2c069940f7a4518b2584a8198e7d3cb2407f64a6a065af29d77060b7aa41e60d82b
|
7
|
+
data.tar.gz: 4acb05b24c3af0ce0662dd056d52843561b47d7a5ea5fdfeb5f776d112526f7f6502036eeafa4ad9120a29819718abb2d052f85981756079b79662222cd1ae26
|
data/README.md
CHANGED
@@ -1,39 +1,104 @@
|
|
1
1
|
# TinyErpApi
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
3
|
+
Wrapper de integração com a API 2.0 do ERP Tiny.
|
4
|
+
|
5
|
+
[Documentação API Tiny](https://tiny.com.br/api-docs/api2)
|
6
|
+
|
7
|
+
### Funcionalidades:
|
8
|
+
- Clientes: find_by_id, find_by_document (CPF/CNPJ)
|
9
|
+
- Pedido de venda: create, find_by_id
|
10
|
+
- Produtos: find_by_sku, get_product_by_id
|
11
|
+
- Vendedores: get_all (listagem), find_by_name
|
12
|
+
|
13
|
+
## Instalação
|
14
|
+
|
15
|
+
Adicionar tiny_erp_api no Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'tiny_erp_api'
|
19
|
+
```
|
20
|
+
ou
|
21
|
+
```shell
|
22
|
+
bundle add tiny_erp_api
|
23
|
+
```
|
24
|
+
|
25
|
+
Instalar a gem:
|
26
|
+
|
27
|
+
```shell
|
28
|
+
bin/rails generate tiny_erp_api:install
|
29
|
+
```
|
30
|
+
|
31
|
+
## Uso
|
32
|
+
|
33
|
+
Configurar `access_token` no initializer ou direto no código:
|
34
|
+
```ruby
|
35
|
+
TinyErpApi.configure do |config|
|
36
|
+
config.access_token = "ACCESS_TOKEN"
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
### Exemplo
|
41
|
+
#### Produto
|
42
|
+
```ruby
|
43
|
+
# Encontrar um produto a partir do SKU
|
44
|
+
product = TinyErpApi::Product.find_by_sku("123456")
|
45
|
+
puts product.sku # "123456"
|
46
|
+
```
|
47
|
+
#### Pedido de venda
|
48
|
+
```ruby
|
49
|
+
# Instancia o objeto
|
50
|
+
order = TinyErpApi::Order.new(
|
51
|
+
data_pedido: "05/06/2024",
|
52
|
+
numero_pedido: "R123456",
|
53
|
+
ecommerce: "Site",
|
54
|
+
atualizar_cliente: true,
|
55
|
+
cliente: {
|
56
|
+
nome: "João da Silva",
|
57
|
+
tipo_pessoa: "F",
|
58
|
+
cpf_cnpj: "12345678901",
|
59
|
+
endereco: "Rua da Saudade",
|
60
|
+
numero: "123",
|
61
|
+
complemento: "",
|
62
|
+
bairro: "Centro",
|
63
|
+
cep: "01002010",
|
64
|
+
cidade: "São Paulo",
|
65
|
+
uf: "SP",
|
66
|
+
fone: "1122334455",
|
67
|
+
email: "joao@email.com"
|
68
|
+
},
|
69
|
+
itens:[
|
70
|
+
{
|
71
|
+
item: {
|
72
|
+
codigo: "123321",
|
73
|
+
quantidade: 1,
|
74
|
+
valor_unitario: 10.00,
|
75
|
+
}
|
76
|
+
}
|
77
|
+
],
|
78
|
+
forma_pagamento: "credito",
|
79
|
+
parcelas: [
|
80
|
+
{
|
81
|
+
parcela: {
|
82
|
+
data: "05/06/2024",
|
83
|
+
valor: 10.00,
|
84
|
+
forma_pagamento: "credito",
|
85
|
+
}
|
86
|
+
}
|
87
|
+
],
|
88
|
+
valor_frete: 5.00,
|
89
|
+
valor_desconto: 5.0,
|
90
|
+
forma_envio: "Correios",
|
91
|
+
forma_frete: "SEDEX",
|
92
|
+
transportador: "LOGISTICA LTDA.",
|
93
|
+
id_vendedor: 23523434,
|
94
|
+
deposito: "Geral",
|
95
|
+
id_natureza_operacao: 45617653,
|
96
|
+
observacoes: "observações",
|
97
|
+
observacoes_internas: "observações internas"
|
98
|
+
)
|
99
|
+
|
100
|
+
# Cria o pedido de venda
|
101
|
+
created_order = order.create
|
102
|
+
|
103
|
+
puts created_order.numero # 102030
|
104
|
+
```
|
data/lib/tiny_erp_api/order.rb
CHANGED
@@ -32,7 +32,7 @@ module TinyErpApi
|
|
32
32
|
|
33
33
|
def create
|
34
34
|
response = Client.new(TinyErpApi.configuration.access_token).create_order(build_json)
|
35
|
-
self.class.find_by_id(response
|
35
|
+
self.class.find_by_id(response.dig("id"))
|
36
36
|
end
|
37
37
|
|
38
38
|
def build_json
|
data/lib/tiny_erp_api/seller.rb
CHANGED
data/lib/tiny_erp_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tiny_erp_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Todas Essas Coisas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ac
|
@@ -46,12 +46,12 @@ files:
|
|
46
46
|
- lib/tiny_erp_api/seller.rb
|
47
47
|
- lib/tiny_erp_api/version.rb
|
48
48
|
- sig/tiny_erp_api.rbs
|
49
|
-
homepage: https://github.com/
|
49
|
+
homepage: https://github.com/todasessascoisas/tiny_erp_api
|
50
50
|
licenses:
|
51
51
|
- MIT
|
52
52
|
metadata:
|
53
|
-
homepage_uri: https://github.com/
|
54
|
-
source_code_uri: https://github.com/
|
53
|
+
homepage_uri: https://github.com/todasessascoisas/tiny_erp_api
|
54
|
+
source_code_uri: https://github.com/todasessascoisas/tiny_erp_api
|
55
55
|
post_install_message:
|
56
56
|
rdoc_options: []
|
57
57
|
require_paths:
|
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
requirements: []
|
70
|
-
rubygems_version: 3.5.
|
70
|
+
rubygems_version: 3.5.9
|
71
71
|
signing_key:
|
72
72
|
specification_version: 4
|
73
73
|
summary: Gem to interact with Tiny ERP API.
|