ruby-experian 0.1.0 → 0.1.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/.env.test +0 -0
- data/Gemfile.lock +1 -1
- data/README.md +25 -3
- data/bin/console +1 -0
- data/lib/experian/trade_report.rb +38 -0
- data/lib/experian/version.rb +1 -1
- data/lib/experian.rb +2 -2
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 49f72214cb1be783e88337a4252fe8f43bae3094264009d8cb320ff6d16af3f6
         | 
| 4 | 
            +
              data.tar.gz: f960aa5170a197c7094d69ec4249ce789197e835183cdd8b1f2182d84732e2ee
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 2a04cc506991c122892e4c53fc298cf9dfb710a993b426e3b5f225a624b45a2c785cb3eb719980355e0e0cbc3e41c329afe65d2946b78d3c61b81d5557b188e2
         | 
| 7 | 
            +
              data.tar.gz: 68b312e16f9125b563cb862521b6473d135b610d5f95dd9620075fb46036e41acedd1d7af102e1d5c07eeaa79e5473f023f3040a82b0bd653aac38092a7657b9
         | 
    
        data/.env.test
    ADDED
    
    | 
            File without changes
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -61,6 +61,8 @@ Experian.configure do |config| | |
| 61 61 | 
             
            end
         | 
| 62 62 | 
             
            ```
         | 
| 63 63 |  | 
| 64 | 
            +
            By default, this gem will look for the environment variables `EXPERIAN_USER_CODE` and `EXPERIAN_PASSWORD` to set the default values for user code and password.
         | 
| 65 | 
            +
             | 
| 64 66 | 
             
            Then you can create a client like this:
         | 
| 65 67 |  | 
| 66 68 | 
             
            ```ruby
         | 
| @@ -122,9 +124,9 @@ You can further configure the faraday connection by passing in a block to the cl | |
| 122 124 | 
             
              end
         | 
| 123 125 | 
             
            ```
         | 
| 124 126 |  | 
| 125 | 
            -
            ### Report
         | 
| 127 | 
            +
            ### Credit Report
         | 
| 126 128 |  | 
| 127 | 
            -
            You can hit the report api to get the 360 credit report from Experian by passing in a CIF to the call. Note that only some sections of the report are exposed. Other sections will be exposed as needed / requested.
         | 
| 129 | 
            +
            You can hit the credit report api to get the 360 credit report from Experian by passing in a CIF to the call. Note that only some sections of the report are exposed. Other sections will be exposed as needed / requested.
         | 
| 128 130 |  | 
| 129 131 | 
             
            The exposed sections for now are:
         | 
| 130 132 |  | 
| @@ -133,9 +135,29 @@ The exposed sections for now are: | |
| 133 135 | 
             
            - rating
         | 
| 134 136 | 
             
            - number_of_employees
         | 
| 135 137 | 
             
            - cnae
         | 
| 138 | 
            +
            - constitution_date
         | 
| 139 | 
            +
             | 
| 140 | 
            +
            ```ruby
         | 
| 141 | 
            +
            report = client.credit_report(cif: "cif goes here")
         | 
| 142 | 
            +
            report.rating.inspect
         | 
| 143 | 
            +
            # => "#<OpenStruct score=8, default_probability=0.529, risk=\"Mínimo\", size=\"Grande\">"
         | 
| 144 | 
            +
            ```
         | 
| 145 | 
            +
             | 
| 146 | 
            +
            ### Trade Report
         | 
| 147 | 
            +
             | 
| 148 | 
            +
            You can hit the trade report api to get the 360 trade report from Experian by passing in a CIF to the call. Note that only some sections of the report are exposed. Other sections will be exposed as needed / requested.
         | 
| 149 | 
            +
             | 
| 150 | 
            +
            The exposed sections for now are:
         | 
| 151 | 
            +
             | 
| 152 | 
            +
            - model_200(period:)
         | 
| 153 | 
            +
            - address
         | 
| 154 | 
            +
            - rating
         | 
| 155 | 
            +
            - most_recent_number_of_employees
         | 
| 156 | 
            +
            - cnae
         | 
| 157 | 
            +
            - constitution_date
         | 
| 136 158 |  | 
| 137 159 | 
             
            ```ruby
         | 
| 138 | 
            -
            report = client. | 
| 160 | 
            +
            report = client.trade_report(cif: "cif goes here")
         | 
| 139 161 | 
             
            report.rating.inspect
         | 
