bling_api 0.1.6 → 0.1.8
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/README.md +37 -35
- data/lib/bling_api/order.rb +9 -3
- data/lib/bling_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6b47b0339991b98086a3698ce2fbdd7efbcc8d6344b77b22916b0d0971b2add
|
4
|
+
data.tar.gz: 630d034a6b911aadfcf281e8b8dee67e6949d26e95af0d837c41f4c0a7d38862
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35d60a0ca87f7723d16a84de547089a0c44b5ce1a93d13e64b918d3623ab6c2dc16ae7fac0b67c713c4381fef9d17f7d24975a59ac67e63f716ae884b2a61c8a
|
7
|
+
data.tar.gz: ea74367a751bf9a166123030edbb6322e59455efb045cfaa6d6a738bed5a59d531c0ae3e5c45ccca3448f274c818b06df245f54258069108b804abfbd5e6845f
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,35 +1,37 @@
|
|
1
|
-
# BlingApi
|
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/bling_api`. To experiment with that code, run `bin/console` for an interactive prompt.
|
6
|
-
|
7
|
-
## Installation
|
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
|
-
|
1
|
+
# BlingApi
|
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/bling_api`. To experiment with that code, run `bin/console` for an interactive prompt.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add bling_api to your Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'bling_api'
|
13
|
+
```
|
14
|
+
|
15
|
+
Bundle your dependencies and run the installation generator:
|
16
|
+
|
17
|
+
```shell
|
18
|
+
bin/rails generate bling_api:install
|
19
|
+
```
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Development
|
26
|
+
|
27
|
+
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.
|
28
|
+
|
29
|
+
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).
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bling_api.
|
34
|
+
|
35
|
+
## License
|
36
|
+
|
37
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/bling_api/order.rb
CHANGED
@@ -6,8 +6,8 @@ module BlingApi
|
|
6
6
|
new(**build_hash(response))
|
7
7
|
end
|
8
8
|
|
9
|
-
attr_reader :id, :numero, :id_contato, :items, :parcelas, :numero_loja, :data, :total_produtos, :total, :id_loja, :numero_pedido_compra, :observacoes, :observacoes_internas, :valor_desconto, :id_categoria, :transporte, :id_vendedor
|
10
|
-
def initialize(id:nil, numero:nil, id_contato:, items:, parcelas:nil, numero_loja:, data:, total_produtos:, total:, id_loja:, numero_pedido_compra:nil, observacoes:, observacoes_internas:, valor_desconto:, id_categoria:, transporte:nil, id_vendedor:)
|
9
|
+
attr_reader :id, :numero, :id_contato, :items, :parcelas, :numero_loja, :data, :total_produtos, :total, :id_loja, :numero_pedido_compra, :observacoes, :observacoes_internas, :valor_desconto, :id_categoria, :transporte, :id_vendedor, :pessoa_juridica, :numero_documento
|
10
|
+
def initialize(id:nil, numero:nil, id_contato:, items:, parcelas:nil, numero_loja:, data:, total_produtos:, total:, id_loja:, numero_pedido_compra:nil, observacoes:, observacoes_internas:, valor_desconto:, id_categoria:, transporte:nil, id_vendedor:, pessoa_juridica:nil, numero_documento:nil)
|
11
11
|
@id = id
|
12
12
|
@numero = numero
|
13
13
|
@id_contato = id_contato
|
@@ -25,6 +25,8 @@ module BlingApi
|
|
25
25
|
@id_categoria = id_categoria
|
26
26
|
@transporte = transporte
|
27
27
|
@id_vendedor = id_vendedor
|
28
|
+
@pessoa_juridica = pessoa_juridica
|
29
|
+
@numero_documento = numero_documento
|
28
30
|
end
|
29
31
|
|
30
32
|
def build_json
|
@@ -35,7 +37,9 @@ module BlingApi
|
|
35
37
|
"id": id_loja
|
36
38
|
},
|
37
39
|
"contato": {
|
38
|
-
"id": id_contato
|
40
|
+
"id": id_contato,
|
41
|
+
"tipoPessoa": pessoa_juridica ? "J" : "F",
|
42
|
+
"numeroDocumento": numero_documento
|
39
43
|
},
|
40
44
|
"itens": items,
|
41
45
|
"vendedor": {
|
@@ -68,6 +72,8 @@ module BlingApi
|
|
68
72
|
{
|
69
73
|
id: json_response["id"],
|
70
74
|
id_contato: json_response["contato"]["id"],
|
75
|
+
pessoa_juridica: json_response.dig("contato", "tipoPessoa") == "J",
|
76
|
+
numeroDocumento: json_response.dig("contato", "numeroDocumento"),
|
71
77
|
items: json_response["itens"],
|
72
78
|
parcelas: json_response["parcelas"],
|
73
79
|
numero_loja: json_response["numeroLoja"],
|
data/lib/bling_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bling_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- caio
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ac
|