omie-client 0.1.6 → 0.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11bf02b4f5144f73e78a0a7eeb9b1c6a49cce7420c46c303b51ad2a75d7eaa73
4
- data.tar.gz: 8c34ec182dd11251e1db620b85622fa3face3eb9d2e9efef1b1ab69febe59a93
3
+ metadata.gz: 94419cf21c98a1561abc447b6b2573dff8000e5803eee8fbf8fe900f0c84e0f3
4
+ data.tar.gz: e6c9f7a717722a8defa94da9b70012f52eb867b204fc3c01cc21da31ee9044c5
5
5
  SHA512:
6
- metadata.gz: e2186edbc7e24d8b8466e1a1a3474c9acd3b4c2cfcd1453e1694f92785ab64718520889ff08599047ef99a6de730ff0d973ed02be4554a69e72f092634ad5fdb
7
- data.tar.gz: 70521bb00881096c46ee836f6806672d5b7cfa74868276365ac5c5243264309c94804c18623d880cb5a7fa8141748f4ed99235bf75f4468cc88f8aae9ee553d7
6
+ metadata.gz: b494ee1e588966d557a3be0eeb43d6b1a9a858c736946a82e23a589a3a66182821a3826aa86b1dc1bd4101bf11b625f0de8b86367ae50608fe96c351f4a35be5
7
+ data.tar.gz: c83fd3c1f491968b12ba0336e6b233c2480c7c0574209f6ae0d87720ab4a1f8e459cc179739334958a3488d3f73301f3e5fbc6a4c9ca8f42aae4892ecb7584ea
data/lib/omie/company.rb CHANGED
@@ -93,16 +93,22 @@ module Omie
93
93
  # records.
94
94
  #
95
95
  # @!scope class
96
- # @param page [Integer]
97
- # the page to be returned.
98
- # @param per_page [Integer]
99
- # the number of items per page (max: 50).
96
+ # @param [Hash] options
97
+ # The options param follows the same structure described by
98
+ # https://app.omie.com.br/api/v1/geral/clientes/#clientes_list_request
100
99
  # @return [Array<Omie::Company>]
101
100
  # the list of found companies
102
- def self.list(page = 1, per_page = 50)
103
- params = { pagina: page, registros_por_pagina: per_page }
101
+ def self.list(options = {})
102
+ default = {
103
+ pagina: 1, registros_por_pagina: 50,
104
+ apenas_importado_api: 'N'
105
+ }
106
+
107
+ default.each do |k, v|
108
+ options[k] = v unless options.key?(k)
109
+ end
104
110
 
105
- response = request(URI, CALLS[:list], params)
111
+ response = request(URI, CALLS[:list], options)
106
112
  response['clientes_cadastro'].map { |client| Omie::Company.new(client) }
107
113
  rescue Omie::RequestError
108
114
  []
data/lib/omie/product.rb CHANGED
@@ -94,26 +94,22 @@ module Omie
94
94
  # records.
95
95
  #
96
96
  # @!scope class
97
- # @param page [Integer]
98
- # the page to be returned.
99
- # @param per_page [Integer]
100
- # the number of items per page (max: 50).
101
- # @param only_imported [String]
102
- # related to 'apenas_importado_api' params, accept 'S' or 'N'.
103
- # @param only_pdv [String]
104
- # related to 'filtrar_apenas_omiepdv' params, accept 'S' or 'N'.
97
+ # @param [Hash] options
98
+ # The options param follows the same structure described by
99
+ # https://app.omie.com.br/api/v1/geral/produtos/#produto_servico_list_request
105
100
  # @return [Array<Omie::Product>]
106
101
  # the list of found companies
107
- def self.list(
108
- page = 1, per_page = 50, only_imported = 'N', only_pdv = 'N'
109
- )
110
- params = {
111
- pagina: page, registros_por_pagina: per_page,
112
- apenas_importado_api: only_imported,
113
- filtrar_apenas_omiepdv: only_pdv
102
+ def self.list(options = {})
103
+ default = {
104
+ pagina: 1, registros_por_pagina: 50,
105
+ apenas_importado_api: 'N', filtrar_apenas_omiepdv: 'N'
114
106
  }
115
107
 
116
- response = request(URI, CALLS[:list], params)
108
+ default.each do |k, v|
109
+ options[k] = v unless options.key?(k)
110
+ end
111
+
112
+ response = request(URI, CALLS[:list], options)
117
113
  response['produto_servico_cadastro'].map do |product|
118
114
  Omie::Product.new(product)
119
115
  end
data/lib/omie/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Omie
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: omie-client
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
  - Peerdustry
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-06 00:00:00.000000000 Z
11
+ date: 2021-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler