connect_client 0.1.1 → 0.1.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/.gitignore +38 -38
 - data/Gemfile +2 -2
 - data/LICENSE +22 -22
 - data/README.md +45 -45
 - data/Rakefile +21 -21
 - data/connect_client.gemspec +24 -24
 - data/lib/connect_client.rb +40 -40
 - data/lib/connect_client/client.rb +42 -42
 - data/lib/connect_client/configuration.rb +11 -11
 - data/lib/connect_client/event.rb +51 -51
 - data/lib/connect_client/event_push_response.rb +48 -48
 - data/lib/connect_client/http/event_endpoint.rb +138 -138
 - data/lib/connect_client/version.rb +2 -2
 - data/spec/connect_client/client_spec.rb +47 -47
 - data/spec/connect_client/configuration_spec.rb +54 -54
 - data/spec/connect_client/event_push_response_spec.rb +149 -149
 - data/spec/connect_client/event_spec.rb +46 -46
 - data/spec/connect_client/http/http_event_endpoint_spec.rb +120 -120
 - data/spec/connect_client/http/synchrony/event_endpoint_spec.rb +59 -59
 - data/spec/connect_client_spec.rb +24 -24
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 683a804acba4b229a9419fe6edab311a94bc636b
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 22e11a9ec22e2d8ff27d98835fc986e6b1d9698b
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 73958e1001bdc8d10e0524d3c7af743542c5e63a321543df94be34b10d9d7e433cdf6afcc99170ddee5920013c1fb525f0344e0573b887cc1bd7b7a0d9a09090
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 5ac1394f77793c2ca194afbf532f91f93240e4aa5437427e3495591ffadd0af4df1ee44906b0a1b6e1453a02de11df733d259bad5d945f8b447f233ef2f18af9
         
     | 
    
        data/.gitignore
    CHANGED
    
    | 
         @@ -1,38 +1,38 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            *.gem
         
     | 
| 
       2 
     | 
    
         
            -
            *.rbc
         
     | 
| 
       3 
     | 
    
         
            -
            *.sublime*
         
     | 
