facturapi_ruby 1.3.0 → 2.0.0

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: b58fed997b3fb3da051f518146bc46b1aa982b874f771e0890870b8578dabb61
4
- data.tar.gz: a6ad129cffa87123e86e36e7b38a53c99e9e30ba3a5b024d77c530e21847ec7f
3
+ metadata.gz: 1722b0098ee0ef6f187c3b3cb441513a415b388297ef4536ae4635d851254a39
4
+ data.tar.gz: 2ad3ee1d392a64bdade337461b896dd990339ed001af02afc0e7cf9ddb4151b9
5
5
  SHA512:
6
- metadata.gz: f7f2b0e62be8433c3cd944fa693829fe0ff495901cc38a8ef73dd8e0d27689f4f8d7b022ae71877a15972dd4d2f628f96655e90e68ec69cb0b6f31440cb65989
7
- data.tar.gz: b7d7e814f06a68fbc3a3b779e9dda13d5869183570ce1c72e3a011a281473300d9f86178b6389a4719bbbdf9e5e3108885754d896fa2104009107d41752a3348
6
+ metadata.gz: f9b1155dd14026c3aaece114fda81239aa156c5f8ff5c3cf7a2637ab3b5db620ae24c3f0fb7f429e9a89d31a92c588b1ce956e5344a68e35f22fc3af8c76402a
7
+ data.tar.gz: 208890f3f4a05ea90f494e35bfcb3a505788510e8e365dcb84d0b09e56419900ba6b6fb08f54bf2ed6b3d3ab524771c00b230c4fc841a8f2ef50abdb8e75b212
@@ -101,4 +101,42 @@ module FacturapiRuby
101
101
  ENAJENACION_DE_ACCIONES_EN_BOLSA_DE_VALORES: "630",
102
102
  REGIMEN_DE_LOS_INGRESOS_POR_OBTENCION_DE_PREMIOS: "615"
103
103
  }
104
+
105
+ REGIMEN_FISCAL = {
106
+ '603': 'Personas Morales con Fines no Lucrativos',
107
+ '605': 'Sueldos y Salarios e Ingresos Asimilados a Salarios',
108
+ '606': 'Arrendamiento',
109
+ '608': 'Demás ingresos',
110
+ '609': 'Consolidación',
111
+ '610': 'Residentes en el Extranjero sin Establecimiento Permanente en México',
112
+ '611': 'Ingresos por Dividendos (socios y accionistas)',
113
+ '612': 'Personas Físicas con Actividades Empresariales y Profesionales',
114
+ '614': 'Ingresos por intereses',
115
+ '616': 'Sin obligaciones fiscales',
116
+ '620': 'Sociedades Cooperativas de Producción que optan por diferir sus ingresos',
117
+ '621': 'Incorporación Fiscal',
118
+ '622': 'Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras',
119
+ '623': 'Opcional para Grupos de Sociedades',
120
+ '624': 'Coordinados',
121
+ '628': 'Hidrocarburos',
122
+ '607': 'Régimen de Enajenación o Adquisición de Bienes',
123
+ '629': 'De los Regímenes Fiscales Preferentes y de las Empresas Multinacionales',
124
+ '630': 'Enajenación de acciones en bolsa de valores',
125
+ '615': 'Régimen de los ingresos por obtención de premios',
126
+ '625': 'Régimen de las Actividades Empresariales con ingresos a través de Plataformas Tecnológicas',
127
+ '626': 'Régimen Simplificado de Confianza',
128
+ }.freeze
129
+
130
+ CANCELACION_FISCAL = {
131
+ '01': 'Comprobante emitido con errores con relación',
132
+ '02': 'Comprobante emitido con errores sin relación',
133
+ '03': 'No se llevó a cabo la operación',
134
+ '04': 'Operación nominativa relacionada en la factura global',
135
+ }.freeze
136
+
137
+ TAXABILITY = {
138
+ '01': 'No objeto de impuesto',
139
+ '02': 'Sí objeto de impuesto',
140
+ '03': 'Sí objeto de impuesto, pero no obligado a desglose',
141
+ }.freeze
104
142
  end
@@ -5,14 +5,14 @@ module FacturapiRuby
5
5
  class << self
6
6
  def create(options)
7
7
  HttpClient.post(
8
- endpoint: '/customers',
8
+ endpoint: '/v1/customers',
9
9
  api_options: options
10
10
  )
11
11
  end
12
12
 
13
13
  def update(customer_id, options)
14
14
  HttpClient.put(
15
- endpoint: "/customers/#{customer_id}",
15
+ endpoint: "/v1/customers/#{customer_id}",
16
16
  api_options: options
17
17
  )
18
18
  end
@@ -5,14 +5,14 @@ module FacturapiRuby
5
5
  class << self
6
6
  def pdf(options)
7
7
  HttpClient.get_file(
8
- endpoint: "/invoices/#{options[:invoice_id]}/pdf",
8
+ endpoint: "/v1/invoices/#{options[:invoice_id]}/pdf",
9
9
  file_ext: '.pdf'
10
10
  )
11
11
  end
12
12
 
13
13
  def xml(options)
14
14
  HttpClient.get_file(
15
- endpoint: "/invoices/#{options[:invoice_id]}/xml",
15
+ endpoint: "/v1/invoices/#{options[:invoice_id]}/xml",
16
16
  file_ext: '.xml'
17
17
  )
18
18
  end
@@ -14,7 +14,7 @@ module FacturapiRuby
14
14
  module HttpClient
