colppy 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/colppy/resources/company.rb +32 -1
- data/lib/colppy/resources/customer.rb +21 -19
- data/lib/colppy/resources/invoice.rb +4 -2
- data/lib/colppy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5494e30413da3d4e1b029c852be3889550792c8
|
4
|
+
data.tar.gz: 00b64d152ae5ec21ed41c3b00b7e43a7951584f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c028c1cd1cb953ba6576fee5180a7087ff84b50ca755052351bf0f504273d8b61fddbfb9683ef72b4c089508a4e5d0c3c12f6632f1a365395d7406b527d7cdf
|
7
|
+
data.tar.gz: 72640f3f583805b0a04f572909402a69ea2831e55c047abcb997375319c1e3c87de2cf827f9734d4577cf3df5ce7f1567c079661e450354939af444f12b03037
|
@@ -3,9 +3,26 @@ module Colppy
|
|
3
3
|
extend self
|
4
4
|
|
5
5
|
def companies
|
6
|
-
@companies
|
6
|
+
return @companies if @companies
|
7
|
+
_companies = Company.all(self)
|
8
|
+
if _companies[:results]
|
9
|
+
@companies = _companies[:results]
|
10
|
+
else
|
11
|
+
_companies
|
12
|
+
end
|
7
13
|
end
|
8
14
|
|
15
|
+
def company_by_id(id)
|
16
|
+
if @companies
|
17
|
+
@companies.detect do |company|
|
18
|
+
company.id == id
|
19
|
+
end
|
20
|
+
else
|
21
|
+
Company.get(self, id)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
alias :company :company_by_id
|
25
|
+
|
9
26
|
end
|
10
27
|
|
11
28
|
class Company < Resource
|
@@ -38,6 +55,20 @@ module Colppy
|
|
38
55
|
response
|
39
56
|
end
|
40
57
|
end
|
58
|
+
|
59
|
+
def get(client, id)
|
60
|
+
response = client.call(
|
61
|
+
:company,
|
62
|
+
:read,
|
63
|
+
client.session_params.merge({ idEmpresa: id })
|
64
|
+
)
|
65
|
+
if response[:success]
|
66
|
+
new(response[:data].merge(client: client))
|
67
|
+
else
|
68
|
+
response
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
41
72
|
end
|
42
73
|
|
43
74
|
def initialize(client: nil, **params)
|
@@ -21,6 +21,7 @@ module Colppy
|
|
21
21
|
idCondicionPago: :payment_condition_id,
|
22
22
|
idCondicionIva: :tax_condition_id,
|
23
23
|
CUIT: :cuit,
|
24
|
+
dni: :dni,
|
24
25
|
idTipoPercepcion: :tax_perception_id,
|
25
26
|
NroCuenta: :account_number,
|
26
27
|
CBU: :cbu,
|
@@ -154,31 +155,32 @@ module Colppy
|
|
154
155
|
idUsuario: @client.username,
|
155
156
|
idCliente: id || "",
|
156
157
|
idEmpresa: @company.id,
|
157
|
-
NombreFantasia: @data[:
|
158
|
-
RazonSocial: name || "",
|
159
|
-
CUIT: @data[:
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
158
|
+
NombreFantasia: @data[:fantasy_name] || "",
|
159
|
+
RazonSocial: @name || "",
|
160
|
+
CUIT: @data[:cuit] || "",
|
161
|
+
dni: @data[:dni] || "",
|
162
|
+
DirPostal: @data[:address] || "",
|
163
|
+
DirPostalCiudad: @data[:address_city] || "",
|
164
|
+
DirPostalCodigoPostal: @data[:address_zipcode] || "",
|
165
|
+
DirPostalProvincia: @data[:address_state] || "",
|
166
|
+
DirPostalPais: @data[:address_country] || "Argentina",
|
167
|
+
Telefono: @data[:phone_number] || "",
|
168
|
+
Email: @data[:email] || ""
|
167
169
|
}
|
168
170
|
end
|
169
171
|
|
170
172
|
def other_info_params
|
171
173
|
{
|
172
|
-
Activo: @data[:
|
174
|
+
Activo: @data[:active] || "1",
|
173
175
|
FechaAlta: @data[:FechaAlta] || "",
|
174
|
-
DirFiscal: @data[:
|
175
|
-
DirFiscalCiudad: @data[:
|
176
|
-
DirFiscalCodigoPostal: @data[:
|
177
|
-
DirFiscalProvincia: @data[:
|
178
|
-
DirFiscalPais: @data[:
|
179
|
-
idCondicionPago: @data[:
|
180
|
-
idCondicionIva: @data[:
|
181
|
-
porcentajeIVA: @data[:
|
176
|
+
DirFiscal: @data[:legal_address] || "",
|
177
|
+
DirFiscalCiudad: @data[:legal_address_city] || "",
|
178
|
+
DirFiscalCodigoPostal: @data[:legal_address_zipcode] || "",
|
179
|
+
DirFiscalProvincia: @data[:legal_address_state] || "",
|
180
|
+
DirFiscalPais: @data[:legal_address_country] || "Argentina",
|
181
|
+
idCondicionPago: @data[:payment_condition_id] || "0",
|
182
|
+
idCondicionIva: @data[:tax_condition_id] || "",
|
183
|
+
porcentajeIVA: @data[:tax] || "21",
|
182
184
|
idPlanCuenta: @data[:idPlanCuenta] || "",
|
183
185
|
CuentaCredito: @data[:CuentaCredito] || "",
|
184
186
|
DirEnvio: @data[:DirEnvio] || "",
|
@@ -127,7 +127,7 @@ module Colppy
|
|
127
127
|
end
|
128
128
|
|
129
129
|
def tax
|
130
|
-
(@data[:tax] || product.tax ||
|
130
|
+
(@data[:tax] || product.tax || 21).to_f
|
131
131
|
end
|
132
132
|
def charged
|
133
133
|
(unit_price || product.sell_price || 0).to_f
|
@@ -181,7 +181,9 @@ module Colppy
|
|
181
181
|
}
|
182
182
|
end
|
183
183
|
|
184
|
-
def inspect
|
184
|
+
def inspect
|
185
|
+
"#<#{self.class.name} product_id:#{@data[:product_id]} >"
|
186
|
+
end
|
185
187
|
end
|
186
188
|
class Invoice::Payment
|
187
189
|
include Utils
|
data/lib/colppy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: colppy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agustin Cavilliotti
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|