wolf_core 1.0.3 → 1.0.5
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:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: c0e3cc6599cc90e949b7d9ddde2cfa15bc9f63dcbd380ca5e5f2ee4acc8a0756
         | 
| 4 | 
            +
              data.tar.gz: ac1c8315bbf24077e387eef1c6ff0dfc9cf007dc6d98e91c6d677fc99bbe4ff5
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 74ea58ec0cdeaa230ce9778c5960e445504e7f18f985cb9eca85c0772da1753caeba672f141b800aaf3ecc2a5c59f4acc3192e8710de04ef1a189a6ba6686db6
         | 
| 7 | 
            +
              data.tar.gz: f560892556880ba27792590fee58502125488f15dc98e85719bf2a90179105ff593e38e7af965a50dd53f44645fc14c31147572564345a40317eee6397c1bf2b
         | 
| @@ -5,39 +5,40 @@ module WolfCore | |
| 5 5 |  | 
| 6 6 | 
             
                  def fetch_jobseeker!(wolf_token:, jobseeker_id:, tenant:, wolf_platform_url:, error_message:)
         | 
| 7 7 | 
             
                    response = safe_http_get(
         | 
| 8 | 
            -
                      headers: {  | 
| 8 | 
            +
                      headers: { "Authorization" => "Bearer #{wolf_token}" },
         | 
| 9 9 | 
             
                      url: "#{wolf_platform_url}/api/v2/jobseekers/#{jobseeker_id}",
         | 
| 10 10 | 
             
                      query: { tenant: tenant },
         | 
| 11 | 
            -
                      error_message: error_message | 
| 11 | 
            +
                      error_message: error_message
         | 
| 12 12 | 
             
                    )
         | 
| 13 13 | 
             
                    response_body = response.body
         | 
| 14 | 
            -
                    response_body.dig( | 
| 14 | 
            +
                    response_body.dig("data", "table", "jobseeker")
         | 
| 15 15 | 
             
                  end
         | 
| 16 16 |  | 
| 17 17 | 
             
                  def fetch_jobseeker(wolf_token:, jobseeker_id:, tenant:, wolf_platform_url:)
         | 
| 18 | 
            -
                    response =  | 
| 19 | 
            -
                      headers: {  | 
| 18 | 
            +
                    response = parsed_http_get(
         | 
| 19 | 
            +
                      headers: { "Authorization" => "Bearer #{wolf_token}" },
         | 
| 20 20 | 
             
                      url: "#{wolf_platform_url}/api/v2/jobseekers/#{jobseeker_id}",
         | 
| 21 | 
            -
                      query: { tenant: tenant } | 
| 21 | 
            +
                      query: { tenant: tenant }
         | 
| 22 22 | 
             
                    )
         | 
| 23 23 | 
             
                    response_body = response.body
         | 
| 24 24 | 
             
                    return unless response_body.instance_of?(Hash)
         | 
| 25 | 
            -
             | 
| 25 | 
            +
             | 
| 26 | 
            +
                    response_body.dig("data", "table", "jobseeker")
         | 
| 26 27 | 
             
                  end
         | 
| 27 28 |  | 
| 28 29 | 
             
                  def create_jobseeker!(wolf_token:, jobseeker:, tenant:, wolf_platform_url:, error_message:)
         | 
| 29 30 | 
             
                    safe_http_post(
         | 
| 30 | 
            -
                      headers: {  | 
| 31 | 
            +
                      headers: { "Authorization" => "Bearer #{wolf_token}" },
         | 
| 31 32 | 
             
                      query: { tenant: tenant },
         | 
| 32 33 | 
             
                      url: "#{wolf_platform_url}/api/v2/jobseekers",
         | 
| 33 34 | 
             
                      body: jobseeker,
         | 
| 34 | 
            -
                      error_message: error_message | 
| 35 | 
            +
                      error_message: error_message
         | 
| 35 36 | 
             
                    )
         | 
| 36 37 | 
             
                  end
         | 
| 37 38 |  | 
| 38 39 | 
             
                  def create_jobseeker(wolf_token:, jobseeker:, tenant:, wolf_platform_url:)
         | 
| 39 | 
            -
                     | 
| 40 | 
            -
                      headers: {  | 
| 40 | 
            +
                    parsed_http_post(
         | 
| 41 | 
            +
                      headers: { "Authorization" => "Bearer #{wolf_token}" },
         | 
| 41 42 | 
             
                      query: { tenant: tenant },
         | 
| 42 43 | 
             
                      url: "#{wolf_platform_url}/api/v2/jobseekers",
         | 
| 43 44 | 
             
                      body: jobseeker
         | 
| @@ -46,17 +47,17 @@ module WolfCore | |
| 46 47 |  | 
| 47 48 | 
             
                  def update_jobseeker!(wolf_token:, jobseeker:, tenant:, wolf_platform_url:, error_message:, jobseeker_id:)
         | 
| 48 49 | 
             
                    safe_http_put(
         | 
| 49 | 
            -
                      headers: {  | 
| 50 | 
            +
                      headers: { "Authorization" => "Bearer #{wolf_token}" },
         | 
| 50 51 | 
             
                      query: { tenant: tenant },
         | 
| 51 52 | 
             
                      url: "#{wolf_platform_url}/api/v2/jobseekers/#{jobseeker_id}",
         | 
| 52 53 | 
             
                      body: jobseeker,
         | 
| 53 | 
            -
                      error_message: error_message | 
| 54 | 
            +
                      error_message: error_message
         | 
| 54 55 | 
             
                    )
         | 
| 55 56 | 
             
                  end
         | 
| 56 57 |  | 
| 57 58 | 
             
                  def update_jobseeker(wolf_token:, jobseeker:, tenant:, wolf_platform_url:, jobseeker_id:)
         | 
| 58 | 
            -
                     | 
| 59 | 
            -
                      headers: {  | 
| 59 | 
            +
                    parsed_http_put(
         | 
| 60 | 
            +
                      headers: { "Authorization" => "Bearer #{wolf_token}" },
         | 
| 60 61 | 
             
                      query: { tenant: tenant },
         | 
| 61 62 | 
             
                      url: "#{wolf_platform_url}/api/v2/jobseekers/#{jobseeker_id}",
         | 
| 62 63 | 
             
                      body: jobseeker
         | 
| @@ -64,4 +65,4 @@ module WolfCore | |
| 64 65 | 
             
                  end
         | 
| 65 66 | 
             
                end
         | 
| 66 67 | 
             
              end
         | 
| 67 | 
            -
            end
         | 
| 68 | 
            +
            end
         | 
| @@ -1,6 +1,7 @@ | |
| 1 1 | 
             
            module WolfCore
         | 
| 2 2 | 
             
              module LambdaFunctionOperations
         | 
| 3 3 | 
             
                include WolfCore::ExceptionOperations
         | 
| 4 | 
            +
                include WolfCore::StringUtils
         | 
| 4 5 |  | 
| 5 6 | 
             
                def invoke_lambda(function_name:, payload:, invocation_type: nil)
         | 
| 6 7 | 
             
                  WolfCore::LambdaFunctionDataSource.invoke(
         | 
| @@ -28,20 +29,12 @@ module WolfCore | |
| 28 29 |  | 
| 29 30 | 
             
                def get_event_params(event)
         | 
| 30 31 | 
             
                  event_body = event['body']
         | 
| 31 | 
            -
                   | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
                def deep_parse_json(input)
         | 
| 36 | 
            -
                  while input.is_a?(String)
         | 
| 37 | 
            -
                    begin
         | 
| 38 | 
            -
                      input = JSON.parse(input)
         | 
| 39 | 
            -
                    rescue JSON::ParserError
         | 
| 40 | 
            -
                      break
         | 
| 41 | 
            -
                    end
         | 
| 32 | 
            +
                  params = if event_body.present?
         | 
| 33 | 
            +
                    deep_parse_json(event_body)
         | 
| 34 | 
            +
                  else
         | 
| 35 | 
            +
                    event
         | 
| 42 36 | 
             
                  end
         | 
| 43 | 
            -
             | 
| 44 | 
            -
                  input&.with_indifferent_access || {}
         | 
| 37 | 
            +
                  params&.with_indifferent_access
         | 
| 45 38 | 
             
                end
         | 
| 46 39 |  | 
| 47 40 | 
             
                def result_to_response(result)
         | 
| @@ -19,5 +19,17 @@ module WolfCore | |
| 19 19 | 
             
                def hash_str_to_json(hash_str)
         | 
| 20 20 | 
             
                  hash_str&.gsub('=>', ':')&.gsub('\"', '"')&.gsub('{', '{')&.gsub('}', '}')&.gsub(/(\w+)(?=\s*:)/) { |key| "\"#{key}\"" }
         | 
| 21 21 | 
             
                end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                def deep_parse_json(input)
         | 
| 24 | 
            +
                  while input.is_a?(String)
         | 
| 25 | 
            +
                    begin
         | 
| 26 | 
            +
                      input = JSON.parse(input)
         | 
| 27 | 
            +
                    rescue JSON::ParserError
         | 
| 28 | 
            +
                      break
         | 
| 29 | 
            +
                    end
         | 
| 30 | 
            +
                  end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                  input || {}
         | 
| 33 | 
            +
                end
         | 
| 22 34 | 
             
              end
         | 
| 23 35 | 
             
            end
         | 
    
        data/lib/wolf_core/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: wolf_core
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0. | 
| 4 | 
            +
              version: 1.0.5
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Javier Roncallo
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024-10- | 
| 11 | 
            +
            date: 2024-10-17 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: httparty
         |