customerx_tracking 2.0.0 → 2.1.0
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/customerx_tracking/base.rb +13 -6
 - data/lib/customerx_tracking/requestor.rb +7 -6
 - data/lib/customerx_tracking/tracker.rb +1 -1
 - data/lib/customerx_tracking/version.rb +1 -1
 - data/lib/customerx_tracking.rb +2 -6
 - metadata +11 -17
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 5d4e3d43aec5e19517ffd9483fc7baa9f7deb0139f1150b8970ee3d6ff6e9718
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: cda3b742f83cfbc3d604cf8a44d1082ed261edcb1359271f8b63525fca0f2d1b
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 031a7eef2d62b7105266374efaddaea8c5db2fcb5c0d5bfb557b62a66bfbde25db18151c675e17c35a35bfbda76aa4121c596e852906e216656c0783dc270a5d
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 76a170d6eae62b6d16216d562b50a4fef4c64a9e0aad7ba4cae12da988cdf0f9930d9119725ab74c9860ce0c50964198aed5939f0e55628dca9d934255395437
         
     | 
| 
         @@ -5,7 +5,7 @@ module CustomerxTracking 
     | 
|
| 
       5 
5 
     | 
    
         
             
                end
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                def authorizations_is_not_present?
         
     | 
| 
       8 
     | 
    
         
            -
                  ::CustomerxTracking.credential.nil? || ::CustomerxTracking.key.nil?
         
     | 
| 
      
 8 
     | 
    
         
            +
                  ::CustomerxTracking.authorization.nil? && (::CustomerxTracking.credential.nil? || ::CustomerxTracking.key.nil?)
         
     | 
| 
       9 
9 
     | 
    
         
             
                end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
                private
         
     | 
| 
         @@ -13,12 +13,19 @@ module CustomerxTracking 
     | 
|
| 
       13 
13 
     | 
    
         
             
                def faraday_options
         
     | 
| 
       14 
14 
     | 
    
         
             
                  {
         
     | 
| 
       15 
15 
     | 
    
         
             
                    headers: {
         
     | 
| 
       16 
     | 
    
         
            -
                       
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
                      key: ::CustomerxTracking.key
         
     | 
| 
       19 
     | 
    
         
            -
                    },
         
     | 
| 
      
 16 
     | 
    
         
            +
                      'Content-Type' => 'application/json'
         
     | 
| 
      
 17 
     | 
    
         
            +
                    }.merge(validate_authorization),
         
     | 
| 
       20 
18 
     | 
    
         
             
                    url: ::CustomerxTracking.base_url
         
     | 
| 
       21 
19 
     | 
    
         
             
                  }
         
     | 
| 
       22 
20 
     | 
    
         
             
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                def validate_authorization
         
     | 
| 
      
 23 
     | 
    
         
            +
                  return { authorization: ::CustomerxTracking.authorization } unless ::CustomerxTracking.authorization.nil?
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                  {
         
     | 
| 
      
 26 
     | 
    
         
            +
                    credential: ::CustomerxTracking.credential,
         
     | 
| 
      
 27 
     | 
    
         
            +
                    key: ::CustomerxTracking.key
         
     | 
| 
      
 28 
     | 
    
         
            +
                  }
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
       23 
30 
     | 
    
         
             
              end
         
     | 
| 
       24 
     | 
    
         
            -
            end
         
     | 
| 
      
 31 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,22 +1,23 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module CustomerxTracking
         
     | 
| 
       2 
2 
     | 
    
         
             
              class Requestor < Base
         
     | 
| 
       3 
3 
     | 
    
         
             
                def initialize
         
     | 
| 
       4 
     | 
    
         
            -
                   
     | 
| 
      
 4 
     | 
    
         
            +
                  super
         
     | 
| 
      
 5 
     | 
    
         
            +
                  raise 'authorization or credential and key should be set' if authorizations_is_not_present?
         
     | 
| 
       5 
6 
     | 
    
         
             
                end
         
     | 
| 
       6 
7 
     | 
    
         | 
| 
       7 
8 
     | 
    
         
             
                def request(meth, params = nil)
         
     | 
| 
       8 
9 
     | 
    
         
             
                  meth = meth.downcase
         
     | 
| 
       9 
10 
     | 
    
         | 
| 
       10 
11 
     | 
    
         
             
                  begin
         
     | 
| 
      
 12 
     | 
    
         
            +
                    p JSON.parse(params.to_json)
         
     | 
| 
       11 
13 
     | 
    
         
             
                    response = connection.method(meth).call do |req|
         
     | 
