egree 0.0.4 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98bec1b0ecfa88f62e76834ca60a944db74a6050
4
- data.tar.gz: 45bb21a233e1b39a713a5028e3a62d098a80cbaf
3
+ metadata.gz: a0f2d7c80d917dd99f8e55c4e15384dcee04eccb
4
+ data.tar.gz: d0655650a9da89c3812b73e8700ef321a5ab7a3b
5
5
  SHA512:
6
- metadata.gz: 6eed8cb22da3db1d3c632c27014b665bef0e35fe881ae47b282a6cdd7984c5513997876530c73c1947cbe4d3e4297f09d81eeb1e678d8dfdfd93bf1ae8c98900
7
- data.tar.gz: f01926797af2159b14fdc571a8187c6aa07e05b5658f8a19c185626682cece3c4103d89493f5ab8828bb18871aab4d5e718a28da0b0544f24d52d082cab9b586
6
+ metadata.gz: 4d61499c6c2280e750e57045b9bc9b58445347f5cf6a64e51b66a2cafd1f993176b3390b57c04063b342d3e763de6a1589b0ece507e1b179f9e007b8ad701a25
7
+ data.tar.gz: 035356b9a7955d67d5d8e037c7c7c745854e4924715b0f5072d1ca8a1c41ae9d09ddb5e97ba4996f2d56c0de42fca91ca18e53b530dae74ad682e3507f5834f7
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- [![Build Status](https://travis-ci.org/joeljunstrom/egree-ruby.svg?branch=master)](https://travis-ci.org/joeljunstrom/egree-ruby)
2
- [![Code Climate](https://codeclimate.com/github/joeljunstrom/egree-ruby/badges/gpa.svg)](https://codeclimate.com/github/joeljunstrom/egree-ruby)
3
- [![Test Coverage](https://codeclimate.com/github/joeljunstrom/egree-ruby/badges/coverage.svg)](https://codeclimate.com/github/joeljunstrom/egree-ruby)
1
+ [![Build Status](https://travis-ci.org/Oktavilla/egree-ruby.svg?branch=master)](https://travis-ci.org/Oktavilla/egree-ruby)
2
+ [![Code Climate](https://codeclimate.com/github/Oktavilla/egree-ruby/badges/gpa.svg)](https://codeclimate.com/github/Oktavilla/egree-ruby)
3
+ [![Test Coverage](https://codeclimate.com/github/Oktavilla/egree-ruby/badges/coverage.svg)](https://codeclimate.com/github/Oktavilla/egree-ruby)
4
4
  [![Gem Version](https://badge.fury.io/rb/egree.svg)](http://badge.fury.io/rb/egree)
5
5
 
6
6
  # Egree
@@ -25,11 +25,18 @@ signature_case.add_party Egree::Party.new_with_attributes({
25
25
  signature_case.add_document Egree::Document.new "/some/path/file.pdf"
26
26
 
27
27
  result = egree.create_case(signature_case, {
28
+ # Egree sends a POST with the signed case as the JSON body when the signing process is finished.
28
29
  postback_url: "https://example.com/my-endpoint",
29
30
  continue: {
31
+ # user ends up here after finishing the signing process
30
32
  url: "http://example.com/user-endpoint",
31
33
  auto: true
32
- }
34
+ },
35
+ # User ends up here when cancelling, at the moment there is no cancel callback
36
+ cancel_url: "http://example.com/user-canceled",
37
+ # Procedure can be ”default” or ”form”, this changes some copy in the Egree interface.
38
+ # defaults to ”default”
39
+ procedure: "form"
33
40
  })
34
41
 
35
42
  if result.success?
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Joel Junström"]
10
10
  spec.email = ["joel.junstrom@oktavilla.se"]
11
11
  spec.summary = %q{Client for the Egree API}
12
- spec.homepage = "https://github.com/joeljunstrom/egree-ruby"
12
+ spec.homepage = "https://github.com/Oktavilla/egree-ruby"
13
13
  spec.license = "MIT"
14
14
 
15
15
  spec.required_ruby_version = "~> 2.0"
@@ -36,6 +36,8 @@ module Egree
36
36
  def self.mappers
37
37
  {
38
38
  postback_url: "CaseFinishedCallbackUrl",
39
+ cancel_url: "CancelUrl",
40
+ procedure: "Procedure",
39
41
  locale: ->(value) {
40
42
  { "Culture" => LOCALES.call(value) }
41
43
  },
@@ -5,16 +5,17 @@ module Egree
5
5
  end
6
6
 
7
7
  class Document
8
- attr_reader :path, :username, :password
8
+ attr_reader :path, :filename, :username, :password
9
9
 
10
- def initialize path, username: nil, password: nil
10
+ def initialize path, filename: nil, username: nil, password: nil
11
11
  @path = path
12
+ @filename = filename
12
13
  @username = username
13
14
  @password = password
14
15
  end
15
16
 
16
17
  def filename
17
- File.basename path
18
+ @filename || File.basename(path)
18
19
  end
19
20
 
20
21
  def size
@@ -1,3 +1,3 @@
1
1
  module Egree
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -11,6 +11,18 @@ module Egree
11
11
  })
12
12
  end
13
13
 
14
+ it "translates cancel_url to CancelUrl" do
15
+ expect(CaseOptionsMapper.to_api(cancel_url: "http://example.com")).to eq({
16
+ "CancelUrl" => "http://example.com"
17
+ })
18
+ end
19
+
20
+ it "translates procedure to Procedure" do
21
+ expect(CaseOptionsMapper.to_api(procedure: "form")).to eq({
22
+ "Procedure" => "form"
23
+ })
24
+ end
25
+
14
26
  describe "locale" do
15
27
  it "translates locale to Culture allowing sv, fi and en" do
16
28
  { "sv" => "sv-SE", "fi" => "fi-FI", "en" => "en-US" }.each do |key, locale|
@@ -43,6 +43,8 @@ module Egree
43
43
  url: "http://example.com/thanks",
44
44
  auto: true
45
45
  },
46
+ cancel_url: "http://example.com/sorry",
47
+ procedure: "form",
46
48
  locale: "sv"
47
49
  })
48
50
 
@@ -7,13 +7,26 @@ module Egree
7
7
  File.join(Dir.pwd, "spec/fixtures/agreement.pdf")
8
8
  end
9
9
 
10
+ let :fixture_contents do
11
+ File.read(fixture_path)
12
+ end
13
+
14
+
10
15
  describe "with a local file" do
11
16
  let :document do
12
17
  Document.new fixture_path
13
18
  end
14
19
 
15
- specify "#filename" do
16
- expect(document.filename).to eq "agreement.pdf"
20
+ describe "#filename" do
21
+ it "defaults to the file's basename" do
22
+ expect(document.filename).to eq "agreement.pdf"
23
+ end
24
+
25
+ it "can be set in the constructor" do
26
+ document = Document.new fixture_path, filename: "special-agreement.pdf"
27
+
28
+ expect(document.filename).to eq "special-agreement.pdf"
29
+ end
17
30
  end
18
31
 
19
32
  specify "#size" do
@@ -30,14 +43,6 @@ module Egree
30
43
  end
31
44
 
32
45
  describe "#with an url" do
33
- let :fixture_path do
34
- File.join(Dir.pwd, "spec/fixtures/agreement.pdf")
35
- end
36
-
37
- let :fixture_contents do
38
- File.read(fixture_path)
39
- end
40
-
41
46
  before do
42
47
  stub_request(:get, "http://example.com/files/remote_agreement.pdf").to_return({
43
48
  status: 200,
@@ -62,7 +67,6 @@ module Egree
62
67
  end
63
68
 
64
69
  it "has the file data encoded as base64" do
65
- fixture_path = File.join(Dir.pwd, "spec/fixtures/agreement.pdf")
66
70
  expect(document.data).to eq Base64.encode64(fixture_contents)
67
71
  end
68
72
 
@@ -109,7 +113,7 @@ module Egree
109
113
  end
110
114
 
111
115
  it "adds form fields" do
112
- document = Document.new fixture_path
116
+ document = Document.new fixture_contents
113
117
  form_field = double "FormField", name: "FieldName", value: "Some Value"
114
118
 
115
119
  document.add_form_field form_field
@@ -23,17 +23,19 @@ http_interactions:
23
23
  {
24
24
  "Name": "First Last",
25
25
  "EmailAddress": "name@example.com",
26
- "SocialSecurityNumber": "5212172760"
26
+ "SocialSecurityNumber": "6907183385"
27
27
  }
28
28
  ],
29
29
  "AllowedSignatureTypes": [
30
30
  "touch"
31
31
  ],
32
- "CaseReferenceId": "238c0cc3-8c66-4ff4-bf75-65ee264b1001",
32
+ "CaseReferenceId": "bc5db0db-f9eb-4eaf-9e9a-28bd388d6709",
33
33
  "CaseFinishedCallbackUrl": "http://example.com/postback",
34
34
  "ContinueName": "Back to the site",
35
35
  "ContinueUrl": "http://example.com/thanks",
36
36
  "ContinueAuto": true,
37
+ "CancelUrl": "http://example.com/sorry",
38
+ "Procedure": "form",
37
39
  "Culture": "sv-SE"
38
40
  }
39
41
  headers:
@@ -57,16 +59,16 @@ http_interactions:
57
59
  Strict-Transport-Security:
58
60
  - max-age=31536000
59
61
  Set-Cookie:
60
- - ASP.NET_SessionId=xlsxyoeej5dfrorj3uwk2tzc; path=/; HttpOnly
62
+ - ASP.NET_SessionId=zfvvwbympf0ovrovwd1cru1t; path=/; HttpOnly
61
63
  X-Aspnet-Version:
62
64
  - 4.0.30319
63
65
  Date:
64
- - Fri, 03 Oct 2014 09:12:40 GMT
66
+ - Mon, 17 Nov 2014 14:56:25 GMT
65
67
  Content-Length:
66
68
  - '0'
67
69
  body:
68
70
  encoding: UTF-8
69
71
  string: ''
70
72
  http_version:
71
- recorded_at: Fri, 03 Oct 2014 09:13:19 GMT
73
+ recorded_at: Mon, 17 Nov 2014 14:56:44 GMT
72
74
  recorded_with: VCR 2.9.2
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: egree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Junström
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-03 00:00:00.000000000 Z
11
+ date: 2014-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -177,7 +177,7 @@ files:
177
177
  - spec/fixtures/cassettes/Egree_Client/_get_case_url/case_exists.yml
178
178
  - spec/fixtures/cassettes/Egree_Client/_get_case_url/case_missing.yml
179
179
  - spec/spec_helper.rb
180
- homepage: https://github.com/joeljunstrom/egree-ruby
180
+ homepage: https://github.com/Oktavilla/egree-ruby
181
181
  licenses:
182
182
  - MIT
183
183
  metadata: {}
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  version: '0'
198
198
  requirements: []
199
199
  rubyforge_project:
200
- rubygems_version: 2.2.1
200
+ rubygems_version: 2.0.14
201
201
  signing_key:
202
202
  specification_version: 4
203
203
  summary: Client for the Egree API