trakio-ruby 0.2.2 → 0.2.3
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/trakio_client/exceptions.rb +1 -0
- data/lib/trakio_client/version.rb +1 -1
- data/spec/trakio/exception_spec.rb +27 -0
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 2cd4bc0825ff0382a499f602816e58fe09831964
         | 
| 4 | 
            +
              data.tar.gz: 66476f1d8582251d919ade7ea0c8c87784e95dc1
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 7559b485678c2b3a07e3750e2782f323d353bcc6e0dcf41ec4b5d068d999d2c3e523a406e93988312ea91f4d657ec3b0b8e08c88d5d61e5a4cd0e9dadcc49003
         | 
| 7 | 
            +
              data.tar.gz: 1f9de57318b5c3e823dcf2eced8f9574d0226c65c1e4ac8a9ade2db69fc7b3367543a46ac77d1847aefb53e27a9ed40c040d5f62863e06c8eb7d686ef09f5a31
         | 
| @@ -16,6 +16,7 @@ module TrakioClient | |
| 16 16 | 
             
                class PropertiesObjectInvalid < StandardError; end
         | 
| 17 17 | 
             
                class RequestInvalidJson < StandardError; end
         | 
| 18 18 | 
             
                class RevenuePropertyInvalid < StandardError; end
         | 
| 19 | 
            +
                class TrialExpired < StandardError; end
         | 
| 19 20 | 
             
                class InternalServiceError < StandardError; end
         | 
| 20 21 | 
             
              end
         | 
| 21 22 |  | 
| @@ -33,6 +33,33 @@ describe Trakio do | |
| 33 33 | 
             
                      trakio.track distinct_id: 'user@example.com', event: 'my-event'
         | 
| 34 34 | 
             
                    }.to raise_error Trakio::Exceptions::InvalidToken
         | 
| 35 35 |  | 
| 36 | 
            +
                    expect(stub).to have_been_requested
         | 
| 37 | 
            +
                  end
         | 
| 38 | 
            +
                end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                context "when a TrailExpired exception is returned by the API" do
         | 
| 41 | 
            +
                  it "raises an exception" do
         | 
| 42 | 
            +
                    stub = stub_request(:post, "https://api.trak.io/v1/track").
         | 
| 43 | 
            +
                      with(:body => {
         | 
| 44 | 
            +
                        token: 'my_api_token',
         | 
| 45 | 
            +
                        data: {
         | 
| 46 | 
            +
                          time: /.+/,
         | 
| 47 | 
            +
                          distinct_id: 'user@example.com',
         | 
| 48 | 
            +
                          event: 'my-event'
         | 
| 49 | 
            +
                        }
         | 
| 50 | 
            +
                      }).to_return(:body => {
         | 
| 51 | 
            +
                        status: 'error',
         | 
| 52 | 
            +
                        code: 402,
         | 
| 53 | 
            +
                        exception: "TrialExpired",
         | 
| 54 | 
            +
                        message: "Your free trial has expired.",
         | 
| 55 | 
            +
                        details: "Your free trial (and a 28 grace period) have passed. Please enter your billing details at https://dash.trak.io/billing_details to continue using Trakio."
         | 
| 56 | 
            +
                      }.to_json)
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                    trakio = Trakio.new 'my_api_token'
         | 
| 59 | 
            +
                    expect {
         | 
| 60 | 
            +
                      trakio.track distinct_id: 'user@example.com', event: 'my-event'
         | 
| 61 | 
            +
                    }.to raise_error Trakio::Exceptions::TrialExpired
         | 
| 62 | 
            +
             | 
| 36 63 | 
             
                    expect(stub).to have_been_requested
         | 
| 37 64 |  | 
| 38 65 | 
             
                  end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: trakio-ruby
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.2. | 
| 4 | 
            +
              version: 0.2.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Matthew Spence
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date:  | 
| 12 | 
            +
            date: 2015-01-08 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: bundler
         | 
| @@ -196,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 196 196 | 
             
                  version: '0'
         | 
| 197 197 | 
             
            requirements: []
         | 
| 198 198 | 
             
            rubyforge_project: 
         | 
| 199 | 
            -
            rubygems_version: 2. | 
| 199 | 
            +
            rubygems_version: 2.4.3
         | 
| 200 200 | 
             
            signing_key: 
         | 
| 201 201 | 
             
            specification_version: 4
         | 
| 202 202 | 
             
            summary: Official trak.io ruby library for Ruby
         |