clicksign-api 1.1.0.alpha2 → 1.1.0.alpha6
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/CHANGELOG.md +25 -0
- data/Gemfile.lock +1 -1
- data/README.md +78 -11
- data/lib/clicksign/api/batch.rb +2 -0
- data/lib/clicksign/api/document.rb +2 -2
- data/lib/clicksign/api/documents_signers.rb +2 -0
- data/lib/clicksign/api/notifier.rb +2 -0
- data/lib/clicksign/api/signer.rb +2 -0
- data/lib/clicksign/api/version.rb +1 -1
- data/lib/clicksign/api/whatsapp_notifier.rb +2 -0
- metadata +4 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 12d78c1e1512951c7213b73440679297f738376895698654fd8580a8a0290cf7
         | 
| 4 | 
            +
              data.tar.gz: d899a9ac359212534f3e75a2d77bbe0f0c6e9e01f534a668ce8161e3b7d52d71
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: af14c66c6e4a1a5cb8471c0dcc32072e889381aaa815ad65c89b63e6fb830ab48514338f0465d96cd8f6bed8f804cd0ae997abc5056702a4946a9bc67abac6b8
         | 
| 7 | 
            +
              data.tar.gz: e66b3372d2204d83917c65974e6eef811ab4c049cd242b2858dc15a2a8f1a16a2e4571cdbedd31502309be4a654f8e3d2e82add6617c31d929b1f803dc9424c1
         | 
    
        data/CHANGELOG.md
    ADDED
    
    | @@ -0,0 +1,25 @@ | |
| 1 | 
            +
            # Clicksign::API 1.1.0 (Octuber 29, 2021)
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Add support to multiple credentials.
         | 
| 4 | 
            +
            This is useful to work with different environments, providing flexibility.
         | 
| 5 | 
            +
            For example, applications have different tokens for each environment.
         | 
| 6 | 
            +
            Other useful case, occurs working with multiple companies.
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            The credentials should be a hash. 
         | 
| 9 | 
            +
            It is possible use a `.yml` file to configure the authentication tokens.
         | 
| 10 | 
            +
            The `.yml` file can get the tokens using environment variables.
         | 
| 11 | 
            +
            Now all requests receive token parameter, that represents the key associated with the token.
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            ## Examples:
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            YML file
         | 
| 16 | 
            +
            ```ruby
         | 
| 17 | 
            +
            => key.production: ENV['CLICKSIGN_ACCESS_TOKEN_PRODUCTION']
         | 
| 18 | 
            +
            => key.sandbox:    ENV['CLICKSIGN_ACCESS_TOKEN_SANDBOX']
         | 
| 19 | 
            +
            ```
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            Request:
         | 
| 22 | 
            +
            ```ruby
         | 
| 23 | 
            +
            => file = File.open('/path/to/file/local/file.pdf', 'r')
         | 
| 24 | 
            +
            => response = Clicksign::API::Document.create( params: { path: '/path/to/file/on/clicksign.pdf', file: file }, token: 'key.production')
         | 
| 25 | 
            +
            ```
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -26,8 +26,14 @@ Or install it yourself as: | |
| 26 26 | 
             
            By default, all requests use Clicksign's SANDBOX.
         | 
| 27 27 |  | 
| 28 28 | 
             
            ```ruby
         | 
| 29 | 
            +
            credentials = {
         | 
| 30 | 
            +
              "key.production" => ENV["CLICKSIGN_ACCESS_TOKEN_PRODUCTION"]
         | 
| 31 | 
            +
              "key.sandbox" => ENV["CLICKSIGN_ACCESS_TOKEN_SANDBOX"]
         | 
| 32 | 
            +
            }
         | 
| 33 | 
            +
             | 
| 29 34 | 
             
            Clicksign::API.configure do |config|
         | 
| 30 | 
            -
              config. | 
| 35 | 
            +
              config.credentials = credentials
         | 
| 36 | 
            +
              config.production = false
         | 
| 31 37 | 
             
            end
         | 
| 32 38 | 
             
            ```
         | 
