signatory 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
5
+ gemfile:
6
+ - gemfiles/activesupport3.0.gemfile
7
+ - gemfiles/activesupport3.2.gemfile
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- signatory (0.0.7)
4
+ signatory (0.0.8)
5
5
  activeresource (>= 2.3.9)
6
6
  bundler (>= 1.0.0)
7
7
  oauth (= 0.4.3)
@@ -9,19 +9,29 @@ PATH
9
9
  GEM
10
10
  remote: http://rubygems.org/
11
11
  specs:
12
- activemodel (3.0.5)
13
- activesupport (= 3.0.5)
14
- builder (~> 2.1.2)
15
- i18n (~> 0.4)
16
- activeresource (3.0.5)
17
- activemodel (= 3.0.5)
18
- activesupport (= 3.0.5)
19
- activesupport (3.0.5)
12
+ activemodel (3.2.8)
13
+ activesupport (= 3.2.8)
14
+ builder (~> 3.0.0)
15
+ activeresource (3.2.8)
16
+ activemodel (= 3.2.8)
17
+ activesupport (= 3.2.8)
18
+ activesupport (3.2.8)
19
+ i18n (~> 0.6)
20
+ multi_json (~> 1.0)
20
21
  addressable (2.2.4)
21
- builder (2.1.2)
22
+ builder (3.0.3)
23
+ columnize (0.3.6)
22
24
  crack (0.1.8)
25
+ debugger (1.2.0)
26
+ columnize (>= 0.3.1)
27
+ debugger-linecache (~> 1.1.1)
28
+ debugger-ruby_core_source (~> 1.1.3)
29
+ debugger-linecache (1.1.2)
30
+ debugger-ruby_core_source (>= 1.1.1)
31
+ debugger-ruby_core_source (1.1.3)
23
32
  diff-lcs (1.1.2)
24
- i18n (0.5.0)
33
+ i18n (0.6.1)
34
+ multi_json (1.3.6)
25
35
  oauth (0.4.3)
26
36
  rake (0.8.7)
27
37
  rspec (2.5.0)
@@ -41,6 +51,7 @@ PLATFORMS
41
51
 
42
52
  DEPENDENCIES
43
53
  bundler (>= 1.0.0)
54
+ debugger
44
55
  rake
45
56
  rspec (= 2.5.0)
46
57
  signatory!
@@ -4,6 +4,8 @@
4
4
 
5
5
  formerly profounder/signatory
6
6
 
