ecal_client 0.1.2 → 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/README.md +3 -1
- data/lib/ecal_client/api/base.rb +2 -2
- data/lib/ecal_client/api/rest.rb +4 -1
- data/lib/ecal_client/api.rb +7 -11
- data/lib/ecal_client/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: baed85157042311b88b72862a71b294fb2b04a01
         | 
| 4 | 
            +
              data.tar.gz: 34d419c1e2ecf28ef9ecc8ad746ec23a50a71ba3
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 52d2bea0757d983ff4e5e89ca17e4691c525c1f8e0caab4aef0a0a7dc11c1022c7b8a022f682e76ff614dfb3c9c666c6abf2d58acd3474c7b0b3f64193cd8202
         | 
| 7 | 
            +
              data.tar.gz: e4fc49a58d5f8eb31d1d0da16421dfb299d713b9c5ff0e649bfe3d09ab71520a217a83eac329a760382326328bf258d6ff5e6ece00c59a9b685c75b5307c77e6
         | 
    
        data/README.md
    CHANGED
    
    | @@ -1,6 +1,8 @@ | |
| 1 1 | 
             
            # EcalClient
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 3 | 
            +
            Ruby Client for [Ecal](http://ecal.com/).
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            Ecal API documentation can be found [here](https://e-diary.atlassian.net/wiki/display/EAV/ECAL+API+V2+Home).
         | 
| 4 6 |  | 
| 5 7 | 
             
            ## Installation
         | 
| 6 8 |  | 
    
        data/lib/ecal_client/api/base.rb
    CHANGED
    
    | @@ -23,7 +23,7 @@ module EcalClient | |
| 23 23 |  | 
| 24 24 | 
             
                def api_sign(parameters = {}, body = nil)
         | 
| 25 25 | 
             
                  sorted_keys = parameters.keys.sort
         | 
| 26 | 
            -
                  string =  | 
| 26 | 
            +
                  string = @secret.dup
         | 
| 27 27 | 
             
                  string << sorted_keys.inject("") { |memo, key| memo << "#{key}#{parameters[key]}" }
         | 
| 28 28 | 
             
                  string << body.to_json if body
         | 
| 29 29 | 
             
                  Digest::MD5.hexdigest(string)
         | 
| @@ -35,7 +35,7 @@ module EcalClient | |
| 35 35 |  | 
| 36 36 | 
             
                [:post, :get, :put].each do |method|
         | 
| 37 37 | 
             
                  define_method "#{method}_call" do |action, params, body, headers|
         | 
| 38 | 
            -
                    params.merge!(apiKey:  | 
| 38 | 
            +
                    params.merge!(apiKey: @key)
         | 
| 39 39 | 
             
                    connection.send("#{method}") do |req|
         | 
| 40 40 | 
             
                      req.url action, generate_params(params, body)
         | 
| 41 41 | 
             
                      req.body = body.to_json if body
         | 
    
        data/lib/ecal_client/api/rest.rb
    CHANGED
    
    | @@ -3,9 +3,12 @@ module EcalClient | |
| 3 3 |  | 
| 4 4 | 
             
                class Unsupported < StandardError; end
         | 
| 5 5 |  | 
| 6 | 
            -
                def initialize(endpoint, actions)
         | 
| 6 | 
            +
                def initialize(endpoint, actions, options = {})
         | 
| 7 7 | 
             
                  @endpoint = endpoint
         | 
| 8 8 | 
             
                  @actions = actions
         | 
| 9 | 
            +
                  @key = options.delete(:key) || EcalClient.configuration.key
         | 
| 10 | 
            +
                  @secret = options.delete(:secret) || EcalClient.configuration.secret
         | 
| 11 | 
            +
                  EcalClient.configuration.options.merge!(options)
         | 
| 9 12 | 
             
                end
         | 
| 10 13 |  | 
| 11 14 | 
             
                def get(options = {})
         | 
    
        data/lib/ecal_client/api.rb
    CHANGED
    
    | @@ -10,35 +10,31 @@ module EcalClient | |
| 10 10 | 
             
                SUBSCRIBER          = "/subscriber/".freeze
         | 
| 11 11 |  | 
| 12 12 | 
             
                def initialize(options = {})
         | 
| 13 | 
            -
                   | 
| 14 | 
            -
                  secret = options.delete(:secret)
         | 
| 15 | 
            -
                  EcalClient.configuration.key = key if key
         | 
| 16 | 
            -
                  EcalClient.configuration.secret = secret if secret
         | 
| 17 | 
            -
                  EcalClient.configuration.options.merge!(options)
         | 
| 13 | 
            +
                  @options = options
         | 
| 18 14 | 
             
                end
         | 
| 19 15 |  | 
| 20 16 | 
             
                def organisation
         | 
| 21 | 
            -
                  @organisation ||= Rest.new(endpoint_for(ORGANISATION), [:get, :post, :put])
         | 
| 17 | 
            +
                  @organisation ||= Rest.new(endpoint_for(ORGANISATION), [:get, :post, :put], @options)
         | 
| 22 18 | 
             
                end
         | 
| 23 19 |  | 
| 24 20 | 
             
                def publisher
         | 
| 25 | 
            -
                  @publisher ||= Rest.new(endpoint_for(PUBLISHER), [:get, :put])
         | 
| 21 | 
            +
                  @publisher ||= Rest.new(endpoint_for(PUBLISHER), [:get, :put], @options)
         | 
| 26 22 | 
             
                end
         | 
| 27 23 |  | 
| 28 24 | 
             
                def calendar
         | 
| 29 | 
            -
                  @calendar ||= Rest.new(endpoint_for(CALENDAR), [:get, :post, :put])
         | 
| 25 | 
            +
                  @calendar ||= Rest.new(endpoint_for(CALENDAR), [:get, :post, :put], @options)
         | 
| 30 26 | 
             
                end
         | 
| 31 27 |  | 
| 32 28 | 
             
                def event
         | 
| 33 | 
            -
                  @event ||= Rest.new(endpoint_for(EVENT), [:get, :post, :put])
         | 
| 29 | 
            +
                  @event ||= Rest.new(endpoint_for(EVENT), [:get, :post, :put], @options)
         | 
| 34 30 | 
             
                end
         | 
| 35 31 |  | 
| 36 32 | 
             
                def subscription_widget
         | 
| 37 | 
            -
                  @subscription_widget ||= Rest.new(endpoint_for(SUBSCRIPTION_WIDGET), [:get])
         | 
| 33 | 
            +
                  @subscription_widget ||= Rest.new(endpoint_for(SUBSCRIPTION_WIDGET), [:get], @options)
         | 
| 38 34 | 
             
                end
         | 
| 39 35 |  | 
| 40 36 | 
             
                def subscriber
         | 
| 41 | 
            -
                  @subscriber ||= Rest.new(endpoint_for(SUBSCRIBER), [:get, :post, :put])
         | 
| 37 | 
            +
                  @subscriber ||= Rest.new(endpoint_for(SUBSCRIBER), [:get, :post, :put], @options)
         | 
| 42 38 | 
             
                end
         | 
| 43 39 |  | 
| 44 40 | 
             
                private
         | 
    
        data/lib/ecal_client/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: ecal_client
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Faizal Zakaria
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2016- | 
| 11 | 
            +
            date: 2016-03-03 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         |