afip-public 0.0.2

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b2eafedb85fb14ab7bb314c8f40700b6941baf04
4
+ data.tar.gz: 4c80a19eb54dc227dd12d7d638ae2a9e4ef5fe14
5
+ SHA512:
6
+ metadata.gz: a51ae2f0625d5f2363b59a427935676ea1c4796434941584b11d3ea546aaa9b71ffd6dfe05a50065daa01c7e5db2e1cf8a35242da093346bfe60ddcfd83329fc
7
+ data.tar.gz: 716c3e6e6edf37b8caeb57cd0efef87c5932142eae66c9359f98cf2d32a4950c2a2b66561c29dcb6b8eb2467c5b37aed93e4e58240666b827a381a745aaf95a2
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ # afip-public
2
+ AFIP public API helper
@@ -0,0 +1,5 @@
1
+ task :console do
2
+ exec "irb -r afip_public -I ./lib"
3
+ end
4
+
5
+
@@ -0,0 +1,29 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'afip-public/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'afip-public'
7
+ s.version = AfipPublic::VERSION
8
+ s.date = '2017-06-12'
9
+ s.summary = "A simple helper for AFIP public API!"
10
+ s.description = "A simple helper for AFIP public API!"
11
+ s.authors = ["gipsh"]
12
+ s.email = 'gipsh@github.com'
13
+ s.files = ["lib/afip-public.rb"]
14
+ s.homepage =
15
+ 'http://rubygems.org/gems/afip-public'
16
+ s.license = 'MIT'
17
+
18
+ s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ s.bindir = "exe"
20
+ s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+
23
+ s.add_dependency 'httparty'
24
+
25
+ s.add_development_dependency "bundler", "~> 1.9.5"
26
+ s.add_development_dependency "rake", "~> 10.0"
27
+ s.add_development_dependency "httparty", "~>0"
28
+
29
+ end
@@ -0,0 +1,135 @@
1
+ require 'afip-public/version'
2
+ require 'httparty'
3
+
4
+ module AfipPublic
5
+
6
+ class AfipPublicService
7
+ include HTTParty
8
+
9
+ api_base = 'https://aws.afip.gov.ar'
10
+
11
+
12
+ base_uri 'https://aws.afip.gov.ar'
13
+ default_timeout 1 # hard timeout after 1 second
14
+
15
+ def initialize()
16
+ @options = { }
17
+ end
18
+
19
+ def handle_timeouts
20
+ begin
21
+ yield
22
+ rescue Net::OpenTimeout, Net::ReadTimeout
23
+ {}
24
+ end
25
+ end
26
+
27
+
28
+ end
29
+
30
+ class Padron < AfipPublicService
31
+
32
+ def base_path
33
+ "/sr-padron/"
34
+ end
35
+
36
+ def get_persona(cuit)
37
+ handle_timeouts do
38
+ self.class.get("#{ base_path }v2/persona/#{ cuit }", @options)
39
+ end
40
+ end
41
+
42
+ def get_personas(dni)
43
+ handle_timeouts do
44
+ self.class.get("#{ base_path }v2/personas/#{ dni }", @options)
45
+ end
46
+ end
47
+
48
+ def get_constancia(cuit)
49
+ handle_timeouts do
50
+ self.class.get("#{ base_path }v1/constancia/#{ cuit }", @options)
51
+ end
52
+ end
53
+
54
+ end
55
+
56
+
57
+ class Vencimiento < AfipPublicService
58
+
59
+
60
+ def base_path
61
+ "/av/v1/vencimientos/"
62
+ end
63
+
64
+ def get_vencimientos(cuit)
65
+ handle_timeouts do
66
+ self.class.get("#{ base_path }#{ cuit }", @options)
67
+ end
68
+ end
69
+
70
+ def get_personas(id_impuesto, cuit)
71
+ handle_timeouts do
72
+ self.class.get("#{ base_path }#{ id_impuesto }/#{ cuit }", @options)
73
+ end
74
+ end
75
+
76
+ end
77
+
78
+
79
+ class Parametros < AfipPublicService
80
+
81
+ def base_path
82
+ "/parametros/v1/"
83
+ end
84
+
85
+ def get_impuestos()
86
+ handle_timeouts do
87
+ self.class.get("#{ base_path }impuestos", @options)
88
+ end
89
+ end
90
+
91
+ def get_conceptos()
92
+ handle_timeouts do
93
+ self.class.get("#{ base_path }conceptos", @options)
94
+ end
95
+ end
96
+
97
+ def get_caracterizaciones()
98
+ handle_timeouts do
99
+ self.class.get("#{ base_path }caracterizaciones", @options)
100
+ end
101
+ end
102
+
103
+
104
+ def get_categorias_monotributo()
105
+ handle_timeouts do
106
+ self.class.get("#{ base_path }categoriasMonotributo", @options)
107
+ end
108
+ end
109
+
110
+ def get_categorias_autonomo()
111
+ handle_timeouts do
112
+ self.class.get("#{ base_path }categoriasAutonomo", @options)
113
+ end
114
+ end
115
+
116
+ def get_actividades()
117
+ handle_timeouts do
118
+ self.class.get("#{ base_path }actividades", @options)
119
+ end
120
+ end
121
+
122
+ def get_provincias()
123
+ handle_timeouts do
124
+ self.class.get("#{ base_path }provincias", @options)
125
+ end
126
+ end
127
+
128
+ def get_dependencias()
129
+ handle_timeouts do
130
+ self.class.get("#{ base_path }dependencias", @options)
131
+ end
132
+ end
133
+
134
+ end
135
+ end
@@ -0,0 +1,3 @@
1
+ module AfipPublic
2
+ VERSION = "0.0.2"
3
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: afip-public
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - gipsh
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-06-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.9.5
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.9.5
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: httparty
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: A simple helper for AFIP public API!
70
+ email: gipsh@github.com
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - LICENSE
76
+ - README.md
77
+ - Rakefile
78
+ - afippublic.gemspec
79
+ - lib/afip_public.rb
80
+ - lib/afip_public/version.rb
81
+ homepage: http://rubygems.org/gems/afip-public
82
+ licenses:
83
+ - MIT
84
+ metadata: {}
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 2.5.1
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: A simple helper for AFIP public API!
105
+ test_files: []