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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 205aa615619dae0b7e3d4ffc084e5cc353e52b22b8c8df6da36f50f2638fd816
4
- data.tar.gz: 8f9918c4f1251e6ce4c1e4f506166d6a819819664e8c70ad8642a1386726d203
3
+ metadata.gz: 433819d4e3cb88c722a88bd684510bd9e80fcdd131b0bdc76d1e8280f8a69973
4
+ data.tar.gz: edfa00380021724b1328bb420c93bd5ad4916269e1d1662ea0b1a890091a4351
5
5
  SHA512:
6
- metadata.gz: caa5ed433a4afd863dcaa72e025faf87e8a827d88c0eecb8213591d91c5480c94ca47afcd6eb9b4bf5dc43fc885ffd33df207bad8d7766d26393a0e1724047c2
7
- data.tar.gz: a2a4de3e89417613c6733e4a3404393d269f1afe2fd711df667a2d8959d488fbb798f53e6b5e36d853a0b07cc1463f1ec21cd22ad87ccd47d2367714874932e8
6
+ metadata.gz: dc36dda9214bc2b9a97c8107978029e9018af8915cad995f75c86fa57c0b6f31a777deed4f3ebf2366ecb19d8553c8d67b44987de8c7efddacf977035c3ee4f0
7
+ data.tar.gz: 0b2f967daa2829386f9b4567a3ac66241ce8d348eeb3c02a73573f616af66d93529aed072a38bbe4f134f9ae9df6e3ee3e4daf7e5e7262b6eb436ee749a9909c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bling_api (0.1.6)
4
+ bling_api (0.1.7)
5
5
  ac
6
6
  base64
7
7
 
@@ -41,4 +41,4 @@ DEPENDENCIES
41
41
  tldr
42
42
 
43
43
  BUNDLED WITH
44
- 2.4.12
44
+ 2.4.20
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
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_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_PRIOR_TO_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_PRIOR_TO_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]/bling_api.
32
-
33
- ## License
34
-
35
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
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).
@@ -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"],
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BlingApi
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.7"
5
5
  end
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.6
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: 2023-11-22 00:00:00.000000000 Z
11
+ date: 2024-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ac