leap_salesforce 0.1.9 → 0.1.11
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/.idea/leap-salesforce.iml +1 -1
- data/.leap_salesforce.yml +1 -0
- data/ChangeLog +11 -0
- data/Rakefile +6 -1
- data/leap_salesforce.gemspec +1 -1
- data/lib/leap_salesforce/ext/string.rb +11 -0
- data/lib/leap_salesforce/generator/exe_helpers.rb +1 -6
- data/lib/leap_salesforce/generator/templates/Rakefile.erb +6 -1
- data/lib/leap_salesforce/parameters.rb +12 -0
- data/lib/leap_salesforce/soql_data/soql_data.rb +12 -0
- data/lib/leap_salesforce/version.rb +1 -1
- data/lib/leap_salesforce.rb +1 -0
- metadata +4 -4
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 0643c6bdb99cf5d5ab3c1daa4993be2d57405e8beca02b4554188b260cf35c38
         | 
| 4 | 
            +
              data.tar.gz: 2aadf0ffb313f32e35280794de1a182ca3e9567b1753c878493ac24180069658
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4af203c910c8aaf8c3b9322c72e26010a45cbb3b4a60b594584537f2f934038a12dde800cb58ba600392d676aa6b46970c3747094daf91774d76e80917fe27f6
         | 
| 7 | 
            +
              data.tar.gz: 07f636197ce307d8390b694317ddcfec9e8dadf56277650b124b93f1646210d17850ea8a5b070f91fd6418911f69d2ca266ff943f03874bba5a8216fae202306
         | 
    
        data/.idea/leap-salesforce.iml
    CHANGED
    
    | @@ -67,7 +67,7 @@ | |
| 67 67 | 
             
                <orderEntry type="library" scope="PROVIDED" name="sinatra (v2.0.4, RVM: ruby-2.6.0) [gem]" level="application" />
         | 
| 68 68 | 
             
                <orderEntry type="library" scope="PROVIDED" name="sinatra-basic-auth (v0.1.0, RVM: ruby-2.6.0) [gem]" level="application" />
         | 
| 69 69 | 
             
                <orderEntry type="library" scope="PROVIDED" name="sinatra-docdsl (v0.8.6, RVM: ruby-2.6.0) [gem]" level="application" />
         | 
| 70 | 
            -
                <orderEntry type="library" scope="PROVIDED" name="soaspec (v0.2. | 
| 70 | 
            +
                <orderEntry type="library" scope="PROVIDED" name="soaspec (v0.2.28, RVM: ruby-2.6.0) [gem]" level="application" />
         | 
| 71 71 | 
             
                <orderEntry type="library" scope="PROVIDED" name="socksify (v1.7.1, RVM: ruby-2.6.0) [gem]" level="application" />
         | 
| 72 72 | 
             
                <orderEntry type="library" scope="PROVIDED" name="thor (v0.20.3, RVM: ruby-2.6.0) [gem]" level="application" />
         | 
| 73 73 | 
             
                <orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, RVM: ruby-2.6.0) [gem]" level="application" />
         | 
    
        data/.leap_salesforce.yml
    CHANGED
    
    
    
        data/ChangeLog
    CHANGED
    
    | @@ -1,3 +1,14 @@ | |
| 1 | 
            +
            Version 0.1.11
         | 
| 2 | 
            +
            * Enhancements
         | 
| 3 | 
            +
              * Set retry limit to 0 for OAuth as retrying too many times causes user to be locked
         | 
| 4 | 
            +
              * Have OAuth verify task as preliminary check before running tests
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            Version 0.1.10
         | 
| 7 | 
            +
            * Enhancements
         | 
| 8 | 
            +
              * Remove underscores from start of method name if more than 1 char long
         | 
| 9 | 
            +
            * Bug Fix
         | 
| 10 | 
            +
              * Fixed where only special character resulted in value resulted in exception thrown
         | 
| 11 | 
            +
             | 
| 1 12 | 
             
            Version 0.1.9
         | 
| 2 13 | 
             
            * Enhancements
         | 
| 3 14 | 
             
              * Updated logs handling so that the user used for API is not unnecessarily repeated
         | 
    
        data/Rakefile
    CHANGED
    
    | @@ -10,7 +10,12 @@ CLEAN.include 'tmp/*' | |
| 10 10 |  | 
| 11 11 | 
             
            RSpec::Core::RakeTask.new(:spec)
         | 
| 12 12 |  | 
| 13 | 
            -
             | 
| 13 | 
            +
            desc 'Check Salesforce OAuth2 authentication is working'
         | 
