docusign 0.5.4 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,84 @@
1
+ = docusign
2
+
3
+ http://www.docusign.com
4
+ http://www.github.com/texel/docusign
5
+
6
+ == Description
7
+
8
+ A library for communicating with the Docusign API via SOAP.
9
+
10
+ == Making An API Call
11
+
12
+ connection = Docusign::Base.login(
13
+ :user_name => 'your_user_name',
14
+ :password => 'your_password',
15
+ :endpoint_url => 'http://demo.docusign.net/API/3.0'
16
+ )
17
+
18
+ connection.request_status :envelope_id => '12345'
19
+
20
+ == Install
21
+
22
+ 1. $ gem update --system (this is only necessary if you don't have rubygems 1.3.6 or newer)
23
+ 2. $ gem install docusign
24
+
25
+ == AutoCamelize
26
+
27
+ The Docusign gem supports calling methods using both camelCase and snake_case. Methods in snake_case
28
+ that don't exist on a Docusign module class or instance are automatically aliased to their camelCase
29
+ equivalent, if one exists. Hence, the following two examples are functionally identical:
30
+
31
+ connection.request_status :envelopeID => '12345'
32
+ connection.requestStatus :envelopeID => '12345'
33
+
34
+ == Builder syntax
35
+
36
+ To ease common tasks, some builder methods are included. For example, you can generate tabs for a
37
+ document for a particular recipient from the document itself:
38
+
39
+ recipient = Docusign::Recipient.new # You may want to set some attributes of the recipient as well.
40
+ document = Docusign::Document.new
41
+
42
+ tabs = document.tabs recipient do |d|
43
+ d.tab :name => 'email', :value => email, :page => 1, :x => 190, :y => 186
44
+ d.tab :name => 'phone', :value => phone, :anchor => {:string => 'Phone:', :x_offset => 200, :y_offset => -2}
45
+ d.tab :type => Docusign::TabTypeCode::FullName, :page => 1, :x => 190, :y => 118
46
+ end
47
+
48
+ These tabs will be pre-populated with both the document's and recipient's id.
49
+ Note that passing in a recipient to the builder is optional- you can still specify or override the recipient
50
+ for an individual tab:
51
+
52
+ tabs = document.tabs do |d|
53
+ d.tab :recipient => signer_1, :name => 'email', :value => email, :page => 1, :x => 190, :y => 186
54
+ d.tab :recipient => signer_2, :name => 'email', :value => email, :page => 1, :x => 190, :y => 186
55
+ end
56
+
57
+ You can also use block syntax for the tabs themselves:
58
+
59
+ tabs = document.tabs recipient do |d|
60
+ d.tab do |t|
61
+ t.name = 'phone'
62
+ t.anchor do |a|
63
+ a.string = 'Phone'
64
+ a.x_offset = 200
65
+ end
66
+ end
67
+ end
68
+
69
+ == License
70
+
71
+ Copyright (C) DocuSign, Inc. All rights reserved.
72
+
73
+ This source code is intended only as a supplement to DocuSign SDK
74
+ and/or on-line documentation.
75
+
76
+ This sample is designed to demonstrate DocuSign features and is not intended
77
+ for production use. Code and policy for a production application must be
78
+ developed to meet the specific data and security requirements of the
79
+ application.
80
+
81
+ THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
82
+ KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
83
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
84
+ PARTICULAR PURPOSE.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.4
1
+ 0.6.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{docusign}
8
- s.version = "0.5.4"
8
+ s.version = "0.6.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Leigh Caplan"]
12
- s.date = %q{2010-03-27}
12
+ s.date = %q{2010-04-13}
13
13
  s.default_executable = %q{docusign}