| 33 39 |  | 
| @@ -47,41 +53,102 @@ To see all available parameters, please, check the [API docs](https://developers | |
| 47 53 | 
             
            #### Create documents
         | 
| 48 54 |  | 
| 49 55 | 
             
            ```ruby
         | 
| 50 | 
            -
             | 
| 56 | 
            +
            file = File.open('/path/to/file/local/file.pdf', 'r')
         | 
| 57 | 
            +
            document = Clicksign::API::Document.create( params: { path: '/path/to/file/on/clicksign.pdf', file: file }, token: 'valid_token')
         | 
| 51 58 | 
             
            => #<Faraday::Response ...>
         | 
| 52 59 |  | 
| 53 | 
            -
             | 
| 60 | 
            +
            document.success?
         | 
| 54 61 | 
             
            => true # false
         | 
| 55 62 |  | 
| 56 | 
            -
            JSON.parse( | 
| 63 | 
            +
            response_document = JSON.parse(document.body)
         | 
| 57 64 | 
             
            => {:document=> {:key=> '...', :path=> '...', :status => '...', ... }
         | 
| 65 | 
            +
            => # key: '123abcd' as example!
         | 
| 58 66 | 
             
            ```
         | 
| 59 67 |  | 
| 60 68 | 
             
            #### View documents
         | 
| 61 69 |  | 
| 62 70 | 
             
            ```ruby
         | 
| 63 | 
            -
             | 
| 71 | 
            +
            find_document = Clicksign::API::Document.find(params: { key: response_document['document']['key'] }, token: 'valid_token')
         | 
| 64 72 | 
             
            => #<Faraday::Response ...>
         | 
| 65 73 |  | 
| 66 | 
            -
             | 
| 74 | 
            +
            find_document.success?
         | 
| 67 75 | 
             
            => true # false
         | 
| 68 76 |  | 
| 69 | 
            -
            JSON.parse( | 
| 77 | 
            +
            JSON.parse(find_document.body)
         | 
| 70 78 | 
             
            => {:document=> {:key=> '...', :path=> '...', :status => '...', ... }
         | 
| 71 79 | 
             
            ```
         | 
| 72 80 |  | 
| 73 | 
            -
            ####  | 
| 81 | 
            +
            #### Create Signers
         | 
| 74 82 |  | 
| 75 83 | 
             
            ```ruby
         | 
| 76 | 
            -
             | 
| 84 | 
            +
            signer = Clicksign::API::Signer.create(params: { email: 'mail@email.com', auths: ['email'], delivery: 'email' }, token: 'valid_token')
         | 
| 77 85 | 
             
            => #<Faraday::Response ...>
         | 
| 78 86 |  | 
| 79 | 
            -
             | 
| 87 | 
            +
            signer.success?
         | 
| 80 88 | 
             
            => true # false
         | 
| 81 89 |  | 
| 82 | 
            -
            JSON.parse( | 
| 90 | 
            +
            response_signer = JSON.parse(signer.body)
         | 
| 83 91 | 
             
            => {:document=> {:key=> '...', :path=> '...', :status => '...', ... }
         | 
| 92 | 
            +
            => # signer_key: '999poo' as example!
         | 
| 84 93 | 
             
            ```
         | 
| 94 | 
            +
            #### Add Signers to Document
         | 
| 95 | 
            +
             | 
| 96 | 
            +
            ```ruby
         | 
| 97 | 
            +
             | 
| 98 | 
            +
            signer_document = Clicksign::API::DocumentsSigners.create(params: { document_key: response_document['document']['key'], signer_key: response_signer['key'], sign_as: 'sign_as' }, token: 'valid_token')
         | 
| 99 | 
            +
            => #<Faraday::Response ...>
         | 
| 100 | 
            +
             | 
| 101 | 
            +
            signer_document.success?
         | 
| 102 | 
            +
            => true # false
         | 
| 103 | 
            +
             | 
| 104 | 
            +
            response_signer_document = JSON.parse(signer_document.body)
         | 
| 105 | 
            +
            => {:document=> {:key=> '...', :path=> '...', :status => '...', ... }
         | 
| 106 | 
            +
              ```
         | 
| 107 | 
            +
             | 
| 108 | 
            +
            ##### Creating Documents in Batches
         | 
| 109 | 
            +
             | 
| 110 | 
            +
            ```ruby
         | 
| 111 | 
            +
             | 
| 112 | 
            +
            batch = Clicksign::API::Batch.create(params: { document_keys: [response_document['document']['key'], 'other_document_key'], signer_key: response_signer['key'], summary: true}, token: 'valid_token')
         | 
| 113 | 
            +
            => #<Faraday::Response ...>
         | 
| 114 | 
            +
             | 
| 115 | 
            +
            batch.success?
         | 
| 116 | 
            +
            => true # false
         | 
| 117 | 
            +
             | 
| 118 | 
            +
            rseponse_batch = JSON.parse(batch.body)
         | 
| 119 | 
            +
            => #{"batch"=> {"key"=>"3dd7fa89-15f7-48b6-81e8-7d14a273bbb8"
         | 
| 120 | 
            +
             | 
| 121 | 
            +
            ```
         | 
| 122 | 
            +
            #### Notifying Signer by e-mail
         | 
| 123 | 
            +
             | 
| 124 | 
            +
            ```ruby
         | 
| 125 | 
            +
            request_signature_key = JSON.parse(response_document_above.body)['document']['signers'].first['request_signature_key']
         | 
| 126 | 
            +
            notify = Clicksign::API::Notifier.notify(params: { request_signature_key: request_signature_key }, token: 'valid_token')
         | 
| 127 | 
            +
            => #<Faraday::Response ...>
         | 
| 128 | 
            +
             | 
| 129 | 
            +
            notify.success?
         | 
| 130 | 
            +
            => true # false
         | 
| 131 | 
            +
             | 
| 132 | 
            +
            JSON.parse(notify.body)
         | 
| 133 | 
            +
            => ##<struct Faraday::Env, method=:post request_body="{\"request_signature_key\":
         | 
| 134 | 
            +
             | 
| 135 | 
            +
            ```
         | 
| 136 | 
            +
             | 
| 137 | 
            +
            #### Notifying Signer by whatsapp
         | 
| 138 | 
            +
             | 
| 139 | 
            +
            ```ruby
         | 
| 140 | 
            +
            => # To deliver this content, its necessary add `phone_number` on Signer
         | 
| 141 | 
            +
             | 
| 142 | 
            +
            request_signature_key = JSON.parse(response_document_above.body)['document']['signers'].first['request_signature_key']
         | 
| 143 | 
            +
            notify = Clicksign::API::Notifier.notify(params: { request_signature_key: request_signature_key }, token: 'valid_token')
         | 
| 144 | 
            +
            => #<Faraday::Response ...>
         | 
| 145 | 
            +
             | 
| 146 | 
            +
            notify.success?
         | 
| 147 | 
            +
            => true # false
         | 
| 148 | 
            +
             | 
| 149 | 
            +
            JSON.parse(notify.body)
         | 
| 150 | 
            +
            => ##<struct Faraday::Env, method=:post request_body="{\"request_signature_key\":
         | 
| 151 | 
            +
             | 
| 85 152 |  | 
| 86 153 | 
             
            ## Development
         | 
| 87 154 |  | 
    
        data/lib/clicksign/api/batch.rb
    CHANGED
    
    
    
        data/lib/clicksign/api/signer.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: clicksign-api
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.1.0. | 
| 4 | 
            +
              version: 1.1.0.alpha6
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Francisco Martins
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2021- | 
| 11 | 
            +
            date: 2021-11-03 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -163,6 +163,7 @@ files: | |
| 163 163 | 
             
            - ".ruby-gemset"
         | 
| 164 164 | 
             
            - ".ruby-version"
         | 
| 165 165 | 
             
            - ".travis.yml"
         | 
| 166 | 
            +
            - CHANGELOG.md
         | 
| 166 167 | 
             
            - Gemfile
         | 
| 167 168 | 
             
            - Gemfile.lock
         | 
| 168 169 | 
             
            - README.md
         | 
| @@ -197,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 197 198 | 
             
                - !ruby/object:Gem::Version
         | 
| 198 199 | 
             
                  version: 1.3.1
         | 
| 199 200 | 
             
            requirements: []
         | 
| 200 | 
            -
            rubygems_version: 3. | 
| 201 | 
            +
            rubygems_version: 3.1.6
         | 
| 201 202 | 
             
            signing_key: 
         | 
| 202 203 | 
             
            specification_version: 4
         | 
| 203 204 | 
             
            summary: Clicksign API ruby interface
         |