| 
       12 
     | 
    
         
            -
                      ( 
     | 
| 
      
 14 
     | 
    
         
            +
                      (meth == :get ? (req.params = params) : (req.body = params.to_json)) if params
         
     | 
| 
       13 
15 
     | 
    
         
             
                    end
         
     | 
| 
       14 
     | 
    
         
            -
                  rescue
         
     | 
| 
       15 
     | 
    
         
            -
                    raise  
     | 
| 
      
 16 
     | 
    
         
            +
                  rescue StandardError => e
         
     | 
| 
      
 17 
     | 
    
         
            +
                    raise "it was not possible to carry out the request #{e}"
         
     | 
| 
       16 
18 
     | 
    
         
             
                  end
         
     | 
| 
       17 
19 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
                  p response
         
     | 
| 
       19 
20 
     | 
    
         
             
                  { status: response.status, body: JSON.parse(response.body) }
         
     | 
| 
       20 
21 
     | 
    
         
             
                end
         
     | 
| 
       21 
22 
     | 
    
         
             
              end
         
     | 
| 
       22 
     | 
    
         
            -
            end
         
     | 
| 
      
 23 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/customerx_tracking.rb
    CHANGED
    
    | 
         @@ -1,9 +1,5 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # Module main of CustomerX Tracking
         
     | 
| 
       2 
1 
     | 
    
         
             
            module CustomerxTracking
         
     | 
| 
       3 
     | 
    
         
            -
              @base_url = 'https:// 
     | 
| 
       4 
     | 
    
         
            -
              @credential
         
     | 
| 
       5 
     | 
    
         
            -
              @key
         
     | 
| 
       6 
     | 
    
         
            -
              @authorization
         
     | 
| 
      
 2 
     | 
    
         
            +
              @base_url = 'https://tracker.customerx.com.br'
         
     | 
| 
       7 
3 
     | 
    
         | 
| 
       8 
4 
     | 
    
         
             
              def self.config
         
     | 
| 
       9 
5 
     | 
    
         
             
                yield self
         
     | 
| 
         @@ -50,4 +46,4 @@ require 'customerx_tracking/base' 
     | 
|
| 
       50 
46 
     | 
    
         
             
            require 'customerx_tracking/requestor'
         
     | 
| 
       51 
47 
     | 
    
         | 
| 
       52 
48 
     | 
    
         
             
            # Tracker
         
     | 
| 
       53 
     | 
    
         
            -
            require 'customerx_tracking/tracker'
         
     | 
| 
      
 49 
     | 
    
         
            +
            require 'customerx_tracking/tracker'
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,35 +1,29 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: customerx_tracking
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.1.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Ricardo Grassi
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2021- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2021-10-14 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: faraday
         
     | 
| 
       15 
15 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       16 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
     | 
    
         
            -
                - - " 
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       18 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
     | 
    
         
            -
                    version:  
     | 
| 
       20 
     | 
    
         
            -
                - - "<"
         
     | 
| 
       21 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       22 
     | 
    
         
            -
                    version: 2.0.0
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '1.8'
         
     | 
| 
       23 
20 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       24 
21 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       25 
22 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       26 
23 
     | 
    
         
             
                requirements:
         
     | 
| 
       27 
     | 
    
         
            -
                - - " 
     | 
| 
       28 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       29 
     | 
    
         
            -
                    version: 0.9.0
         
     | 
| 
       30 
     | 
    
         
            -
                - - "<"
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       31 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       32 
     | 
    
         
            -
                    version:  
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '1.8'
         
     | 
| 
       33 
27 
     | 
    
         
             
            description: Ruby wrapper for the REST API at https://www.customerx.cx. Documentation
         
     | 
| 
       34 
28 
     | 
    
         
             
              at https://www.customerx.cx/developers.
         
     | 
| 
       35 
29 
     | 
    
         
             
            email:
         
     | 
| 
         @@ -49,23 +43,23 @@ licenses: 
     | 
|
| 
       49 
43 
     | 
    
         
             
            metadata:
         
     | 
| 
       50 
44 
     | 
    
         
             
              bug_tracker_uri: https://github.com/CustomerX-CX/customerx_tracking_client_rb/issues
         
     | 
| 
       51 
45 
     | 
    
         
             
              changelog_uri: https://github.com/CustomerX-CX/customerx_tracking_client_rb/blob/master/CHANGELOG.md
         
     | 
| 
       52 
     | 
    
         
            -
              releases_uri: https://github.com/CustomerX-CX/customerx_tracking_client_rb/releases/tag/2. 
     | 
| 
      
 46 
     | 
    
         
            +
              releases_uri: https://github.com/CustomerX-CX/customerx_tracking_client_rb/releases/tag/2.1.0
         
     | 
| 
       53 
47 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       54 
48 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       55 
49 
     | 
    
         
             
            require_paths:
         
     | 
| 
       56 
50 
     | 
    
         
             
            - lib
         
     | 
| 
       57 
51 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       58 
52 
     | 
    
         
             
              requirements:
         
     | 
| 
       59 
     | 
    
         
            -
              - -  
     | 
| 
      
 53 
     | 
    
         
            +
              - - '='
         
     | 
| 
       60 
54 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       61 
     | 
    
         
            -
                  version:  
     | 
| 
      
 55 
     | 
    
         
            +
                  version: 3.0.0
         
     | 
| 
       62 
56 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       63 
57 
     | 
    
         
             
              requirements:
         
     | 
| 
       64 
58 
     | 
    
         
             
              - - ">="
         
     | 
| 
       65 
59 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       66 
     | 
    
         
            -
                  version:  
     | 
| 
      
 60 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
       67 
61 
     | 
    
         
             
            requirements: []
         
     | 
| 
       68 
     | 
    
         
            -
            rubygems_version: 3.2. 
     | 
| 
      
 62 
     | 
    
         
            +
            rubygems_version: 3.2.3
         
     | 
| 
       69 
63 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       70 
64 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       71 
65 
     | 
    
         
             
            summary: CustomerX Tracking REST API Client
         
     |