tiny_erp_api 1.0.0 → 1.0.1

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: 0e30fb0ea25eb461c8f30fbcfadf024060ab30133c4e6ffcfcc5efe4f2ed4475
4
- data.tar.gz: ea1fe6ea157cc34ef811ddd62f73b391e31fe9dc80d3cd98a6ee19a3e9a3052a
3
+ metadata.gz: bfbcf2efac012916d000a8efb6bdfded99741005d57f0b8228bc0841a7c6ddba
4
+ data.tar.gz: bb65436e2819e862cae78e4e8b13dda74fd267b06b7cf62ba476dd8e6042dc90
5
5
  SHA512:
6
- metadata.gz: a0ef8b128ade2d05457ba54abbd8620be21476ecde589b55e4475763596f87c027bbd00f48e4000946c0c12d6ed34ef71bbe3ae673f6317a83db5b9711b676ed
7
- data.tar.gz: 5441effde03400cbb2d2bd5382ba882b6f934afcaca333791006db4e384f37732c2eb5ac12df79376d2263707b0901ed2c513ed3a0f6732055c9f1da9c913533
6
+ metadata.gz: cee43ee15dc40e288b11a7f00f9bb04dd07705f5bb772eb6fd1198c860f9c2c069940f7a4518b2584a8198e7d3cb2407f64a6a065af29d77060b7aa41e60d82b
7
+ data.tar.gz: 4acb05b24c3af0ce0662dd056d52843561b47d7a5ea5fdfeb5f776d112526f7f6502036eeafa4ad9120a29819718abb2d052f85981756079b79662222cd1ae26
data/README.md CHANGED
@@ -1,39 +1,104 @@
1
1
  # TinyErpApi
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
4
-
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/tiny_erp_api`. To experiment with that code, run `bin/console` for an interactive prompt.
6
-
7
- ## Installation
8
-
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
-
11
- Install the gem and add to the application's Gemfile by executing:
12
-
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
14
-
15
- If bundler is not being used to manage dependencies, install the gem by executing:
16
-
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
18
-
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
-
23
- ## Development
24
-
25
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
-
27
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
-
29
- ## Contributing
30
-
31
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/tiny_erp_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/tiny_erp_api/blob/main/CODE_OF_CONDUCT.md).
32
-
33
- ## License
34
-
35
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
36
-
37
- ## Code of Conduct
38
-
39
- Everyone interacting in the TinyErpApi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/tiny_erp_api/blob/main/CODE_OF_CONDUCT.md).
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
+ ```
@@ -45,14 +45,6 @@ module TinyErpApi
45
45
  new(**build_hash(contact))
46
46
  end
47
47
 
48
- def self.create(params)
49
-
50
- end
51
-
52
- def self.update(params)
53
-
54
- end
55
-
56
48
  def self.build_hash(json_response)
57
49
  {
58
50
  id: json_response["id"],
@@ -29,7 +29,7 @@ module TinyErpApi
29
29
  sellers >> response_json["vendedores"]
30
30
  end
31
31
  end
32
- build_hash_sellers(sellers)
32
+ build_hash_sellers(sellers)
33
33
  end
34
34
 
35
35
  def self.find_by_name(name)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TinyErpApi
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
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: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
- - Hamilton Tumenas Borges
7
+ - Todas Essas Coisas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-08 00:00:00.000000000 Z
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/hamiltontborges
49
+ homepage: https://github.com/todasessascoisas/tiny_erp_api
50
50
  licenses:
51
51
  - MIT
52
52
  metadata:
53
- homepage_uri: https://github.com/hamiltontborges
54
- source_code_uri: https://github.com/hamiltontborges/tiny_erp_api
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.10
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.