| 
       4 
     | 
    
         
            -
            .idea/*
         
     | 
| 
       5 
     | 
    
         
            -
            Gemfile.lock
         
     | 
| 
       6 
     | 
    
         
            -
            /.config
         
     | 
| 
       7 
     | 
    
         
            -
            /coverage/
         
     | 
| 
       8 
     | 
    
         
            -
            /InstalledFiles
         
     | 
| 
       9 
     | 
    
         
            -
            /pkg/
         
     | 
| 
       10 
     | 
    
         
            -
            /spec/reports/
         
     | 
| 
       11 
     | 
    
         
            -
            /test/tmp/
         
     | 
| 
       12 
     | 
    
         
            -
            /test/version_tmp/
         
     | 
| 
       13 
     | 
    
         
            -
            /tmp/
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
            ## Specific to RubyMotion:
         
     | 
| 
       16 
     | 
    
         
            -
            .dat*
         
     | 
| 
       17 
     | 
    
         
            -
            .repl_history
         
     | 
| 
       18 
     | 
    
         
            -
            build/
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            ## Documentation cache and generated files:
         
     | 
| 
       21 
     | 
    
         
            -
            /.yardoc/
         
     | 
| 
       22 
     | 
    
         
            -
            /_yardoc/
         
     | 
| 
       23 
     | 
    
         
            -
            /doc/
         
     | 
| 
       24 
     | 
    
         
            -
            /rdoc/
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
            ## Environment normalisation:
         
     | 
| 
       27 
     | 
    
         
            -
            /.bundle/
         
     | 
| 
       28 
     | 
    
         
            -
            /vendor/bundle
         
     | 
| 
       29 
     | 
    
         
            -
            /lib/bundler/man/
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
            # for a library or gem, you might want to ignore these files since the code is
         
     | 
| 
       32 
     | 
    
         
            -
            # intended to run in multiple environments; otherwise, check them in:
         
     | 
| 
       33 
     | 
    
         
            -
            # Gemfile.lock
         
     | 
| 
       34 
     | 
    
         
            -
            # .ruby-version
         
     | 
| 
       35 
     | 
    
         
            -
            # .ruby-gemset
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
            # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
         
     | 
| 
       38 
     | 
    
         
            -
            .rvmrc
         
     | 
| 
      
 1 
     | 
    
         
            +
            *.gem
         
     | 
| 
      
 2 
     | 
    
         
            +
            *.rbc
         
     | 
| 
      
 3 
     | 
    
         
            +
            *.sublime*
         
     | 
| 
      
 4 
     | 
    
         
            +
            .idea/*
         
     | 
| 
      
 5 
     | 
    
         
            +
            Gemfile.lock
         
     | 
| 
      
 6 
     | 
    
         
            +
            /.config
         
     | 
| 
      
 7 
     | 
    
         
            +
            /coverage/
         
     | 
| 
      
 8 
     | 
    
         
            +
            /InstalledFiles
         
     | 
| 
      
 9 
     | 
    
         
            +
            /pkg/
         
     | 
| 
      
 10 
     | 
    
         
            +
            /spec/reports/
         
     | 
| 
      
 11 
     | 
    
         
            +
            /test/tmp/
         
     | 
| 
      
 12 
     | 
    
         
            +
            /test/version_tmp/
         
     | 
| 
      
 13 
     | 
    
         
            +
            /tmp/
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            ## Specific to RubyMotion:
         
     | 
| 
      
 16 
     | 
    
         
            +
            .dat*
         
     | 
| 
      
 17 
     | 
    
         
            +
            .repl_history
         
     | 
| 
      
 18 
     | 
    
         
            +
            build/
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            ## Documentation cache and generated files:
         
     | 
| 
      
 21 
     | 
    
         
            +
            /.yardoc/
         
     | 
| 
      
 22 
     | 
    
         
            +
            /_yardoc/
         
     | 
| 
      
 23 
     | 
    
         
            +
            /doc/
         
     | 
| 
      
 24 
     | 
    
         
            +
            /rdoc/
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            ## Environment normalisation:
         
     | 
| 
      
 27 
     | 
    
         
            +
            /.bundle/
         
     | 
| 
      
 28 
     | 
    
         
            +
            /vendor/bundle
         
     | 
| 
      
 29 
     | 
    
         
            +
            /lib/bundler/man/
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            # for a library or gem, you might want to ignore these files since the code is
         
     | 
| 
      
 32 
     | 
    
         
            +
            # intended to run in multiple environments; otherwise, check them in:
         
     | 
| 
      
 33 
     | 
    
         
            +
            # Gemfile.lock
         
     | 
| 
      
 34 
     | 
    
         
            +
            # .ruby-version
         
     | 
| 
      
 35 
     | 
    
         
            +
            # .ruby-gemset
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
         
     | 
| 
      
 38 
     | 
    
         
            +
            .rvmrc
         
     | 
    
        data/Gemfile
    CHANGED
    
    | 
         @@ -1,3 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            source "https://rubygems.org"
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            source "https://rubygems.org"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       3 
3 
     | 
    
         
             
            gemspec
         
     | 
    
        data/LICENSE
    CHANGED
    
    | 
         @@ -1,22 +1,22 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            The MIT License (MIT)
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            Copyright (c) 2015 Connect
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
       6 
     | 
    
         
            -
            of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
       7 
     | 
    
         
            -
            in the Software without restriction, including without limitation the rights
         
     | 
| 
       8 
     | 
    
         
            -
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
       9 
     | 
    
         
            -
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
       10 
     | 
    
         
            -
            furnished to do so, subject to the following conditions:
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            The above copyright notice and this permission notice shall be included in all
         
     | 
| 
       13 
     | 
    
         
            -
            copies or substantial portions of the Software.
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
       16 
     | 
    
         
            -
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
       17 
     | 
    
         
            -
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
       18 
     | 
    
         
            -
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
       19 
     | 
    
         
            -
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
       20 
     | 
    
         
            -
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         
     | 
| 
       21 
     | 
    
         
            -
            SOFTWARE.
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            The MIT License (MIT)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2015 Connect
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
      
 6 
     | 
    
         
            +
            of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
      
 7 
     | 
    
         
            +
            in the Software without restriction, including without limitation the rights
         
     | 
| 
      
 8 
     | 
    
         
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
      
 9 
     | 
    
         
            +
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
      
 10 
     | 
    
         
            +
            furnished to do so, subject to the following conditions:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in all
         
     | 
| 
      
 13 
     | 
    
         
            +
            copies or substantial portions of the Software.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
      
 16 
     | 
    
         
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
      
 17 
     | 
    
         
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
      
 18 
     | 
    
         
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
      
 19 
     | 
    
         
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
      
 20 
     | 
    
         
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         
     | 
| 
      
 21 
     | 
    
         
            +
            SOFTWARE.
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,45 +1,45 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # Connect Ruby SDK
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            [](https://gitter.im/getconnect/connect-rb?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            ## Getting Access
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
            Sign up at [https://getconnect.io](https://getconnect.io) to generate and retrieve your API keys so that you can start using the SDK.
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
            ## Install 
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            ### Install with Bundler
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
            ```ssh
         
     | 
| 
       14 
     | 
    
         
            -
            gem 'connect_client'
         
     | 
| 
       15 
     | 
    
         
            -
            bundle install
         
     | 
| 
       16 
     | 
    
         
            -
            ```
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
            ### Install from RubyGems
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            ```ssh
         
     | 
| 
       21 
     | 
    
         
            -
            gem install connect_client
         
     | 
| 
       22 
     | 
    
         
            -
            ```
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
            ## Documentation
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
            All of the documentation can be found at [http://docs.getconnect.io](http://docs.getconnect.io).
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
            ## Support
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
            Get your questions answered and join in with the connect community at [http://docs.getconnect.io/v1.0/discuss](http://docs.getconnect.io/v1.0/discuss).
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
            ## Contributing
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
            We love open source, so we are happy to accept pull requests and will endeavor to fix the issues and include the enhancements that the community raise.
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
            ## Building
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
            To build, and run locally:
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
            ```ssh
         
     | 
| 
       41 
     | 
    
         
            -
            git clone https://github.com/getconnect/connect-rb connect-rb
         
     | 
| 
       42 
     | 
    
         
            -
            cd connect-rb
         
     | 
| 
       43 
     | 
    
         
            -
            bundle install
         
     | 
| 
       44 
     | 
    
         
            -
            rake
         
     | 
| 
       45 
     | 
    
         
            -
            ```
         
     | 
| 
      
 1 
     | 
    
         
            +
            # Connect Ruby SDK
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            [](https://gitter.im/getconnect/connect-rb?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ## Getting Access
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Sign up at [https://getconnect.io](https://getconnect.io) to generate and retrieve your API keys so that you can start using the SDK.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ## Install 
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ### Install with Bundler
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            ```ssh
         
     | 
| 
      
 14 
     | 
    
         
            +
            gem 'connect_client'
         
     | 
| 
      
 15 
     | 
    
         
            +
            bundle install
         
     | 
| 
      
 16 
     | 
    
         
            +
            ```
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            ### Install from RubyGems
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            ```ssh
         
     | 
| 
      
 21 
     | 
    
         
            +
            gem install connect_client
         
     | 
| 
      
 22 
     | 
    
         
            +
            ```
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            ## Documentation
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            All of the documentation can be found at [http://docs.getconnect.io](http://docs.getconnect.io).
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            ## Support
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            Get your questions answered and join in with the connect community at [http://docs.getconnect.io/v1.0/discuss](http://docs.getconnect.io/v1.0/discuss).
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            We love open source, so we are happy to accept pull requests and will endeavor to fix the issues and include the enhancements that the community raise.
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            ## Building
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            To build, and run locally:
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            ```ssh
         
     | 
| 
      
 41 
     | 
    
         
            +
            git clone https://github.com/getconnect/connect-rb connect-rb
         
     | 
| 
      
 42 
     | 
    
         
            +
            cd connect-rb
         
     | 
| 
      
 43 
     | 
    
         
            +
            bundle install
         
     | 
| 
      
 44 
     | 
    
         
            +
            rake
         
     | 
| 
      
 45 
     | 
    
         
            +
            ```
         
     | 
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -1,22 +1,22 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'bundler/gem_tasks'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'rake/testtask'
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            namespace :test do
         
     | 
| 
       5 
     | 
    
         
            -
              desc 'Run the tests'
         
     | 
| 
       6 
     | 
    
         
            -
              Rake::TestTask.new(:spec) do |t|
         
     | 
| 
       7 
     | 
    
         
            -
                t.libs = ['lib', 'spec']
         
     | 
| 
       8 
     | 
    
         
            -
                t.warning = false
         
     | 
| 
       9 
     | 
    
         
            -
                t.verbose = true
         
     | 
| 
       10 
     | 
    
         
            -
                t.test_files = FileList['spec/connect_client/http/*_spec.rb', 'spec/connect_client/*_spec.rb', 'spec/*_spec.rb']
         
     | 
| 
       11 
     | 
    
         
            -
              end
         
     | 
| 
       12 
     | 
    
         
            -
              
         
     | 
| 
       13 
     | 
    
         
            -
              desc 'Run the synchrony tests'
         
     | 
| 
       14 
     | 
    
         
            -
              Rake::TestTask.new(:synchrony => :spec) do |t|
         
     | 
| 
       15 
     | 
    
         
            -
                t.libs = ['lib', 'spec']
         
     | 
| 
       16 
     | 
    
         
            -
                t.warning = false
         
     | 
| 
       17 
     | 
    
         
            -
                t.verbose = true
         
     | 
| 
       18 
     | 
    
         
            -
                t.test_files = FileList['spec/connect_client/http/synchrony/*_spec.rb']
         
     | 
| 
       19 
     | 
    
         
            -
              end
         
     | 
| 
       20 
     | 
    
         
            -
            end
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            require 'bundler/gem_tasks'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rake/testtask'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            namespace :test do
         
     | 
| 
      
 5 
     | 
    
         
            +
              desc 'Run the tests'
         
     | 
| 
      
 6 
     | 
    
         
            +
              Rake::TestTask.new(:spec) do |t|
         
     | 
| 
      
 7 
     | 
    
         
            +
                t.libs = ['lib', 'spec']
         
     | 
| 
      
 8 
     | 
    
         
            +
                t.warning = false
         
     | 
| 
      
 9 
     | 
    
         
            +
                t.verbose = true
         
     | 
| 
      
 10 
     | 
    
         
            +
                t.test_files = FileList['spec/connect_client/http/*_spec.rb', 'spec/connect_client/*_spec.rb', 'spec/*_spec.rb']
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
              
         
     | 
| 
      
 13 
     | 
    
         
            +
              desc 'Run the synchrony tests'
         
     | 
| 
      
 14 
     | 
    
         
            +
              Rake::TestTask.new(:synchrony => :spec) do |t|
         
     | 
| 
      
 15 
     | 
    
         
            +
                t.libs = ['lib', 'spec']
         
     | 
| 
      
 16 
     | 
    
         
            +
                t.warning = false
         
     | 
| 
      
 17 
     | 
    
         
            +
                t.verbose = true
         
     | 
| 
      
 18 
     | 
    
         
            +
                t.test_files = FileList['spec/connect_client/http/synchrony/*_spec.rb']
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
       22 
22 
     | 
    
         
             
            task :default => "test:synchrony"
         
     | 
    
        data/connect_client.gemspec
    CHANGED
    
    | 
         @@ -1,25 +1,25 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require_relative "lib/connect_client/version"
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            Gem::Specification.new do |gem|
         
     | 
| 
       4 
     | 
    
         
            -
              gem.name        = "connect_client"
         
     | 
| 
       5 
     | 
    
         
            -
              gem.version     = ConnectClient::VERSION
         
     | 
| 
       6 
     | 
    
         
            -
              gem.authors     = ["Team Connect"]
         
     | 
| 
       7 
     | 
    
         
            -
              gem.email       = "team@getconnect.io"
         
     | 
| 
       8 
     | 
    
         
            -
              gem.homepage    = "https://github.com/getconnect/connect-rb"
         
     | 
| 
       9 
     | 
    
         
            -
              gem.summary     = "Connect SDK"
         
     | 
| 
       10 
     | 
    
         
            -
              gem.description = "Ruby Connect SDK for interacting with the Connect API"
         
     | 
| 
       11 
     | 
    
         
            -
              gem.license     = "MIT"
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
              gem.add_dependency 'json'
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
              gem.add_development_dependency 'webmock'
         
     | 
| 
       16 
     | 
    
         
            -
              gem.add_development_dependency 'minitest'
         
     | 
| 
       17 
     | 
    
         
            -
              gem.add_development_dependency 'eventmachine'
         
     | 
| 
       18 
     | 
    
         
            -
              gem.add_development_dependency 'em-http-request'
         
     | 
| 
       19 
     | 
    
         
            -
              gem.add_development_dependency 'em-synchrony'
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
              gem.files         = `git ls-files`.split($/)
         
     | 
| 
       22 
     | 
    
         
            -
              gem.executables   = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
         
     | 
| 
       23 
     | 
    
         
            -
              gem.test_files    = gem.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
       24 
     | 
    
         
            -
              gem.require_paths = ['lib']
         
     | 
| 
      
 1 
     | 
    
         
            +
            require_relative "lib/connect_client/version"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Gem::Specification.new do |gem|
         
     | 
| 
      
 4 
     | 
    
         
            +
              gem.name        = "connect_client"
         
     | 
| 
      
 5 
     | 
    
         
            +
              gem.version     = ConnectClient::VERSION
         
     | 
| 
      
 6 
     | 
    
         
            +
              gem.authors     = ["Team Connect"]
         
     | 
| 
      
 7 
     | 
    
         
            +
              gem.email       = "team@getconnect.io"
         
     | 
| 
      
 8 
     | 
    
         
            +
              gem.homepage    = "https://github.com/getconnect/connect-rb"
         
     | 
| 
      
 9 
     | 
    
         
            +
              gem.summary     = "Connect SDK"
         
     | 
| 
      
 10 
     | 
    
         
            +
              gem.description = "Ruby Connect SDK for interacting with the Connect API"
         
     | 
| 
      
 11 
     | 
    
         
            +
              gem.license     = "MIT"
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              gem.add_dependency 'json'
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              gem.add_development_dependency 'webmock'
         
     | 
| 
      
 16 
     | 
    
         
            +
              gem.add_development_dependency 'minitest'
         
     | 
| 
      
 17 
     | 
    
         
            +
              gem.add_development_dependency 'eventmachine'
         
     | 
| 
      
 18 
     | 
    
         
            +
              gem.add_development_dependency 'em-http-request'
         
     | 
| 
      
 19 
     | 
    
         
            +
              gem.add_development_dependency 'em-synchrony'
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              gem.files         = `git ls-files`.split($/)
         
     | 
| 
      
 22 
     | 
    
         
            +
              gem.executables   = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
         
     | 
| 
      
 23 
     | 
    
         
            +
              gem.test_files    = gem.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
      
 24 
     | 
    
         
            +
              gem.require_paths = ['lib']
         
     | 
| 
       25 
25 
     | 
    
         
             
            end
         
     | 
    
        data/lib/connect_client.rb
    CHANGED
    
    | 
         @@ -1,41 +1,41 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require_relative 'connect_client/client'
         
     | 
| 
       2 
     | 
    
         
            -
            require_relative 'connect_client/configuration'
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            module ConnectClient
         
     | 
| 
       5 
     | 
    
         
            -
              class << self
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                def configure
         
     | 
| 
       8 
     | 
    
         
            -
                  config = Configuration.new
         
     | 
| 
       9 
     | 
    
         
            -
                  yield(config)
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                  @client = ConnectClient::Client.new config
         
     | 
| 
       12 
     | 
    
         
            -
                end
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
                def reset
         
     | 
| 
       15 
     | 
    
         
            -
                  @client = nil
         
     | 
| 
       16 
     | 
    
         
            -
                end
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
                def method_missing(method, *args, &block)
         
     | 
| 
       19 
     | 
    
         
            -
                  return super unless client.respond_to?(method)
         
     | 
| 
       20 
     | 
    
         
            -
                  client.send(method, *args, &block)
         
     | 
| 
       21 
     | 
    
         
            -
                end
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
                def respond_to?(method)
         
     | 
| 
       24 
     | 
    
         
            -
                  return (!@client.nil? && @client.respond_to?(method)) || super
         
     | 
| 
       25 
     | 
    
         
            -
                end   
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                private
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
                def client
         
     | 
| 
       30 
     | 
    
         
            -
                  raise UnconfiguredError if @client.nil?
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                  @client
         
     | 
| 
       33 
     | 
    
         
            -
                end 
         
     | 
| 
       34 
     | 
    
         
            -
              end
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
              class UnconfiguredError < StandardError
         
     | 
| 
       37 
     | 
    
         
            -
                def message
         
     | 
| 
       38 
     | 
    
         
            -
                  "Connect must configured before it can be used, please call Connect.configure"
         
     | 
| 
       39 
     | 
    
         
            -
                end
         
     | 
| 
       40 
     | 
    
         
            -
              end
         
     | 
| 
      
 1 
     | 
    
         
            +
            require_relative 'connect_client/client'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_relative 'connect_client/configuration'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module ConnectClient
         
     | 
| 
      
 5 
     | 
    
         
            +
              class << self
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                def configure
         
     | 
| 
      
 8 
     | 
    
         
            +
                  config = Configuration.new
         
     | 
| 
      
 9 
     | 
    
         
            +
                  yield(config)
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                  @client = ConnectClient::Client.new config
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                def reset
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @client = nil
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                def method_missing(method, *args, &block)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  return super unless client.respond_to?(method)
         
     | 
| 
      
 20 
     | 
    
         
            +
                  client.send(method, *args, &block)
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                def respond_to?(method)
         
     | 
| 
      
 24 
     | 
    
         
            +
                  return (!@client.nil? && @client.respond_to?(method)) || super
         
     | 
| 
      
 25 
     | 
    
         
            +
                end   
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                private
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                def client
         
     | 
| 
      
 30 
     | 
    
         
            +
                  raise UnconfiguredError if @client.nil?
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                  @client
         
     | 
| 
      
 33 
     | 
    
         
            +
                end 
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
              class UnconfiguredError < StandardError
         
     | 
| 
      
 37 
     | 
    
         
            +
                def message
         
     | 
| 
      
 38 
     | 
    
         
            +
                  "Connect must configured before it can be used, please call Connect.configure"
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
              end
         
     | 
| 
       41 
41 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,43 +1,43 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require_relative 'http/event_endpoint'
         
     | 
| 
       2 
     | 
    
         
            -
            require_relative 'event'
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            module ConnectClient
         
     | 
| 
       5 
     | 
    
         
            -
              class Client
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                def initialize(config)
         
     | 
| 
       8 
     | 
    
         
            -
                  @end_point = ConnectClient::Http::EventEndpoint.new config
         
     | 
| 
       9 
     | 
    
         
            -
                end
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                def push(collection_name_or_batches, event_or_events = nil)
         
     | 
| 
       12 
     | 
    
         
            -
                  has_multiple_events = event_or_events.is_a?(Array)
         
     | 
| 
       13 
     | 
    
         
            -
                  has_collection_name = collection_name_or_batches.is_a?(String)
         
     | 
| 
       14 
     | 
    
         
            -
                  is_batch = !has_collection_name || has_multiple_events
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                  if is_batch
         
     | 
| 
       17 
     | 
    
         
            -
                    batch = create_batch(has_collection_name, collection_name_or_batches, event_or_events)
         
     | 
| 
       18 
     | 
    
         
            -
                    @end_point.push_batch batch
         
     | 
| 
       19 
     | 
    
         
            -
                  else
         
     | 
| 
       20 
     | 
    
         
            -
                    @end_point.push(collection_name_or_batches, ConnectClient::Event.new(event_or_events))
         
     | 
| 
       21 
     | 
    
         
            -
                  end
         
     | 
| 
       22 
     | 
    
         
            -
                end
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                private
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                def create_batch(has_collection_name, collection_name_or_batches, event_or_events)
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                  batches = has_collection_name ?
         
     | 
| 
       29 
     | 
    
         
            -
                            { collection_name_or_batches.to_sym => event_or_events } :
         
     | 
| 
       30 
     | 
    
         
            -
                            collection_name_or_batches
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                  create_event = Proc.new do |event_data| 
         
     | 
| 
       33 
     | 
    
         
            -
                      ConnectClient::Event.new event_data
         
     | 
| 
       34 
     | 
    
         
            -
                  end
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                  map_all_events = Proc.new do |col_name, events| 
         
     | 
| 
       37 
     | 
    
         
            -
                    [col_name, events.map(&create_event)]
         
     | 
| 
       38 
     | 
    
         
            -
                  end
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
                  Hash[batches.map(&map_all_events)]
         
     | 
| 
       41 
     | 
    
         
            -
                end
         
     | 
| 
       42 
     | 
    
         
            -
              end
         
     | 
| 
      
 1 
     | 
    
         
            +
            require_relative 'http/event_endpoint'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_relative 'event'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module ConnectClient
         
     | 
| 
      
 5 
     | 
    
         
            +
              class Client
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(config)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @end_point = ConnectClient::Http::EventEndpoint.new config
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                def push(collection_name_or_batches, event_or_events = nil)
         
     | 
| 
      
 12 
     | 
    
         
            +
                  has_multiple_events = event_or_events.is_a?(Array)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  has_collection_name = collection_name_or_batches.is_a?(String)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  is_batch = !has_collection_name || has_multiple_events
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  if is_batch
         
     | 
| 
      
 17 
     | 
    
         
            +
                    batch = create_batch(has_collection_name, collection_name_or_batches, event_or_events)
         
     | 
| 
      
 18 
     | 
    
         
            +
                    @end_point.push_batch batch
         
     | 
| 
      
 19 
     | 
    
         
            +
                  else
         
     | 
| 
      
 20 
     | 
    
         
            +
                    @end_point.push(collection_name_or_batches, ConnectClient::Event.new(event_or_events))
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                private
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                def create_batch(has_collection_name, collection_name_or_batches, event_or_events)
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                  batches = has_collection_name ?
         
     | 
| 
      
 29 
     | 
    
         
            +
                            { collection_name_or_batches.to_sym => event_or_events } :
         
     | 
| 
      
 30 
     | 
    
         
            +
                            collection_name_or_batches
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                  create_event = Proc.new do |event_data| 
         
     | 
| 
      
 33 
     | 
    
         
            +
                      ConnectClient::Event.new event_data
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                  map_all_events = Proc.new do |col_name, events| 
         
     | 
| 
      
 37 
     | 
    
         
            +
                    [col_name, events.map(&create_event)]
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                  Hash[batches.map(&map_all_events)]
         
     | 
| 
      
 41 
     | 
    
         
            +
                end
         
     | 
| 
      
 42 
     | 
    
         
            +
              end
         
     | 
| 
       43 
43 
     | 
    
         
             
            end
         
     |