| 14 | 
            +
            task :check_oauth do
         | 
| 15 | 
            +
              LeapSalesforce.oauth_working?
         | 
| 16 | 
            +
            end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            task default: %i[clean check_oauth spec]
         | 
| 14 19 |  | 
| 15 20 | 
             
            require 'leap_salesforce'
         | 
| 16 21 |  | 
    
        data/leap_salesforce.gemspec
    CHANGED
    
    | @@ -39,6 +39,6 @@ It reads the Metadata from Salesforce and creates the foundation for API tests.' | |
| 39 39 | 
             
              spec.add_dependency 'require_all'
         | 
| 40 40 | 
             
              spec.add_dependency 'rubocop'
         | 
| 41 41 | 
             
              spec.add_dependency 'rubykeyword'
         | 
| 42 | 
            -
              spec.add_dependency 'soaspec', '>= 0.2. | 
| 42 | 
            +
              spec.add_dependency 'soaspec', '>= 0.2.28'
         | 
| 43 43 | 
             
              spec.add_dependency 'thor'
         | 
| 44 44 | 
             
            end
         | 
| @@ -15,9 +15,20 @@ class String | |
| 15 15 | 
             
                              .remove_macrons
         | 
| 16 16 | 
             
                              .gsub(/[\s]+/, '_')
         | 
| 17 17 | 
             
                              .gsub(/[\W]/, '') # Remove any other special characters
         | 
| 18 | 
            +
                              .handle_initial_characters # Previous step could have removed all characters
         | 
| 18 19 | 
             
                              .humanize_numbered_string
         | 
| 19 20 | 
             
              end
         | 
| 20 21 |  | 
| 22 | 
            +
              # @return [String] If all characters were stripped out, put a placeholder 'X'. If starts with underscore remove it
         | 
| 23 | 
            +
              def handle_initial_characters
         | 
| 24 | 
            +
                if size.zero?
         | 
| 25 | 
            +
                  +'X'
         | 
| 26 | 
            +
                else
         | 
| 27 | 
            +
                  self[0] = '' if self[0] == '_'
         | 
| 28 | 
            +
                  self
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
              end
         | 
| 31 | 
            +
             | 
| 21 32 | 
             
              # @return [String] Convert String to form a class could use
         | 
| 22 33 | 
             
              def to_class_name
         | 
| 23 34 | 
             
                camelize.to_ruby_friendly.tr('_', '').camelize
         | 
| @@ -43,12 +43,7 @@ module LeapSalesforce | |
| 43 43 | 
             
            ' vary according to environment (e.g., test.user@<%= LeapSalesforce.environment %>.my.company.com)')
         | 
| 44 44 | 
             
                  LeapSalesforce.password = options[:password] || STDIN.getpass('Password (Recommendation is that 1 password' \
         | 
| 45 45 | 
             
            ' be shared across all test users to be easier to manage):')
         | 
| 46 | 
            -
                   | 
| 47 | 
            -
                  Soaspec::OAuth2.new(LeapSalesforce.oauth_settings).access_token
         | 
| 48 | 
            -
                rescue StandardError
         | 
| 49 | 
            -
                  raise LeapSalesforce::SetupError, "Cannot perform OAuth. See 'logs' folder for details of what was sent"
         | 
| 50 | 
            -
                else
         | 
| 51 | 
            -
                  puts "\u2713 OAuth successful".colorize :green
         | 
| 46 | 
            +
                  LeapSalesforce.oauth_working?
         | 
| 52 47 | 
             
                end
         | 
| 53 48 |  | 
| 54 49 | 
             
                # Ask user to enter parameters specific to their Salesforce environment
         | 
| @@ -3,6 +3,11 @@ require 'leap_salesforce/rake' | |
| 3 3 |  | 
| 4 4 | 
             
            RSpec::Core::RakeTask.new(:spec)
         | 
| 5 5 |  | 
| 6 | 
            -
             | 
| 6 | 
            +
            desc 'Check Salesforce OAuth2 authentication is working'
         | 
| 7 | 
            +
            task :check_oauth do
         | 
| 8 | 
            +
              LeapSalesforce.oauth_working?
         | 
| 9 | 
            +
            end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            task default: %i[check_oauth spec]
         | 
| 7 12 |  | 
| 8 13 | 
             
            require 'leap_salesforce'
         | 
| @@ -20,6 +20,18 @@ module LeapSalesforce | |
| 20 20 | 
             
                  ENV['LEAP_ENV'] || @environment
         | 
| 21 21 | 
             
                end
         | 