14
14
  s.description = %q{A library for working with the Docusign API and associated objects.
15
15
  Provides SOAP4R-generated proxy classes, and extends many useful classes
@@ -18,12 +18,12 @@ with familiar Ruby-like syntax.
18
18
  s.email = %q{texel1@gmail.com}
19
19
  s.executables = ["docusign"]
20
20
  s.extra_rdoc_files = [
21
- "README.txt"
21
+ "README.rdoc"
22
22
  ]
23
23
  s.files = [
24
24
  ".gitignore",
25
25
  "History.txt",
26
- "README.txt",
26
+ "README.rdoc",
27
27
  "Rakefile",
28
28
  "VERSION",
29
29
  "bin/docusign",
@@ -45,6 +45,7 @@ with familiar Ruby-like syntax.
45
45
  "lib/docusign/docusignDriver.rb",
46
46
  "lib/docusign/docusignMappingRegistry.rb",
47
47
  "lib/docusign/extensions.rb",
48
+ "lib/docusign/integrators_key_auth_header_handler.rb",
48
49
  "lib/docusign/request_recipient_token_client_urls.rb",
49
50
  "lib/docusign/tab.rb",
50
51
  "lib/docusign/utilities.rb",
@@ -25,6 +25,7 @@ require 'docusign/docusignMappingRegistry'
25
25
  require 'docusign/docusignDriver'
26
26
  require 'docusign/base'
27
27
  require 'docusign/auth_header_handler'
28
+ require 'docusign/integrators_key_auth_header_handler'
28
29
  require 'docusign/credential'
29
30
  require 'docusign/credentialDriver'
30
31
  require 'docusign/credentialMappingRegistry'
@@ -20,10 +20,19 @@ module Docusign
20
20
  def login(options={})
21
21
 
22
22
  connection = Docusign::APIServiceSoap.new
23
- header = AuthHeaderHandler.new(
24
- :user_name => options.delete(:user_name),
25
- :password => options.delete(:password)
26
- )
23
+
24
+ if options[:integrators_key]
25
+ header = IntegratorsKeyAuthHeaderHandler.new(
26
+ :email => options.delete(:email),
27
+ :integrators_key => options.delete(:integrators_key),
28
+ :password => options.delete(:password)
29
+ )
30
+ else
31
+ header = AuthHeaderHandler.new(
32
+ :user_name => options.delete(:user_name),
33
+ :password => options.delete(:password)
34
+ )
35
+ end
27
36
 
28
37
  connection.headerhandler << header
29
38
 
@@ -6,6 +6,24 @@
6
6
  # is found, we alias the snake_case method on the
7
7
  # class, to avoid tripping method_missing for the same
8
8
  # method in the future.
9
+ module ConstEnhancements
10
+ def const_descendants
11
+ constants.reject { |c| c == 'Enumerator' }.inject([]) do |collection, constant|
12
+ c = const_get(constant)
13
+ collection << c
14
+
15
+ if [Module, Class].include?(c.class)
16
+ collection + c.const_descendants
17
+ else
18
+ collection
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ [Module, Class].each do |i|
25
+ i.send :include, ConstEnhancements
26
+ end
9
27
 
10
28
  module AutoCamelize
11
29
  def method_missing(method_name, *args, &block)
@@ -34,8 +52,12 @@ module AutoCamelize
34
52
  end
35
53
  end
36
54
 
37
- Docusign.constants.each do |c|
38
- constant = Docusign.const_get c
55
+ constants = Docusign.constants
56
+
57
+ # Recursively collect nested credential constants
58
+ constants = constants.map { |c| Docusign.const_get(c) } + Docusign::Credential.const_descendants
59
+
60
+ constants.each do |constant|
39
61
  if constant.is_a? Class
40
62
  constant.send :include, AutoCamelize
41
63
  constant.extend AutoCamelize
@@ -0,0 +1,41 @@
1
+ # Copyright (C) DocuSign, Inc. All rights reserved.
2
+ #
3
+ # This source code is intended only as a supplement to DocuSign SDK
4
+ # and/or on-line documentation.
5
+ #
6
+ # This sample is designed to demonstrate DocuSign features and is not intended
7
+ # for production use. Code and policy for a production application must be
8
+ # developed to meet the specific data and security requirements of the
9
+ # application.
10
+ #
11
+ # THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
12
+ # KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
14
+ # PARTICULAR PURPOSE.
15
+
16
+ require 'soap/header/simplehandler'
17
+
18
+ module Docusign
19
+ class IntegratorsKeyAuthHeaderHandler < SOAP::Header::SimpleHandler
20
+ NAMESPACE = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'
21
+
22
+ attr_accessor :attributes
23
+
24
+ def initialize(options={})
25
+ self.attributes = options
26
+
27
+ super(XSD::QName.new(NAMESPACE, 'Security'))
28
+ end
29
+
30
+ def on_simple_outbound
31
+ if attributes[:integrators_key] && attributes[:email]
32
+ {
33
+ 'UsernameToken' => {
34
+ 'Username' => "[#{attributes[:integrators_key]}]#{attributes[:email]}",
35
+ 'Password' => attributes[:password]
36
+ }
37
+ }
38
+ end
39
+ end
40
+ end
41
+ end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 5
8
- - 4
9
- version: 0.5.4
7
+ - 6
8
+ - 0
9
+ version: 0.6.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Leigh Caplan
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-27 00:00:00 -07:00
17
+ date: 2010-04-13 00:00:00 -07:00
18
18
  default_executable: docusign
19
19
  dependencies: []
20
20
 
@@ -29,11 +29,11 @@ executables:
29
29
  extensions: []
30
30
 
31
31
  extra_rdoc_files:
32
- - README.txt
32
+ - README.rdoc
33
33
  files:
34
34
  - .gitignore
35
35
  - History.txt
36
- - README.txt
36
+ - README.rdoc
37
37
  - Rakefile
38
38
  - VERSION
39
39
  - bin/docusign
@@ -55,6 +55,7 @@ files:
55
55
  - lib/docusign/docusignDriver.rb
56
56
  - lib/docusign/docusignMappingRegistry.rb
57
57
  - lib/docusign/extensions.rb
58
+ - lib/docusign/integrators_key_auth_header_handler.rb
58
59
  - lib/docusign/request_recipient_token_client_urls.rb
59
60
  - lib/docusign/tab.rb
60
61
  - lib/docusign/utilities.rb
data/README.txt DELETED
@@ -1,43 +0,0 @@
1
- = docusign
2
-
3
- http://www.docusign.com
4
- http://www.github.com/texel/docusign
5
-
6
- == DESCRIPTION:
7
-
8
- A library for communicating with the Docusign API via SOAP.
9
-
10
- == SYNOPSIS:
11
-
12
- connection = Docusign::Base.login(
13
- :user_name => 'your_user_name',
14
- :password => 'your_password',
15
- :endpoint_url => 'http://demo.docusign.net/API/3.0'
16
- )
17
-
18
- connection.requestStatus :envelopeID => '12345'
19
-
20
- == INSTALL:
21
- 1) $ gem sources -a http://gems.github.com (you only have to do this once)
22
- 2) $ sudo gem install texel-docusign
23
-
24
- == TO DOCUMENT:
25
- - AutoCamelize
26
- - Tab/Anchor Builders
27
-
28
- == LICENSE:
29
-
30
- Copyright (C) DocuSign, Inc. All rights reserved.
31
-
32
- This source code is intended only as a supplement to DocuSign SDK
33
- and/or on-line documentation.
34
-
35
- This sample is designed to demonstrate DocuSign features and is not intended
36
- for production use. Code and policy for a production application must be
37
- developed to meet the specific data and security requirements of the
38
- application.
39
-
40
- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
41
- KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
42
- IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
43
- PARTICULAR PURPOSE.