leap_salesforce 1.0.3 → 1.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/.gitlab-ci.yml +4 -14
- data/ChangeLog +14 -0
- data/README.md +15 -2
- data/Rakefile +1 -0
- data/leap_salesforce.gemspec +1 -1
- data/lib/leap_salesforce/ext/string.rb +1 -0
- data/lib/leap_salesforce/generator/exe_helpers.rb +1 -1
- data/lib/leap_salesforce/session.rb +38 -0
- data/lib/leap_salesforce/version.rb +1 -1
- data/lib/leap_salesforce.rb +2 -0
- metadata +8 -7
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 8805308060f18da64cded4e1136a905bea7956eec9d80b251ef573a5afc45641
         | 
| 4 | 
            +
              data.tar.gz: 6cdc409d63208ce8bbae6aaf909007e4c80ac53cabce2326fff5a84fb2c46e15
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: d03e189dfbc7c732dbe2e9e8a0e2ea8373e688ee38fd39fbf84e953807c0be1c0e22829e00c6282e2c8cb8774215f0d2fcf79dd208e929865d1ab61fde5a0e40
         | 
| 7 | 
            +
              data.tar.gz: 45789647e1f9263722875fee80e016551a237df6603c7faecfd28a396934651caf99b8b21a0503642df47b8b0612916c8082ca8b29effcfa5285afc25da15197
         | 
    
        data/.gitlab-ci.yml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            include:
         | 
| 2 2 | 
             
              - template: Code-Quality.gitlab-ci.yml
         | 
| 3 3 |  | 
| 4 | 
            -
            image: ruby: | 
| 4 | 
            +
            image: ruby:3.0
         | 
| 5 5 |  | 
| 6 6 | 
             
            stages:
         | 
| 7 7 | 
             
              - test
         | 
| @@ -18,7 +18,7 @@ variables: | |
| 18 18 | 
             
            pages:
         | 
| 19 19 | 
             
              stage: deploy
         | 
| 20 20 | 
             
              dependencies:
         | 
| 21 | 
            -
                -  | 
| 21 | 
            +
                - test
         | 
| 22 22 | 
             
              script:
         | 
| 23 23 | 
             
                - mv coverage/ public
         | 
| 24 24 | 
             
              artifacts:
         | 
| @@ -612,7 +612,8 @@ pages: | |
| 612 612 | 
             
                sfdx force:auth:jwt:grant --clientid "$SF_CONSUMER_KEY" --jwtkeyfile assets/server.key --username "$SF_USERNAME" --setdefaultdevhubusername --setalias HubOrg
         | 
| 613 613 | 
             
              }
         | 
| 614 614 |  | 
| 615 | 
            -
             | 
| 615 | 
            +
            test:
         | 
| 616 | 
            +
              image: ruby:3.0
         | 
| 616 617 | 
             
              script:
         | 
| 617 618 | 
             
                # Decrypt server key
         | 
| 618 619 | 
             
                - *sfdx_helpers
         | 
| @@ -624,14 +625,3 @@ test_2.7: | |
| 624 625 | 
             
              artifacts:
         | 
| 625 626 | 
             
                paths:
         | 
| 626 627 | 
             
                  - coverage/
         | 
| 627 | 
            -
             | 
| 628 | 
            -
            test_3.0:
         | 
| 629 | 
            -
              image: ruby:3.0
         | 
| 630 | 
            -
              script:
         | 
| 631 | 
            -
                # Decrypt server key
         | 
| 632 | 
            -
                - *sfdx_helpers
         | 
| 633 | 
            -
                - setup_integration_env
         | 
| 634 | 
            -
                - bundle exec rake check_oauth   # Check OAuth
         | 
| 635 | 
            -
                - bundle exec rake leaps:create_soql_objects
         | 
| 636 | 
            -
                - bundle exec rake leaps:create_enums
         | 
| 637 | 
            -
                - bundle exec rspec
         | 
    
        data/ChangeLog
    CHANGED
    
    | @@ -1,3 +1,17 @@ | |
| 1 | 
            +
            Version 1.1.1
         | 
| 2 | 
            +
            * Allow session information from SOAP login to be available with LeapSalesforce::Session class
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            Version 1.1.0
         | 
| 5 | 
            +
            * Proper fix to work with activerecord 7 - requires ruby > 2.7
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            Version 1.0.5
         | 
| 8 | 
            +
            * Fix
         | 
| 9 | 
            +
              * Stabilize using of active record by fixing version
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            Version 1.0.4
         | 
| 12 | 
            +
            * Enhancement
         | 
| 13 | 
            +
              * Strip out ':' from user key for when it is accidentally added
         | 
| 14 | 
            +
             | 
| 1 15 | 
             
            Version 1.0.3
         | 
| 2 16 | 
             
            * Enhancement
         | 
| 3 17 | 
             
              * Allow templates to be sourced from external gems for generator
         | 
    
        data/README.md
    CHANGED
    
    | @@ -27,7 +27,7 @@ The benefits of an open source tool like this are: | |
| 27 27 | 
             
              and can add extra unit tests if you need more confidence
         | 
