padron 0.2.0 → 0.2.1
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 +4 -4
- data/lib/padron/call.rb +28 -15
- data/lib/padron/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 2582262bf24c4cd82eed2d8a47a648a2b43d07cdead43acc29b3ff8c7e9e3c12
         | 
| 4 | 
            +
              data.tar.gz: 0647bf1162aa5a768c5a00e9300f237a6afd50aa11cf1cc7487fbad21d44c5cf
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4fc1d07a373558809fe1b5a795444421ce4f59d43492a5400d17ddf1fe782a2c379e43a502a3bc50830a3b3d77d80a097516d7c7ccea5c8955159ea96c359da4
         | 
| 7 | 
            +
              data.tar.gz: c2666a4196664eec76f7d70a1f21b5792bae2b789d9c7b753097bcffb9e1b18f32ff646d1daf53dc6d99766e679f9b603fc95ccc9c9251d13b7b527094045e68
         | 
    
        data/lib/padron/call.rb
    CHANGED
    
    | @@ -64,24 +64,37 @@ module Padron | |
| 64 64 |  | 
| 65 65 | 
             
            	  		def set_data
         | 
| 66 66 | 
             
            	  			personas = data.body[:get_persona_list_response][:persona_list_return][:persona]
         | 
| 67 | 
            -
            	  			personas. | 
| 68 | 
            -
            	  				 | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            -
             | 
| 72 | 
            -
             | 
| 73 | 
            -
             | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 78 | 
            -
            				  			:city 			=> Padron::PROVINCIAS[persona[:datos_generales].try(:[],:domicilio_fiscal).try(:[], :id_provincia)],
         | 
| 79 | 
            -
            				  			:locality 		=> persona[:datos_generales].try(:[], :domicilio_fiscal).try(:[], :localidad)}
         | 
| 80 | 
            -
            				  		end
         | 
| 81 | 
            -
            				  	end
         | 
| 67 | 
            +
            	  			if personas.is_a? Array
         | 
| 68 | 
            +
            	  				set_multiple(personas)
         | 
| 69 | 
            +
            	  			else 
         | 
| 70 | 
            +
            	  				set_single(personas)
         | 
| 71 | 
            +
            	  			end
         | 
| 72 | 
            +
            	  			
         | 
| 73 | 
            +
            		  	end
         | 
| 74 | 
            +
             | 
| 75 | 
            +
            		  	def set_multiple(personas)
         | 
| 76 | 
            +
            		  		personas.map do |persona|
         | 
| 77 | 
            +
            	  				set_single(persona)
         | 
| 82 78 | 
             
            				end
         | 
| 83 79 | 
             
            		  	end
         | 
| 84 80 |  | 
| 81 | 
            +
            		  	def set_single(persona)
         | 
| 82 | 
            +
            		  		unless persona[:error_constancia] && persona[:error_constancia].try(:[],:apellido).nil?
         | 
| 83 | 
            +
            	  				if !persona[:error_constancia].nil?
         | 
| 84 | 
            +
            				  		{:name 			=> set_name(persona[:error_constancia]),
         | 
| 85 | 
            +
            			  			:cuit 			=> persona[:error_constancia][:id_persona]}
         | 
| 86 | 
            +
            			  		else
         | 
| 87 | 
            +
            				  		{:name 			=> set_name(persona[:datos_generales]),
         | 
| 88 | 
            +
            			  			:cuit 			=> persona[:datos_generales][:id_persona],
         | 
| 89 | 
            +
            			  			:cp 			=> persona[:datos_generales].try(:[], :domicilio_fiscal).try(:[], :cod_postal),
         | 
| 90 | 
            +
            			  			:address 		=> persona[:datos_generales].try(:[], :domicilio_fiscal).try(:[], :direccion),
         | 
| 91 | 
            +
            			  			:city_id 		=> persona[:datos_generales].try(:[], :domicilio_fiscal).try(:[], :id_provincia),
         | 
| 92 | 
            +
            			  			:city 			=> Padron::PROVINCIAS[persona[:datos_generales].try(:[],:domicilio_fiscal).try(:[], :id_provincia)],
         | 
| 93 | 
            +
            			  			:locality 		=> persona[:datos_generales].try(:[], :domicilio_fiscal).try(:[], :localidad)}
         | 
| 94 | 
            +
            			  		end
         | 
| 95 | 
            +
            			  	end
         | 
| 96 | 
            +
            		  	end
         | 
| 97 | 
            +
             | 
| 85 98 | 
             
            	  		def set_name(persona)
         | 
| 86 99 | 
             
            	  			return "#{persona.try(:[], :nombre)} #{persona.try(:[], :apellido)}"
         | 
| 87 100 | 
             
            	  		end
         | 
    
        data/lib/padron/version.rb
    CHANGED