| 22 22 |  | 
| 23 | 
            +
                # @return [TrueClass] If OAuth authentication is working, return true. Otherwise raise exception
         | 
| 24 | 
            +
                def oauth_working?
         | 
| 25 | 
            +
                  Soaspec::OAuth2.debug_oauth = true
         | 
| 26 | 
            +
                  Soaspec::OAuth2.new(LeapSalesforce.oauth_settings).access_token
         | 
| 27 | 
            +
                rescue StandardError
         | 
| 28 | 
            +
                  raise LeapSalesforce::SetupError, "Cannot perform OAuth. See 'logs' folder for details of what was sent"
         | 
| 29 | 
            +
                else
         | 
| 30 | 
            +
                  puts "\u2713 OAuth successful".colorize :green
         | 
| 31 | 
            +
                  Soaspec::OAuth2.debug_oauth = false
         | 
| 32 | 
            +
                  true
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
             | 
| 23 35 | 
             
                # @return [Hash] OAuth2 parameters used in connecting to salesforce
         | 
| 24 36 | 
             
                def oauth_settings
         | 
| 25 37 | 
             
                  settings = {
         | 
| @@ -116,6 +116,18 @@ class SoqlData < Exchange | |
| 116 116 | 
             
                values_from_path('$..Id')
         | 
| 117 117 | 
             
              end
         | 
| 118 118 |  | 
| 119 | 
            +
              # Add the passed in file as an attachment to the object
         | 
| 120 | 
            +
              def attach(filename)
         | 
| 121 | 
            +
                unless defined? Attachment
         | 
| 122 | 
            +
                  raise LeapSalesforce::SetupError, 'Attachment not defined. ' \
         | 
| 123 | 
            +
                  "Add to '.leap_salesforce.yml' to use this"
         | 
| 124 | 
            +
                end
         | 
| 125 | 
            +
                raise LeapSalesforce::Error, "Filename #{filename} does not exist" unless File.exist? filename
         | 
| 126 | 
            +
             | 
| 127 | 
            +
                FactoryBot.create(:attachment, ParentId: id, Name: File.split(filename).last,
         | 
| 128 | 
            +
                                               body: Base64.encode64(File.read(filename)))
         | 
| 129 | 
            +
              end
         | 
| 130 | 
            +
             | 
| 119 131 | 
             
              # Set a parameter request in the request body.
         | 
| 120 132 | 
             
              # Can be used to build a request over several steps (e.g Cucumber)
         | 
| 121 133 | 
             
              # Will be used with FactoryBot
         | 
    
        data/lib/leap_salesforce.rb
    CHANGED
    
    | @@ -6,6 +6,7 @@ require 'soaspec' | |
| 6 6 | 
             
            Soaspec::OAuth2.refresh_token = :once # Save access token and reuse it
         | 
| 7 7 | 
             
            Soaspec.log_warnings = false # Log any API warnings
         | 
| 8 8 | 
             
            Soaspec::OAuth2.request_message = false
         | 
| 9 | 
            +
            Soaspec::OAuth2.retry_limit = 0 # Retrying for OAuth token results in error
         | 
| 9 10 | 
             
            require 'active_support/core_ext/integer/time' # Creating time objects
         | 
| 10 11 | 
             
            require 'leap_salesforce/parameters'
         | 
| 11 12 | 
             
            require 'leap_salesforce/ext/string'
         | 
    
        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: 0.1. | 
| 4 | 
            +
              version: 0.1.11
         | 
| 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: 2019-07- | 
| 12 | 
            +
            date: 2019-07-28 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: bundler
         | 
| @@ -199,14 +199,14 @@ dependencies: | |
| 199 199 | 
             
                requirements:
         | 
| 200 200 | 
             
                - - ">="
         | 
| 201 201 | 
             
                  - !ruby/object:Gem::Version
         | 
| 202 | 
            -
                    version: 0.2. | 
| 202 | 
            +
                    version: 0.2.28
         | 
| 203 203 | 
             
              type: :runtime
         | 
| 204 204 | 
             
              prerelease: false
         | 
| 205 205 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 206 206 | 
             
                requirements:
         | 
| 207 207 | 
             
                - - ">="
         | 
| 208 208 | 
             
                  - !ruby/object:Gem::Version
         | 
| 209 | 
            -
                    version: 0.2. | 
| 209 | 
            +
                    version: 0.2.28
         | 
| 210 210 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 211 211 | 
             
              name: thor
         | 
| 212 212 | 
             
              requirement: !ruby/object:Gem::Requirement
         |