bling_api 0.1.6 → 0.1.7
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: 433819d4e3cb88c722a88bd684510bd9e80fcdd131b0bdc76d1e8280f8a69973
|
4
|
+
data.tar.gz: edfa00380021724b1328bb420c93bd5ad4916269e1d1662ea0b1a890091a4351
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc36dda9214bc2b9a97c8107978029e9018af8915cad995f75c86fa57c0b6f31a777deed4f3ebf2366ecb19d8553c8d67b44987de8c7efddacf977035c3ee4f0
|
7
|
+
data.tar.gz: 0b2f967daa2829386f9b4567a3ac66241ce8d348eeb3c02a73573f616af66d93529aed072a38bbe4f134f9ae9df6e3ee3e4daf7e5e7262b6eb436ee749a9909c
|
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:, numero_documento:)
|
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.7
|
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-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ac
|