| 28 28 | 
             
            * Built with and for CI in Gitlab. Designed to work within Docker containers
         | 
| 29 29 | 
             
            * Will integrate with `sfdx` leveraging all of it's benefits
         | 
| 30 | 
            -
            * Supported by [ | 
| 30 | 
            +
            * Supported by [Sentify](https://www.sentify.co/) who can provide 
         | 
| 31 31 | 
             
              [support and training](https://gitlab.com/leap-dojo/leap_salesforce/wikis/SupportModel)
         | 
| 32 32 | 
             
              to help you get started and overcome challenges
         | 
| 33 33 |  | 
| @@ -260,7 +260,19 @@ The value of request body can be interrogated with `entity.request_parameters.bo | |
| 260 260 |  | 
| 261 261 | 
             
            ##### Logging
         | 
| 262 262 |  | 
| 263 | 
            -
            By default, API traffic will be logged in a log file in a `logs` folder. 
         | 
| 263 | 
            +
            By default, API traffic will be logged in a log file in a `logs` folder. The gem `soaspec` is
         | 
| 264 | 
            +
            used to log this traffic. 
         | 
| 265 | 
            +
             | 
| 266 | 
            +
            Following is an example of changing some of the default logging. 
         | 
| 267 | 
            +
             | 
| 268 | 
            +
            ```ruby
         | 
| 269 | 
            +
            # Turn this true if you need debug authentication
         | 
| 270 | 
            +
            Soaspec::OAuth2.debug_oauth = true 
         | 
| 271 | 
            +
            # Turn this to true if you want to see API traffic on the terminal
         | 
| 272 | 
            +
            Soaspec::SpecLogger.output_to_terminal = true 
         | 
| 273 | 
            +
            ```
         | 
| 274 | 
            +
             | 
| 275 | 
            +
            See more configuration parameters in the [Soaspec repo](https://gitlab.com/samuel-garratt/soaspec#logging)
         | 
| 264 276 |  | 
| 265 277 | 
             
            ### CRUD of data
         | 
| 266 278 |  | 
| @@ -565,4 +577,5 @@ Everyone interacting in the LeapSalesforce project’s codebases, issue trackers | |
| 565 577 | 
             
            * Presentation on this library [here](https://gitpitch.com/leap-dojo/leap_salesforce?grs=gitlab)
         | 
| 566 578 | 
             
            * Example of this library within a CI/CD pipeline [here](https://gitlab.com/iqa_public/labs/salesforce_cicd_demo)
         | 
| 567 579 | 
             
            * Using `leap_salesforce` to download event log files [here](https://gitlab.com/samuel-garratt/leap_salesforce_event_log_files)
         | 
| 580 | 
            +
            * Video walking through setting up automation using this [here](https://youtu.be/Xvj0mAnDKfA)
         | 
| 568 581 |  | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/leap_salesforce.gemspec
    CHANGED
    
    | @@ -32,7 +32,7 @@ It reads the Metadata from Salesforce and creates the foundation for API tests.' | |
| 32 32 | 
             
              spec.add_development_dependency 'semaphore_test_boosters'
         | 
| 33 33 | 
             
              spec.add_development_dependency 'topoisomerase'
         | 
| 34 34 | 
             
              spec.add_development_dependency 'yard-doctest'
         | 
| 35 | 
            -
              spec.add_dependency 'activerecord'
         | 
| 35 | 
            +
              spec.add_dependency 'activerecord', '7'
         | 
| 36 36 | 
             
              spec.add_dependency 'colorize'
         | 
| 37 37 | 
             
              spec.add_dependency 'factory_bot'
         | 
| 38 38 | 
             
              spec.add_dependency 'faker', '>= 2.0'
         | 
| @@ -50,7 +50,7 @@ module LeapSalesforce | |
| 50 50 | 
             
                  ' leap_salesforce testing repo'.colorize(:green)
         | 
| 51 51 | 
             
                  verify_environment
         | 
| 52 52 | 
             
                  verify_oauth
         | 
| 53 | 
            -
                  @user_key = options[:user_key] || input_for('Enter a key to refer to this user (This will be stored as a Symbol)')
         | 
| 53 | 
            +
                  @user_key = options[:user_key] || input_for('Enter a key to refer to this user (This will be stored as a Symbol)').delete(':')
         | 
| 54 54 | 
             
                end
         | 
| 55 55 | 
             
              end
         | 
| 56 56 | 
             
            end
         | 
| @@ -0,0 +1,38 @@ | |
| 1 | 
            +
            require_relative 'auth'
         | 
| 2 | 
            +
            require 'savon'
         | 
| 3 | 
            +
            require 'json'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            module LeapSalesforce
         | 
| 6 | 
            +
              # Holds information about a login session
         | 
| 7 | 
            +
              class Session
         | 
| 8 | 
            +
                # @return [String] Session id returned from SOAP API
         | 
| 9 | 
            +
                attr_accessor :session_id
         | 
| 10 | 
            +
                # @return [String] User id returned from SOAP API
         | 
| 11 | 
            +
                attr_accessor :user_id
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                def initialize(username, password)
         | 
| 14 | 
            +
                  login_body = LeapSalesforce::Session.soap_login username, password
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                  self.session_id = login_body[:login_response][:result][:session_id]
         | 
| 17 | 
            +
                  self.user_id = login_body[:login_response][:result][:session_id]
         | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                class << self
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  # Login via SOAP API
         | 
| 23 | 
            +
                  def soap_login(username, password)
         | 
| 24 | 
            +
                    client = Savon.client do
         | 
| 25 | 
            +
                      endpoint "#{SoqlHandler.instance_url}/services/Soap/u/51.0"
         | 
| 26 | 
            +
                      namespace "urn:partner.soap.sforce.com"
         | 
| 27 | 
            +
                    end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                    response = client.call(:login, message:
         | 
| 30 | 
            +
                        {
         | 
| 31 | 
            +
                          username: username,
         | 
| 32 | 
            +
                          password: password
         | 
| 33 | 
            +
                        })
         | 
| 34 | 
            +
                    response.body
         | 
| 35 | 
            +
                  end
         | 
| 36 | 
            +
                end
         | 
| 37 | 
            +
              end
         | 
| 38 | 
            +
            end
         | 
    
        data/lib/leap_salesforce.rb
    CHANGED
    
    | @@ -8,6 +8,7 @@ Soaspec.log_warnings = false            # Log any API warnings | |
| 8 8 | 
             
            Soaspec::SpecLogger.progname = 'Leaps'  # Program name shown in logs
         | 
| 9 9 | 
             
            Soaspec::OAuth2.request_message = false # Don't display message explaining OAuth request
         | 
| 10 10 | 
             
            Soaspec::OAuth2.retry_limit = 1 # Retrying for OAuth token too many times results in user locked out
         | 
| 11 | 
            +
            require 'active_support/isolated_execution_state'
         | 
| 11 12 | 
             
            require 'active_support/core_ext/integer/time' # Creating time objects
         | 
| 12 13 | 
             
            require 'leap_salesforce/parameters' # Important to load this first
         | 
| 13 14 | 
             
            require 'leap_salesforce/ext/string'
         | 
| @@ -18,6 +19,7 @@ require 'factory_bot' # For mass production of data | |
| 18 19 | 
             
            require 'faker' # For fake data
         | 
| 19 20 | 
             
            require 'leap_salesforce/error'
         | 
| 20 21 | 
             
            require 'leap_salesforce/loader'
         | 
| 22 | 
            +
            require 'leap_salesforce/session'
         | 
| 21 23 |  | 
| 22 24 | 
             
            # If variable is present within LeapSalesforce set it
         | 
| 23 25 | 
             
            def load_variables_from(file)
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: leap_salesforce
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.1.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - IQA
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire:
         | 
| 10 10 | 
             
            bindir: exe
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date:  | 
| 12 | 
            +
            date: 2022-02-01 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: bundler
         | 
| @@ -99,16 +99,16 @@ dependencies: | |
| 99 99 | 
             
              name: activerecord
         | 
| 100 100 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 101 101 | 
             
                requirements:
         | 
| 102 | 
            -
                - -  | 
| 102 | 
            +
                - - '='
         | 
| 103 103 | 
             
                  - !ruby/object:Gem::Version
         | 
| 104 | 
            -
                    version: ' | 
| 104 | 
            +
                    version: '7'
         | 
| 105 105 | 
             
              type: :runtime
         | 
| 106 106 | 
             
              prerelease: false
         | 
| 107 107 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 108 108 | 
             
                requirements:
         | 
| 109 | 
            -
                - -  | 
| 109 | 
            +
                - - '='
         | 
| 110 110 | 
             
                  - !ruby/object:Gem::Version
         | 
| 111 | 
            -
                    version: ' | 
| 111 | 
            +
                    version: '7'
         | 
| 112 112 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 113 113 | 
             
              name: colorize
         | 
| 114 114 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -333,6 +333,7 @@ files: | |
| 333 333 | 
             
            - lib/leap_salesforce/rake.rb
         | 
| 334 334 | 
             
            - lib/leap_salesforce/rake/setup.rake
         | 
| 335 335 | 
             
            - lib/leap_salesforce/rake/sfdx.rake
         | 
| 336 | 
            +
            - lib/leap_salesforce/session.rb
         | 
| 336 337 | 
             
            - lib/leap_salesforce/soql_data/common_enum_methods.rb
         | 
| 337 338 | 
             
            - lib/leap_salesforce/soql_data/data_relationships.rb
         | 
| 338 339 | 
             
            - lib/leap_salesforce/soql_data/meta_data_handler.rb
         | 
| @@ -370,7 +371,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 370 371 | 
             
                - !ruby/object:Gem::Version
         | 
| 371 372 | 
             
                  version: '0'
         | 
| 372 373 | 
             
            requirements: []
         | 
| 373 | 
            -
            rubygems_version: 3. | 
| 374 | 
            +
            rubygems_version: 3.2.3
         | 
| 374 375 | 
             
            signing_key:
         | 
| 375 376 | 
             
            specification_version: 4
         | 
| 376 377 | 
             
            summary: Helps with setting up integrated automated test frameworks against Salesforce.
         |