15
15
 
16
16
  class << self
17
- BASE_URL = 'https://www.facturapi.io/v1'
17
+ BASE_URL = 'https://www.facturapi.io'
18
18
 
19
19
  def get_file(options)
20
20
  response = request(Net::HTTP::Get, options)
@@ -5,21 +5,21 @@ module FacturapiRuby
5
5
  class << self
6
6
  def create(options)
7
7
  HttpClient.post(
8
- endpoint: '/invoices',
8
+ endpoint: '/v1/invoices',
9
9
  api_options: options
10
10
  )
11
11
  end
12
12
 
13
13
  def cancel(invoice_id, options={})
14
14
  HttpClient.delete(
15
- endpoint: "/invoices/#{invoice_id}",
15
+ endpoint: "/v1/invoices/#{invoice_id}",
16
16
  api_options: options
17
17
  )
18
18
  end
19
19
 
20
20
  def get(invoice_id, options={})
21
21
  HttpClient.get(
22
- endpoint: "/invoices/#{invoice_id}",
22
+ endpoint: "/v1/invoices/#{invoice_id}",
23
23
  api_options: options
24
24
  )
25
25
  end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'facturapi_ruby/http_client'
4
+
5
+ module FacturapiRuby
6
+ module V2
7
+ module Customers
8
+ class << self
9
+ def create(options)
10
+ HttpClient.post(
11
+ endpoint: '/v2/customers',
12
+ api_options: options
13
+ )
14
+ end
15
+
16
+ def update(customer_id, options)
17
+ HttpClient.put(
18
+ endpoint: "/v2/customers/#{customer_id}",
19
+ api_options: options
20
+ )
21
+ end
22
+
23
+ def validate(customer_id)
24
+ HttpClient.get(
25
+ endpoint: '/v2/customers/{customer_id}/tax-info-validation'
26
+ )
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'facturapi_ruby/http_client'
4
+
5
+ module FacturapiRuby
6
+ module V2
7
+ module Files
8
+ class << self
9
+ def pdf(options)
10
+ HttpClient.get_file(
11
+ endpoint: "/v2/invoices/#{options[:invoice_id]}/pdf",
12
+ file_ext: '.pdf'
13
+ )
14
+ end
15
+
16
+ def xml(options)
17
+ HttpClient.get_file(
18
+ endpoint: "/v2/invoices/#{options[:invoice_id]}/xml",
19
+ file_ext: '.xml'
20
+ )
21
+ end
22
+
23
+ def zip(options)
24
+ HttpClient.get_file(
25
+ endpoint: "/v2/invoices/#{options[:invoice_id]}/zip",
26
+ file_ext: '.zip'
27
+ )
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'facturapi_ruby/http_client'
4
+
5
+ module FacturapiRuby
6
+ module V2
7
+ module Invoices
8
+ class << self
9
+ def create(options)
10
+ HttpClient.post(
11
+ endpoint: '/v2/invoices',
12
+ api_options: options
13
+ )
14
+ end
15
+
16
+ def cancel(invoice_id, motive, substitution=nil, options={})
17
+ path = "/v2/invoices/#{invoice_id}?motive=#{motive}"
18
+ path += "&substitution=#{substitution}" if substitution
19
+ HttpClient.delete(
20
+ endpoint: path,
21
+ api_options: options
22
+ )
23
+ end
24
+
25
+ def get(invoice_id, options={})
26
+ HttpClient.get(
27
+ endpoint: "/v2/invoices/#{invoice_id}",
28
+ api_options: options
29
+ )
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FacturapiRuby
2
- VERSION = "1.3.0"
4
+ VERSION = "2.0.0"
3
5
  end
@@ -4,6 +4,10 @@ require 'facturapi_ruby/customers'
4
4
  require 'facturapi_ruby/files'
5
5
  require 'facturapi_ruby/invoices'
6
6
  require 'facturapi_ruby/version'
7
+ require 'facturapi_ruby/v2/customers'
8
+ require 'facturapi_ruby/v2/files'
9
+ require 'facturapi_ruby/v2/invoices'
10
+
7
11
 
8
12
  module FacturapiRuby
9
13
  class << self
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facturapi_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diego Llamas Velasco
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-06 00:00:00.000000000 Z
11
+ date: 2022-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,12 +78,15 @@ files:
78
78
  - lib/facturapi_ruby/files.rb
79
79
  - lib/facturapi_ruby/http_client.rb
80
80
  - lib/facturapi_ruby/invoices.rb
81
+ - lib/facturapi_ruby/v2/customers.rb
82
+ - lib/facturapi_ruby/v2/files.rb
83
+ - lib/facturapi_ruby/v2/invoices.rb
81
84
  - lib/facturapi_ruby/version.rb
82
85
  homepage: https://github.com/diegollams/facturapi_ruby
83
86
  licenses:
84
87
  - MIT
85
88
  metadata: {}
86
- post_install_message:
89
+ post_install_message:
87
90
  rdoc_options: []
88
91
  require_paths:
89
92
  - lib
@@ -98,9 +101,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
101
  - !ruby/object:Gem::Version
99
102
  version: '0'
100
103
  requirements: []
101
- rubyforge_project:
102
- rubygems_version: 2.7.5
103
- signing_key:
104
+ rubygems_version: 3.1.2
105
+ signing_key:
104
106
  specification_version: 4
105
107
  summary: Crea Facturas Electrónicas válidas lo más fácil posible (CFDI) https://facturapi.io
106
108
  test_files: []