docu_sign 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. data/.document +5 -0
  2. data/.gitignore +7 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +6 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.rdoc +20 -0
  7. data/Rakefile +1 -0
  8. data/docu_sign.example.yml +4 -0
  9. data/docu_sign.gemspec +36 -0
  10. data/lib/docu_sign/anchor_tab.rb +29 -0
  11. data/lib/docu_sign/authentication_status.rb +16 -0
  12. data/lib/docu_sign/builder/anchor_builder.rb +17 -0
  13. data/lib/docu_sign/builder/base.rb +27 -0
  14. data/lib/docu_sign/builder/document_builder.rb +16 -0
  15. data/lib/docu_sign/builder/notification_builder.rb +16 -0
  16. data/lib/docu_sign/builder/recipient_builder.rb +17 -0
  17. data/lib/docu_sign/builder/tab_builder.rb +30 -0
  18. data/lib/docu_sign/cacert.pem +3390 -0
  19. data/lib/docu_sign/client.rb +98 -0
  20. data/lib/docu_sign/docu_sign_model.rb +23 -0
  21. data/lib/docu_sign/docu_sign_response.rb +33 -0
  22. data/lib/docu_sign/document.rb +57 -0
  23. data/lib/docu_sign/document_pdf.rb +14 -0
  24. data/lib/docu_sign/document_status.rb +15 -0
  25. data/lib/docu_sign/envelope.rb +136 -0
  26. data/lib/docu_sign/envelope_status.rb +33 -0
  27. data/lib/docu_sign/error.rb +7 -0
  28. data/lib/docu_sign/extensions.rb +81 -0
  29. data/lib/docu_sign/notification.rb +21 -0
  30. data/lib/docu_sign/railtie.rb +7 -0
  31. data/lib/docu_sign/recipient.rb +61 -0
  32. data/lib/docu_sign/recipient_status.rb +25 -0
  33. data/lib/docu_sign/tab.rb +96 -0
  34. data/lib/docu_sign/tab_status.rb +17 -0
  35. data/lib/docu_sign/version.rb +3 -0
  36. data/lib/docu_sign/void_envelope_status.rb +14 -0
  37. data/lib/docu_sign.rb +37 -0
  38. data/spec/docu_sign/client_spec.rb +8 -0
  39. data/spec/docu_sign/document_spec.rb +51 -0
  40. data/spec/docu_sign/envelope_spec.rb +132 -0
  41. data/spec/docu_sign/post_processing_spec.rb +85 -0
  42. data/spec/docu_sign/sending_spec.rb +96 -0
  43. data/spec/docu_sign/status_spec.rb +146 -0
  44. data/spec/docu_sign/tab_spec.rb +32 -0
  45. data/spec/docu_sign.yml.example +4 -0
  46. data/spec/docu_sign_spec.rb +28 -0
  47. data/spec/dummy/Rakefile +7 -0
  48. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  49. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  50. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  51. data/spec/dummy/config/application.rb +45 -0
  52. data/spec/dummy/config/boot.rb +10 -0
  53. data/spec/dummy/config/database.yml +22 -0
  54. data/spec/dummy/config/environment.rb +5 -0
  55. data/spec/dummy/config/environments/development.rb +26 -0
  56. data/spec/dummy/config/environments/production.rb +49 -0
  57. data/spec/dummy/config/environments/test.rb +35 -0
  58. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  59. data/spec/dummy/config/initializers/inflections.rb +10 -0
  60. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  61. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  62. data/spec/dummy/config/initializers/session_store.rb +8 -0
  63. data/spec/dummy/config/locales/en.yml +2 -0
  64. data/spec/dummy/config/routes.rb +58 -0
  65. data/spec/dummy/config.ru +4 -0
  66. data/spec/dummy/db/test.sqlite3 +0 -0
  67. data/spec/dummy/log/development.log +0 -0
  68. data/spec/dummy/log/production.log +0 -0
  69. data/spec/dummy/log/server.log +0 -0
  70. data/spec/dummy/log/test.log +331 -0
  71. data/spec/dummy/public/404.html +26 -0
  72. data/spec/dummy/public/422.html +26 -0
  73. data/spec/dummy/public/500.html +26 -0
  74. data/spec/dummy/public/favicon.ico +0 -0
  75. data/spec/dummy/public/stylesheets/.gitkeep +0 -0
  76. data/spec/dummy/script/rails +6 -0
  77. data/spec/fixtures/document.pdf +0 -0
  78. data/spec/fixtures/vcr_cassettes/create_and_send_envelope.yml +553 -0
  79. data/spec/fixtures/vcr_cassettes/invalid_request.yml +52 -0
  80. data/spec/fixtures/vcr_cassettes/ping.yml +50 -0
  81. data/spec/fixtures/vcr_cassettes/request_document_pdfs_ex.yml +603 -0
  82. data/spec/fixtures/vcr_cassettes/request_envelope.yml +608 -0
  83. data/spec/fixtures/vcr_cassettes/request_status.yml +609 -0
  84. data/spec/fixtures/vcr_cassettes/request_status_ex.yml +614 -0
  85. data/spec/fixtures/vcr_cassettes/request_statuses.yml +1176 -0
  86. data/spec/fixtures/vcr_cassettes/void_envelope.yml +603 -0
  87. data/spec/spec_helper.rb +37 -0
  88. data/spec/support/vcr.rb +6 -0
  89. data/wsdl/dsapi.wsdl +3735 -0
  90. data/wsdl/dsapi.wsdl.old +3131 -0
  91. metadata +347 -0
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ .idea
6
+ .idea/*
7
+ spec/docu_sign.yml
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in docu_sign.gemspec
4
+ gem "savon", "0.9.9", :git => "git://github.com/rubiii/savon.git"
5
+ gem "savon_spec", "0.1.6"#, :git => "git://github.com/rubiii/savon_spec.git"
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Donald Piret
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,20 @@
1
+ = docusign
2
+
3
+ A Savon-based library for communicating with the DocuSign API:
4
+ http://www.docusign.com/developer-center/documentation
5
+
6
+ == Contributing to docusign
7
+
8
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
9
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
10
+ * Fork the project
11
+ * Start a feature/bugfix branch
12
+ * Commit and push until you are happy with your contribution
13
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
14
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
15
+
16
+ == Copyright
17
+
18
+ Copyright (c) 2011 Donald Piret. See LICENSE.txt for
19
+ further details.
20
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,4 @@
1
+ production:
2
+ username: "your username"
3
+ password: "your password"
4
+ integrator_key: "your integrator key"
data/docu_sign.gemspec ADDED
@@ -0,0 +1,36 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "docu_sign/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "docu_sign"
7
+ s.version = DocuSign::VERSION
8
+ s.authors = ["Donald Piret"]
9
+ s.email = ["donald@donaldpiret.com"]
10
+ s.homepage = "https://github.com/roomorama/docu_sign"
11
+ s.summary = %q{DocuSign API gem}
12
+ s.description = %q{Savon-based gem to interact with the DocuSign SOAP API in Ruby}
13
+ s.license = "MIT"
14
+
15
+ s.rubyforge_project = "docu_sign"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ # specify any dependencies here; for example:
23
+ # s.add_development_dependency "rspec"
24
+ # s.add_runtime_dependency "rest-client"
25
+ s.add_runtime_dependency "savon", ">= 0.9.9"
26
+ s.add_runtime_dependency "builder"
27
+
28
+ s.add_development_dependency "rspec", ">= 2.6.3"
29
+ s.add_development_dependency "rails", ">= 3.0.10"
30
+ s.add_development_dependency "capybara"
31
+ s.add_development_dependency "sqlite3"
32
+ s.add_development_dependency "debugger"
33
+ s.add_development_dependency "webmock", ">= 1.7.0"
34
+ s.add_development_dependency "savon_spec", ">= 0.1.6"
35
+ s.add_development_dependency "vcr"
36
+ end
@@ -0,0 +1,29 @@
1
+ module DocuSign
2
+ class AnchorTab < DocuSignModel
3
+ ATTRIBUTES = [:anchor_tab_string, :x_offset, :y_offset, :unit, :ignore_if_not_present]
4
+ ATTRIBUTES.each do |attr|
5
+ self.send(:attr_accessor, attr)
6
+ end
7
+ alias_attribute :string, :anchor_tab_string
8
+ alias_attribute :x, :x_offset
9
+ alias_attribute :y, :y_offset
10
+
11
+ def initialize(attributes = {})
12
+ @anchor_tab_string = attributes[:string] || attributes[:anchor_tab_string]
13
+ @x_offset = attributes[:x] || attributes[:x_offset]
14
+ @y_offset = attributes[:y] || attributes[:y_offset]
15
+ @unit = attributes[:unit]
16
+ @ignore_if_not_present = attributes[:ignore_if_not_present]
17
+ end
18
+
19
+ def to_savon
20
+ {
21
+ "AnchorTabString" => self.anchor_tab_string,
22
+ "XOffset" => self.x_offset,
23
+ "YOffset" => self.y_offset,
24
+ "Unit" => self.unit,
25
+ "IgnoreIfNotPresent" => self.ignore_if_not_present?
26
+ }.delete_if{|key, value| value.nil?}
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,16 @@
1
+ module DocuSign
2
+ class AuthenticationStatus < DocuSignModel
3
+ ATTRIBUTES = [:access_code_result, :id_question_result, :id_lookup_result, :age_verify_result, :stan_pin_result,
4
+ :ofac_result, :phone_auth_result]
5
+ ATTRIBUTES.each do |attr|
6
+ self.send(:attr_accessor, attr)
7
+ end
8
+
9
+ def initialize(attributes = {})
10
+ ATTRIBUTES.each do |attr|
11
+ self.send("#{attr}=", attributes[attr])
12
+ end
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ module DocuSign
2
+ module Builder
3
+ class AnchorBuilder < DocuSign::Builder::Base
4
+ self.builder_class = DocuSign::AnchorTab
5
+
6
+ def initialize()
7
+ super
8
+ end
9
+
10
+ #def build(options = {}, &block)
11
+ #
12
+ # super(options, &block).tap do |anchor_tab|
13
+ # end
14
+ #end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,27 @@
1
+ module DocuSign
2
+ module Builder
3
+ class Base
4
+ class << self
5
+ attr_accessor :builder_class
6
+ end
7
+
8
+ attr_accessor :object
9
+
10
+ def initialize(*args, &block); end
11
+
12
+ def build(options = {}, &block)
13
+ (self.object = builder_class.new).tap do |o|
14
+ options.each do |key, value|
15
+ o.send "#{key}=", value
16
+ end
17
+
18
+ yield o if block_given?
19
+ end
20
+ end
21
+
22
+ def builder_class
23
+ self.class.builder_class
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,16 @@
1
+ module DocuSign
2
+ module Builder
3
+ class DocumentBuilder < DocuSign::Builder::Base
4
+ self.builder_class = DocuSign::Document
5
+
6
+ def initialize()
7
+ super
8
+ end
9
+ #def build(options = {}, &block)
10
+ #
11
+ # super(options, &block).tap do |document|
12
+ # end
13
+ #end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ module DocuSign
2
+ module Builder
3
+ class NotificationBuilder < DocuSign::Builder::Base
4
+ self.builder_class = DocuSign::Notification
5
+
6
+ def initialize()
7
+ super
8
+ end
9
+
10
+ #def build(options = {}, &block)
11
+ # super(options, &block).tap do |notification|
12
+ # end
13
+ #end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ module DocuSign
2
+ module Builder
3
+ class RecipientBuilder < DocuSign::Builder::Base
4
+ self.builder_class = DocuSign::Recipient
5
+
6
+ def initialize()
7
+ super
8
+ end
9
+
10
+ #def build(options = {}, &block)
11
+ #
12
+ # super(options, &block).tap do |recipient|
13
+ # end
14
+ #end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,30 @@
1
+ module DocuSign
2
+ module Builder
3
+ class TabBuilder < DocuSign::Builder::Base
4
+ attr_accessor :document, :recipient
5
+
6
+ self.builder_class = DocuSign::Tab
7
+
8
+ def initialize(document = nil, recipient = nil)
9
+ super
10
+ self.document, self.recipient = document, recipient
11
+ end
12
+
13
+ def build(options = {}, &block)
14
+ anchor_options = options.delete(:anchor)
15
+
16
+ super(options, &block).tap do |tab|
17
+ tab.anchor anchor_options if anchor_options && !tab.anchor_tab_item
18
+ tab.document_id ||= document.id if document
19
+ tab.recipient_id ||= recipient.id if recipient
20
+
21
+ # Default tab_label to the tab name if none is explicitly given
22
+ tab.tab_label ||= tab.name
23
+
24
+ # Provide a custom tab type if none has already been provided
25
+ tab.type ||= "Custom"
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end