| 140 162 | 
             
            # => "#<OpenStruct score=8, default_probability=0.529, risk=\"Mínimo\", size=\"Grande\">"
         | 
| 141 163 | 
             
            ```
         | 
    
        data/bin/console
    CHANGED
    
    
| @@ -38,6 +38,44 @@ module Experian | |
| 38 38 | 
             
                  }
         | 
| 39 39 | 
             
                end
         | 
| 40 40 |  | 
| 41 | 
            +
                def constitution_date
         | 
| 42 | 
            +
                  date = data.dig("SeccionDatosRegistrales", "FechaConstitucion")
         | 
| 43 | 
            +
                  date && Date.parse(date)
         | 
| 44 | 
            +
                end
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                def address
         | 
| 47 | 
            +
                  if (address_xml = data["SeccionDatosRegistrales"]["DomicilioSocial"])
         | 
| 48 | 
            +
                    OpenStruct.new(
         | 
| 49 | 
            +
                      line: address_xml["Domicilio"],
         | 
| 50 | 
            +
                      city: address_xml["Poblacion"] || address_xml["Provincia"],
         | 
| 51 | 
            +
                      province: address_xml["Provincia"],
         | 
| 52 | 
            +
                      postal_code: address_xml["CodigoPostal"],
         | 
| 53 | 
            +
                      municipality: address_xml["Municipio"],
         | 
| 54 | 
            +
                    )
         | 
| 55 | 
            +
                  end
         | 
| 56 | 
            +
                end
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                def most_recent_number_of_employees
         | 
| 59 | 
            +
                  data.dig("ListaAnualEmpleados", "Empleado").first&.dig("EmpleadoFijo")&.to_i
         | 
| 60 | 
            +
                end
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                def cnae
         | 
| 63 | 
            +
                  data.dig("ActividadComercial", "Cnae")&.first&.dig("Codigo")&.to_i
         | 
| 64 | 
            +
                end
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                def rating
         | 
| 67 | 
            +
                  if (rating_xml = data["Rating"])
         | 
| 68 | 
            +
                    return unless rating_xml["RatingAxesorDef"]
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                    OpenStruct.new(
         | 
| 71 | 
            +
                      score: rating_xml["RatingAxesorDef"]&.strip&.to_i,
         | 
| 72 | 
            +
                      default_probability: rating_xml["ProbImpago"]&.to_f,
         | 
| 73 | 
            +
                      risk: rating_xml["GrupoRiesgo"],
         | 
| 74 | 
            +
                      size: rating_xml["Tamaño"],
         | 
| 75 | 
            +
                    )
         | 
| 76 | 
            +
                  end
         | 
| 77 | 
            +
                end
         | 
| 78 | 
            +
             | 
| 41 79 | 
             
                private
         | 
| 42 80 |  | 
| 43 81 | 
             
                def last_submitted_year
         | 
    
        data/lib/experian/version.rb
    CHANGED
    
    
    
        data/lib/experian.rb
    CHANGED
    
    | @@ -21,8 +21,8 @@ module Experian | |
| 21 21 | 
             
                DEFAULT_REQUEST_TIMEOUT = 120
         | 
| 22 22 |  | 
| 23 23 | 
             
                def initialize
         | 
| 24 | 
            -
                  @user_code = nil
         | 
| 25 | 
            -
                  @password = nil
         | 
| 24 | 
            +
                  @user_code = ENV.fetch("EXPERIAN_USER_CODE", nil)
         | 
| 25 | 
            +
                  @password = ENV.fetch("EXPERIAN_PASSWORD", nil)
         | 
| 26 26 | 
             
                  @version = DEFAULT_VERSION
         | 
| 27 27 | 
             
                  @request_timeout = DEFAULT_REQUEST_TIMEOUT
         | 
| 28 28 | 
             
                  @base_uri = DEFAULT_BASE_URI
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: ruby-experian
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Martin Mochetti
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024- | 
| 11 | 
            +
            date: 2024-06-12 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: faraday
         | 
| @@ -75,6 +75,7 @@ executables: | |
| 75 75 | 
             
            extensions: []
         | 
| 76 76 | 
             
            extra_rdoc_files: []
         | 
| 77 77 | 
             
            files:
         | 
| 78 | 
            +
            - ".env.test"
         | 
| 78 79 | 
             
            - ".github/dependabot.yml"
         | 
| 79 80 | 
             
            - ".github/pull_request_template.md"
         | 
| 80 81 | 
             
            - ".github/workflows/tests.yml"
         |