7
+ {<img src="https://secure.travis-ci.org/rgarver/signatory.png" />}[http://travis-ci.org/rgarver/signatory]
8
+
7
9
  == DESCRIPTION:
8
10
 
9
11
  A library to simplify interactions with the RightSignature API. One of the primary goals of this library is to make the workflow clear to developers for using some of the more interesting features of the RightSignature system, eg: templates, document merges, and embedded signature frames.
@@ -0,0 +1,9 @@
1
+ source :rubygems
2
+
3
+ gem 'bundler'
4
+ gem 'rake'
5
+ gem 'rspec', '= 2.5.0'
6
+ gem 'webmock', '= 1.3.5'
7
+
8
+ gem 'oauth', '= 0.4.3'
9
+ gem 'activeresource', '~> 3.0.5'
@@ -0,0 +1,9 @@
1
+ source :rubygems
2
+
3
+ gem 'bundler'
4
+ gem 'rake'
5
+ gem 'rspec', '= 2.5.0'
6
+ gem 'webmock', '= 1.3.5'
7
+
8
+ gem 'oauth', '= 0.4.3'
9
+ gem 'activeresource', '~> 3.2.8'
@@ -2,11 +2,19 @@ module Signatory
2
2
  module API
3
3
  class Base < ActiveResource::Base
4
4
  self.site = 'https://rightsignature.com/api/'
5
+ self.format = :xml
6
+ self.headers["User-Agent"] = "Ruby/Signatory #{Signatory::VERSION}"
7
+ set_primary_key :guid
8
+ class_attribute :__has_many if respond_to?(:class_attribute)
5
9
 
6
10
  def id
7
11
  guid
8
12
  end
9
13
 
14
+ def persisted?
15
+ attributes[:guid].present?
16
+ end
17
+
10
18
  class << self
11
19
  def escape_url_attrs(*attrs)
12
20
  attrs.each do |attr|
@@ -20,16 +28,30 @@ module Signatory
20
28
  end
21
29
  end
22
30
 
23
- def has_many(sym)
24
- self.write_inheritable_attribute(:__has_many, (read_inheritable_attribute(:__has_many)||[])+[sym])
25
- end
31
+ if respond_to?(:class_attribute)
32
+ def has_many(sym)
33
+ self.__has_many = (self.__has_many || []) + [sym]
34
+ end
35
+
36
+ def instantiate_record(record, opts={})
37
+ (self.__has_many||[]).each do |sym|
38
+ record[sym.to_s] = [record[sym.to_s].try(:[],sym.to_s.singularize)].flatten.compact unless record[sym.to_s].is_a?(Array)
39
+ end
26
40
 
27
- def instantiate_record(record, opts={})
28
- (self.read_inheritable_attribute(:__has_many)||[]).each do |sym|
29
- record[sym.to_s] = [record[sym.to_s].try(:[],sym.to_s.singularize)].flatten.compact unless record[sym.to_s].is_a?(Array)
41
+ super(record, opts)
42
+ end
43
+ else
44
+ def has_many(sym)
45
+ self.write_inheritable_attribute(:__has_many, (read_inheritable_attribute(:__has_many)||[])+[sym])
30
46
  end
31
47
 
32
- super(record, opts)
48
+ def instantiate_record(record, opts={})
49
+ (self.read_inheritable_attribute(:__has_many)||[]).each do |sym|
50
+ record[sym.to_s] = [record[sym.to_s].try(:[],sym.to_s.singularize)].flatten.compact unless record[sym.to_s].is_a?(Array)
51
+ end
52
+
53
+ super(record, opts)
54
+ end
33
55
  end
34
56
 
35
57
  def instantiate_collection(collection, opts)
@@ -49,7 +71,8 @@ module Signatory
49
71
 
50
72
  def connection(refresh = false)
51
73
  if defined?(@connection) || superclass == Object
52
- @connection = Signatory::API::Connection.new(site, format) if refresh || @connection.nil?
74
+ @connection = Signatory::API::Connection.new(site, format) if !@_signatory_connection || refresh || @connection.nil?
75
+ @_signatory_connection = true
53
76
  @connection.proxy = proxy if proxy
54
77
  @connection.user = user if user
55
78
  @connection.password = password if password
@@ -11,4 +11,4 @@ module Signatory
11
11
  end
12
12
  end
13
13
  end
14
- end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module Signatory
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.add_development_dependency "bundler", ">= 1.0.0"
18
18
  s.add_development_dependency "rspec", "= 2.5.0"
19
19
  s.add_development_dependency "webmock", "= 1.3.5"
20
+ s.add_development_dependency "debugger"
20
21
 
21
22
  s.add_dependency "bundler", ">= 1.0.0"
22
23
  s.add_dependency "oauth", "= 0.4.3"
@@ -8,25 +8,25 @@ describe Signatory do
8
8
  Signatory.credentials.key.should == 'XXX'
9
9
  Signatory.credentials.secret.should == 'YYY'
10
10
  end
11
-
11
+
12
12
  it "takes a read-able object" do
13
13
  file = StringIO.new("---\nkey: thekey\nsecret: thesecret\naccess_token: accesstoken\naccess_secret: accesssecret")
14
14
  Signatory.credentials = file
15
15
  Signatory.credentials.key.should == 'thekey'
16
16
  Signatory.credentials.secret.should == 'thesecret'
17
17
  end
18
-
18
+
19
19
  it "takes a hash" do
20
20
  Signatory.credentials = {:key => 'key1', :secret => 'secret1', :access_token => 'accesstoken', :access_secret => 'accesssecret'}
21
21
  Signatory.credentials.key.should == 'key1'
22
22
  Signatory.credentials.secret.should == 'secret1'
23
23
  end
24
24
  end
25
-
25
+
26
26
  it "uses oauth" do
27
27
  token = Signatory.credentials.token
28
- token.should_receive(:get).with('/api/documents/123.xml', {"Accept"=>"application/xml"}).and_return(mock('result', :code => 200, :body => '<document><name>Test</name></document>'))
28
+ token.should_receive(:get).with('/api/documents/123.xml', hash_including({"Accept"=>"application/xml"})).and_return(mock('result', :code => 200, :body => '<document><name>Test</name></document>'))
29
29
 
30
30
  Signatory::Document.find('123')
31
31
  end
32
- end
32
+ end
@@ -1,4 +1,9 @@
1
1
  require 'rubygems'
2
+ begin
3
+ require 'debugger'
4
+ rescue LoadError
5
+ puts "Debugger is disabled"
6
+ end
2
7
  require 'stringio'
3
8
  require 'rspec'
4
9
  begin
@@ -22,4 +27,4 @@ Rspec.configure do |c|
22
27
  c.before(:each) do
23
28
  Signatory.credentials = {:key => 'key1', :secret => 'secret1', :access_token => 'accesstoken', :access_secret => 'accesssecret'}
24
29
  end
25
- end
30
+ end
@@ -14,7 +14,7 @@ describe Signatory::Template do
14
14
  subjects.should include("Template Subject 2")
15
15
  end
16
16
  end
17
-
17
+
18
18
  describe ".find by id" do
19
19
  it "returns the template with the specified id" do
20
20
  stub_template('xxxyyy', :subject => 'Blah blah')
@@ -22,36 +22,36 @@ describe Signatory::Template do
22
22
  temp.subject.should == 'Blah blah'
23
23
  end
24
24
  end
25
-
25
+
26
26
  describe ".prepackage" do
27
27
  it "should have roles and merge fields" do
28
28
  temp = Signatory::Template.new(:guid => 'xxxyyy', :subject => 'Blah blah')
29
29
  stub_prepackage('xxxyyy', 'yyyxxx')
30
30
  packaged_temp = temp.prepackage
31
-
31
+
32
32
  packaged_temp.roles.map(&:role).should include('Employer')
33
33
  packaged_temp.merge_fields.map(&:name).should include('Company Name')
34
34
  packaged_temp.id.should == 'yyyxxx'
35
35
  end
36
36
  end
37
-
37
+
38
38
  describe ".build_document" do
39
39
  it "returns a new document" do
40
40
  temp = Signatory::Template.new(:guid => 'xxxyyy', :subject => 'Blah blah')
41
41
  doc_pkg = Signatory::DocumentPackage.new(:guid => 'abcabc', :type => 'DocumentPackage')
42
42
  doc = Signatory::Document.new
43
-
43
+
44
44
  roles = [{:name => "Ryan Garver"}, {:name => "Cary Dunn"}]
45
45
  merge_fields = {'Company Name' => 'ABC Corp'}
46
-
46
+
47
47
  temp.should_receive(:prepackage).and_return(doc_pkg)
48
48
  doc_pkg.should_receive(:prefill_and_send).with(merge_fields, roles).and_return(doc)
49
-
49
+
50
50
  result = temp.build_document(merge_fields, roles)
51
51
  result.should == doc
52
52
  end
53
53
  end
54
-
54
+
55
55
  describe "#merge_fields" do
56
56
  it "returns empty array when there are none" do
57
57
  stub_template('123', :no_merge_fields => true)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: signatory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-17 00:00:00.000000000Z
12
+ date: 2012-09-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
- requirement: &70134095110220 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,32 +21,63 @@ dependencies:
21
21
  version: 1.0.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70134095110220
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.0.0
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rspec
27
- requirement: &70134095109760 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
- - - =
35
+ - - '='
31
36
  - !ruby/object:Gem::Version
32
37
  version: 2.5.0
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70134095109760
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - '='
44
+ - !ruby/object:Gem::Version
45
+ version: 2.5.0
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: webmock
38
- requirement: &70134095109300 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
- - - =
51
+ - - '='
42
52
  - !ruby/object:Gem::Version
43
53
  version: 1.3.5
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *70134095109300
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.3.5
62
+ - !ruby/object:Gem::Dependency
63
+ name: debugger
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
47
78
  - !ruby/object:Gem::Dependency
48
79
  name: bundler
49
- requirement: &70134095108840 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
50
81
  none: false
51
82
  requirements:
52
83
  - - ! '>='
@@ -54,21 +85,31 @@ dependencies:
54
85
  version: 1.0.0
55
86
  type: :runtime
56
87
  prerelease: false
57
- version_requirements: *70134095108840
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: 1.0.0
58
94
  - !ruby/object:Gem::Dependency
59
95
  name: oauth
60
- requirement: &70134095108380 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
61
97
  none: false
62
98
  requirements:
63
- - - =
99
+ - - '='
64
100
  - !ruby/object:Gem::Version
65
101
  version: 0.4.3
66
102
  type: :runtime
67
103
  prerelease: false
68
- version_requirements: *70134095108380
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - '='
108
+ - !ruby/object:Gem::Version
109
+ version: 0.4.3
69
110
  - !ruby/object:Gem::Dependency
70
111
  name: activeresource
71
- requirement: &70134095138880 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
72
113
  none: false
73
114
  requirements:
74
115
  - - ! '>='
@@ -76,7 +117,12 @@ dependencies:
76
117
  version: 2.3.9
77
118
  type: :runtime
78
119
  prerelease: false
79
- version_requirements: *70134095138880
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: 2.3.9
80
126
  description: Signatory provides a simple wrapper around the RightSignature API.
81
127
  email:
82
128
  - ragarver@gmail.com
@@ -86,11 +132,14 @@ extra_rdoc_files: []
86
132
  files:
87
133
  - .gitignore
88
134
  - .rvmrc
135
+ - .travis.yml
89
136
  - Gemfile
90
137
  - Gemfile.lock
91
138
  - History.txt
92
139
  - README.rdoc
93
140
  - Rakefile
141
+ - gemfiles/activesupport3.0.gemfile
142
+ - gemfiles/activesupport3.2.gemfile
94
143
  - lib/signatory.rb
95
144
  - lib/signatory/api/base.rb
96
145
  - lib/signatory/api/connection.rb
@@ -141,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
190
  version: 1.3.6
142
191
  requirements: []
143
192
  rubyforge_project: signatory
144
- rubygems_version: 1.8.6
193
+ rubygems_version: 1.8.24
145
194
  signing_key:
146
195
  specification_version: 3
147
196
  summary: API wrapper for RightSignature