groupdocs 1.2.11 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. data/.travis.yml +2 -0
  2. data/Gemfile +1 -1
  3. data/README.md +0 -2
  4. data/Rakefile +1 -1
  5. data/examples/api-samples/Gemfile +1 -1
  6. data/examples/api-samples/samples/annotation-sample.rb +50 -0
  7. data/examples/api-samples/samples/sample18.rb +11 -2
  8. data/examples/api-samples/samples/sample19.rb +58 -0
  9. data/examples/api-samples/samples/sample20.rb +50 -0
  10. data/examples/api-samples/samples/sample21.rb +65 -0
  11. data/examples/api-samples/samples/sample22.rb +52 -0
  12. data/examples/api-samples/views/annotation_sample.haml +64 -0
  13. data/examples/api-samples/views/index.haml +8 -0
  14. data/examples/api-samples/views/sample1.haml +9 -1
  15. data/examples/api-samples/views/sample10.haml +9 -1
  16. data/examples/api-samples/views/sample11.haml +10 -0
  17. data/examples/api-samples/views/sample12.haml +8 -0
  18. data/examples/api-samples/views/sample13.haml +8 -0
  19. data/examples/api-samples/views/sample14.haml +8 -0
  20. data/examples/api-samples/views/sample15.haml +8 -0
  21. data/examples/api-samples/views/sample16.haml +8 -0
  22. data/examples/api-samples/views/sample17.haml +8 -0
  23. data/examples/api-samples/views/sample18.haml +11 -0
  24. data/examples/api-samples/views/sample19.haml +102 -0
  25. data/examples/api-samples/views/sample2.haml +9 -1
  26. data/examples/api-samples/views/sample20.haml +89 -0
  27. data/examples/api-samples/views/sample21.haml +106 -0
  28. data/examples/api-samples/views/sample22.haml +107 -0
  29. data/examples/api-samples/views/sample3.haml +10 -2
  30. data/examples/api-samples/views/sample4.haml +8 -0
  31. data/examples/api-samples/views/sample5.haml +8 -0
  32. data/examples/api-samples/views/sample6.haml +8 -0
  33. data/examples/api-samples/views/sample7.haml +9 -1
  34. data/examples/api-samples/views/sample8.haml +10 -2
  35. data/examples/api-samples/views/sample9.haml +10 -2
  36. data/groupdocs.gemspec +4 -3
  37. data/lib/groupdocs.rb +2 -4
  38. data/lib/groupdocs/api.rb +2 -0
  39. data/lib/groupdocs/api/entity.rb +4 -36
  40. data/lib/groupdocs/api/helpers/access_rights_helper.rb +4 -4
  41. data/lib/groupdocs/api/helpers/byte_flag_helper.rb +3 -3
  42. data/lib/groupdocs/api/helpers/rest_helper.rb +5 -5
  43. data/lib/groupdocs/api/helpers/status_helper.rb +2 -2
  44. data/lib/groupdocs/api/helpers/url_helper.rb +2 -2
  45. data/lib/groupdocs/document.rb +55 -24
  46. data/lib/groupdocs/document/annotation.rb +7 -7
  47. data/lib/groupdocs/document/annotation/reply.rb +2 -2
  48. data/lib/groupdocs/document/view.rb +1 -1
  49. data/lib/groupdocs/job.rb +20 -20
  50. data/lib/groupdocs/questionnaire.rb +2 -2
  51. data/lib/groupdocs/questionnaire/collector.rb +2 -2
  52. data/lib/groupdocs/questionnaire/execution.rb +1 -1
  53. data/lib/groupdocs/questionnaire/question.rb +2 -2
  54. data/lib/groupdocs/signature.rb +1 -1
  55. data/lib/groupdocs/signature/envelope.rb +19 -19
  56. data/lib/groupdocs/signature/field.rb +6 -6
  57. data/lib/groupdocs/signature/form.rb +7 -7
  58. data/lib/groupdocs/signature/list.rb +2 -2
  59. data/lib/groupdocs/signature/recipient.rb +6 -6
  60. data/lib/groupdocs/signature/shared/document_methods.rb +5 -5
  61. data/lib/groupdocs/signature/shared/entity_methods.rb +4 -4
  62. data/lib/groupdocs/signature/shared/field_methods.rb +8 -8
  63. data/lib/groupdocs/signature/shared/recipient_methods.rb +2 -2
  64. data/lib/groupdocs/signature/shared/resource_methods.rb +1 -1
  65. data/lib/groupdocs/signature/template.rb +4 -4
  66. data/lib/groupdocs/storage.rb +4 -4
  67. data/lib/groupdocs/storage/file.rb +4 -4
  68. data/lib/groupdocs/storage/folder.rb +4 -4
  69. data/lib/groupdocs/subscription.rb +15 -15
  70. data/lib/groupdocs/version.rb +1 -1
  71. data/spec/groupdocs/api/entity_spec.rb +10 -37
  72. data/spec/groupdocs/api/helpers/access_mode_helper_spec.rb +1 -1
  73. data/spec/groupdocs/api/helpers/access_rights_helper_spec.rb +3 -3
  74. data/spec/groupdocs/api/helpers/credentials_helpers_spec.rb +5 -5
  75. data/spec/groupdocs/api/helpers/rest_helper_spec.rb +15 -15
  76. data/spec/groupdocs/api/helpers/status_helper_spec.rb +1 -1
  77. data/spec/groupdocs/api/helpers/url_helper_spec.rb +11 -11
  78. data/spec/groupdocs/api/request_spec.rb +6 -6
  79. data/spec/groupdocs/datasource_spec.rb +9 -9
  80. data/spec/groupdocs/document/annotation/reply_spec.rb +15 -15
  81. data/spec/groupdocs/document/annotation/reviewer_spec.rb +3 -3
  82. data/spec/groupdocs/document/annotation_spec.rb +17 -17
  83. data/spec/groupdocs/document/change_spec.rb +1 -1
  84. data/spec/groupdocs/document/field_spec.rb +1 -1
  85. data/spec/groupdocs/document/metadata_spec.rb +3 -3
  86. data/spec/groupdocs/document/view_spec.rb +4 -4
  87. data/spec/groupdocs/document_spec.rb +92 -66
  88. data/spec/groupdocs/job_spec.rb +29 -29
  89. data/spec/groupdocs/questionnaire/collector_spec.rb +15 -19
  90. data/spec/groupdocs/questionnaire/execution_spec.rb +12 -12
  91. data/spec/groupdocs/questionnaire/page_spec.rb +4 -4
  92. data/spec/groupdocs/questionnaire/question_spec.rb +6 -6
  93. data/spec/groupdocs/questionnaire_spec.rb +18 -18
  94. data/spec/groupdocs/signature/contact_spec.rb +9 -9
  95. data/spec/groupdocs/signature/envelope_spec.rb +34 -34
  96. data/spec/groupdocs/signature/field_spec.rb +13 -13
  97. data/spec/groupdocs/signature/form_spec.rb +9 -9
  98. data/spec/groupdocs/signature/list_spec.rb +3 -3
  99. data/spec/groupdocs/signature/role_spec.rb +2 -2
  100. data/spec/groupdocs/signature/template_spec.rb +6 -6
  101. data/spec/groupdocs/signature_spec.rb +3 -3
  102. data/spec/groupdocs/storage/file_spec.rb +20 -20
  103. data/spec/groupdocs/storage/folder_spec.rb +21 -21
  104. data/spec/groupdocs/storage/package_spec.rb +2 -2
  105. data/spec/groupdocs/storage_spec.rb +1 -1
  106. data/spec/groupdocs/subscription_spec.rb +3 -3
  107. data/spec/groupdocs/user_spec.rb +5 -5
  108. data/spec/spec_helper.rb +9 -7
  109. data/spec/support/json/document_thumbnails.json +24 -0
  110. data/spec/support/shared_examples/api/entity.rb +8 -8
  111. data/spec/support/shared_examples/signature/shared/document_methods.rb +8 -8
  112. data/spec/support/shared_examples/signature/shared/entity_fields.rb +3 -3
  113. data/spec/support/shared_examples/signature/shared/entity_methods.rb +12 -12
  114. data/spec/support/shared_examples/signature/shared/field_methods.rb +29 -29
  115. data/spec/support/shared_examples/signature/shared/recipient_methods.rb +3 -3
  116. data/spec/support/shared_examples/signature/shared/resource_methods.rb +2 -2
  117. metadata +33 -5
@@ -22,12 +22,12 @@ describe GroupDocs::Storage::Package do
22
22
  describe '#create!' do
23
23
  before(:each) do
24
24
  mock_api_server(load_json('package_create'))
25
- subject.objects = [stub(name: 'object 1')]
25
+ subject.objects = [stub(:name => 'object 1')]
26
26
  end
27
27
 
28
28
  it 'accepts access credentials hash' do
29
29
  lambda do
30
- subject.create!(client_id: 'client_id', private_key: 'private_key')
30
+ subject.create!(:client_id => 'client_id', :private_key => 'private_key')
31
31
  end.should_not raise_error(ArgumentError)
32
32
  end
33
33
 
@@ -8,7 +8,7 @@ describe GroupDocs::Storage do
8
8
 
9
9
  it 'accepts access credentials hash' do
10
10
  lambda do
11
- described_class.info!(client_id: 'client_id', private_key: 'private_key')
11
+ described_class.info!(:client_id => 'client_id', :private_key => 'private_key')
12
12
  end.should_not raise_error(ArgumentError)
13
13
  end
14
14
 
@@ -11,7 +11,7 @@ describe GroupDocs::Subscription do
11
11
 
12
12
  it 'accepts access credentials hash' do
13
13
  lambda do
14
- described_class.current!(client_id: 'client_id', private_key: 'private_key')
14
+ described_class.current!(:client_id => 'client_id', :private_key => 'private_key')
15
15
  end.should_not raise_error(ArgumentError)
16
16
  end
17
17
 
@@ -27,7 +27,7 @@ describe GroupDocs::Subscription do
27
27
 
28
28
  it 'accepts access credentials hash' do
29
29
  lambda do
30
- described_class.list!(client_id: 'client_id', private_key: 'private_key')
30
+ described_class.list!(:client_id => 'client_id', :private_key => 'private_key')
31
31
  end.should_not raise_error(ArgumentError)
32
32
  end
33
33
 
@@ -62,7 +62,7 @@ describe GroupDocs::Subscription do
62
62
 
63
63
  describe "##{snake}" do
64
64
  it 'converts hash to GroupDocs::Subscription::Limit object' do
65
- subject.send(:"#{snake}=", { min: 2, max: 3, description: 'Description' })
65
+ subject.send(:"#{snake}=", { :min => 2, :max => 3, :description => 'Description' })
66
66
  limit = subject.send(snake)
67
67
  limit.should be_a(GroupDocs::Subscription::Limit)
68
68
  limit.min.should == 2
@@ -11,7 +11,7 @@ describe GroupDocs::User do
11
11
 
12
12
  it 'accepts access credentials hash' do
13
13
  lambda do
14
- described_class.get!(client_id: 'client_id', private_key: 'private_key')
14
+ described_class.get!(:client_id => 'client_id', :private_key => 'private_key')
15
15
  end.should_not raise_error(ArgumentError)
16
16
  end
17
17
 
@@ -29,12 +29,12 @@ describe GroupDocs::User do
29
29
 
30
30
  it 'accepts access credentials hash' do
31
31
  lambda do
32
- described_class.update_account!(user, client_id: 'client_id', private_key: 'private_key')
32
+ described_class.update_account!(user, :client_id => 'client_id', :private_key => 'private_key')
33
33
  end.should_not raise_error(ArgumentError)
34
34
  end
35
35
 
36
36
  it 'raises error if user is not an instance of GroupDocs::User' do
37
- -> { described_class.update_account!('user') }.should raise_error(ArgumentError)
37
+ lambda { described_class.update_account!('user') }.should raise_error(ArgumentError)
38
38
  end
39
39
 
40
40
  it 'returns GroupDocs::User object' do
@@ -101,7 +101,7 @@ describe GroupDocs::User do
101
101
 
102
102
  it 'accepts access credentials hash' do
103
103
  lambda do
104
- subject.update!(client_id: 'client_id', private_key: 'private_key')
104
+ subject.update!(:client_id => 'client_id', :private_key => 'private_key')
105
105
  end.should_not raise_error(ArgumentError)
106
106
  end
107
107
 
@@ -118,7 +118,7 @@ describe GroupDocs::User do
118
118
 
119
119
  it 'accepts access credentials hash' do
120
120
  lambda do
121
- subject.users!(client_id: 'client_id', private_key: 'private_key')
121
+ subject.users!(:client_id => 'client_id', :private_key => 'private_key')
122
122
  end.should_not raise_error(ArgumentError)
123
123
  end
124
124
 
@@ -1,9 +1,11 @@
1
- require 'simplecov'
2
- SimpleCov.configure do
3
- add_filter('spec/')
4
- add_filter('vendor/')
1
+ unless RUBY_VERSION.to_f < 1.9
2
+ require 'simplecov'
3
+ SimpleCov.configure do
4
+ add_filter('spec/')
5
+ add_filter('vendor/')
6
+ end
7
+ SimpleCov.start
5
8
  end
6
- SimpleCov.start
7
9
 
8
10
  require 'webmock/rspec'
9
11
  require 'groupdocs'
@@ -55,8 +57,8 @@ end
55
57
  #
56
58
  def mock_api_server(json, headers = {})
57
59
  request = stub_request(:any, /#{GroupDocs.api_server}.*/)
58
- request = request.with(headers: headers) unless headers.empty?
59
- request.to_return(body: json)
60
+ request = request.with(:headers => headers) unless headers.empty?
61
+ request.to_return(:body => json)
60
62
  end
61
63
 
62
64
  #
@@ -0,0 +1,24 @@
1
+ {
2
+ "result": {
3
+ "name": "test.jpg",
4
+ "version": 1,
5
+ "page_count": 1,
6
+ "page_size": {
7
+ "Width": 2133,
8
+ "Height": 1600
9
+ },
10
+ "url": "https://api.groupdocs.com/v2.0/123",
11
+ "doc_type": "Image",
12
+ "image_urls": [
13
+ "https://api.groupdocs.com/v2.0/123"
14
+ ],
15
+ "token": "2e953f",
16
+ "pageHtml": null,
17
+ "pageCss": null,
18
+ "id": 23250,
19
+ "guid": "022b7dffecbccbda7e81227f95a415f57253e606f5090f4c60b0d6b12c0d824c"
20
+ },
21
+ "status": "Ok",
22
+ "error_message": null,
23
+ "composedOn": 1361789232972
24
+ }
@@ -5,16 +5,16 @@ shared_examples_for GroupDocs::Api::Entity do
5
5
  # stub required attributes
6
6
  case described_class.name
7
7
  when 'GroupDocs::Document'
8
- described_class.any_instance.stub(file: GroupDocs::Storage::File.new)
8
+ described_class.any_instance.stub(:file => GroupDocs::Storage::File.new)
9
9
  when 'GroupDocs::Document::Annotation'
10
- GroupDocs::Document.any_instance.stub(file: GroupDocs::Storage::File.new)
11
- described_class.any_instance.stub(document: GroupDocs::Document.new)
10
+ GroupDocs::Document.any_instance.stub(:file => GroupDocs::Storage::File.new)
11
+ described_class.any_instance.stub(:document => GroupDocs::Document.new)
12
12
  when 'GroupDocs::Document::Annotation::Reply'
13
- GroupDocs::Document.any_instance.stub(file: GroupDocs::Storage::File.new)
14
- GroupDocs::Document::Annotation.any_instance.stub(document: GroupDocs::Document.new)
15
- described_class.any_instance.stub(annotation: GroupDocs::Document::Annotation.new)
13
+ GroupDocs::Document.any_instance.stub(:file => GroupDocs::Storage::File.new)
14
+ GroupDocs::Document::Annotation.any_instance.stub(:document => GroupDocs::Document.new)
15
+ described_class.any_instance.stub(:annotation => GroupDocs::Document::Annotation.new)
16
16
  when 'GroupDocs::Questionnaire::Collector'
17
- described_class.any_instance.stub(questionnaire: GroupDocs::Questionnaire.new)
17
+ described_class.any_instance.stub(:questionnaire => GroupDocs::Questionnaire.new)
18
18
  end
19
19
  end
20
20
 
@@ -22,7 +22,7 @@ shared_examples_for GroupDocs::Api::Entity do
22
22
 
23
23
  describe '#initialize' do
24
24
  it 'allows passing options' do
25
- object = described_class.new(id: 1, test: 'Test')
25
+ object = described_class.new(:id => 1, :test => 'Test')
26
26
  object.id.should == 1
27
27
  object.test.should == 'Test'
28
28
  end
@@ -7,7 +7,7 @@ shared_examples_for GroupDocs::Signature::DocumentMethods do
7
7
 
8
8
  it 'accepts access credentials hash' do
9
9
  lambda do
10
- subject.documents!(client_id: 'client_id', private_key: 'private_key')
10
+ subject.documents!(:client_id => 'client_id', :private_key => 'private_key')
11
11
  end.should_not raise_error(ArgumentError)
12
12
  end
13
13
 
@@ -22,7 +22,7 @@ shared_examples_for GroupDocs::Signature::DocumentMethods do
22
22
 
23
23
  describe '#add_document!' do
24
24
  let(:document) do
25
- GroupDocs::Document.new(file: GroupDocs::Storage::File.new)
25
+ GroupDocs::Document.new(:file => GroupDocs::Storage::File.new)
26
26
  end
27
27
 
28
28
  before(:each) do
@@ -31,24 +31,24 @@ shared_examples_for GroupDocs::Signature::DocumentMethods do
31
31
 
32
32
  it 'accepts access credentials hash' do
33
33
  lambda do
34
- subject.add_document!(document, {}, client_id: 'client_id', private_key: 'private_key')
34
+ subject.add_document!(document, {}, :client_id => 'client_id', :private_key => 'private_key')
35
35
  end.should_not raise_error(ArgumentError)
36
36
  end
37
37
 
38
38
  it 'accepts options hash' do
39
39
  lambda do
40
- subject.add_document!(document, order: 1)
40
+ subject.add_document!(document, :order => 1)
41
41
  end.should_not raise_error(ArgumentError)
42
42
  end
43
43
 
44
44
  it 'raises error if document is not GroupDocs::Document object' do
45
- -> { subject.add_document!('Document') }.should raise_error(ArgumentError)
45
+ lambda { subject.add_document!('Document') }.should raise_error(ArgumentError)
46
46
  end
47
47
  end
48
48
 
49
49
  describe '#remove_document!' do
50
50
  let(:document) do
51
- GroupDocs::Document.new(file: GroupDocs::Storage::File.new)
51
+ GroupDocs::Document.new(:file => GroupDocs::Storage::File.new)
52
52
  end
53
53
 
54
54
  before(:each) do
@@ -57,12 +57,12 @@ shared_examples_for GroupDocs::Signature::DocumentMethods do
57
57
 
58
58
  it 'accepts access credentials hash' do
59
59
  lambda do
60
- subject.remove_document!(document, client_id: 'client_id', private_key: 'private_key')
60
+ subject.remove_document!(document, :client_id => 'client_id', :private_key => 'private_key')
61
61
  end.should_not raise_error(ArgumentError)
62
62
  end
63
63
 
64
64
  it 'raises error if document is not GroupDocs::Document object' do
65
- -> { subject.remove_document!('Document') }.should raise_error(ArgumentError)
65
+ lambda { subject.remove_document!('Document') }.should raise_error(ArgumentError)
66
66
  end
67
67
  end
68
68
  end
@@ -29,7 +29,7 @@ shared_examples_for GroupDocs::Signature::EntityFields do
29
29
 
30
30
  describe '#recipients=' do
31
31
  it 'converts each recipient to GroupDocs::Signature::Recipient object if hash is passed' do
32
- subject.recipients = [{ nickname: 'John' }]
32
+ subject.recipients = [{ :nickname => 'John' }]
33
33
  recipients = subject.recipients
34
34
  recipients.should be_an(Array)
35
35
  recipients.each do |recipient|
@@ -38,8 +38,8 @@ shared_examples_for GroupDocs::Signature::EntityFields do
38
38
  end
39
39
 
40
40
  it 'saves each recipient if it is GroupDocs::Signature::Recipient object' do
41
- recipient1 = GroupDocs::Signature::Recipient.new(nickname: 'recipient1')
42
- recipient2 = GroupDocs::Signature::Recipient.new(nickname: 'recipient2')
41
+ recipient1 = GroupDocs::Signature::Recipient.new(:nickname => 'recipient1')
42
+ recipient2 = GroupDocs::Signature::Recipient.new(:nickname => 'recipient2')
43
43
  subject.recipients = [recipient1, recipient2]
44
44
  subject.recipients.should include(recipient1)
45
45
  subject.recipients.should include(recipient2)
@@ -7,7 +7,7 @@ shared_examples_for GroupDocs::Signature::EntityMethods do
7
7
 
8
8
  it 'accepts access credentials hash' do
9
9
  lambda do
10
- described_class.get!("j5498fre9fje9f", client_id: 'client_id', private_key: 'private_key')
10
+ described_class.get!("j5498fre9fje9f", :client_id => 'client_id', :private_key => 'private_key')
11
11
  end.should_not raise_error(ArgumentError)
12
12
  end
13
13
 
@@ -25,13 +25,13 @@ shared_examples_for GroupDocs::Signature::EntityMethods do
25
25
 
26
26
  it 'accepts access credentials hash' do
27
27
  lambda do
28
- subject.create!({}, client_id: 'client_id', private_key: 'private_key')
28
+ subject.create!({}, :client_id => 'client_id', :private_key => 'private_key')
29
29
  end.should_not raise_error(ArgumentError)
30
30
  end
31
31
 
32
32
  it 'accepts options hash' do
33
33
  lambda do
34
- subject.create!(template_id: 'aodfh43yr9834hf943h')
34
+ subject.create!(:template_id => 'aodfh43yr9834hf943h')
35
35
  end.should_not raise_error(ArgumentError)
36
36
  end
37
37
 
@@ -55,7 +55,7 @@ shared_examples_for GroupDocs::Signature::EntityMethods do
55
55
 
56
56
  it 'accepts access credentials hash' do
57
57
  lambda do
58
- subject.modify!(client_id: 'client_id', private_key: 'private_key')
58
+ subject.modify!(:client_id => 'client_id', :private_key => 'private_key')
59
59
  end.should_not raise_error(ArgumentError)
60
60
  end
61
61
 
@@ -72,7 +72,7 @@ shared_examples_for GroupDocs::Signature::EntityMethods do
72
72
 
73
73
  it 'accepts access credentials hash' do
74
74
  lambda do
75
- subject.rename!('Name', client_id: 'client_id', private_key: 'private_key')
75
+ subject.rename!('Name', :client_id => 'client_id', :private_key => 'private_key')
76
76
  end.should_not raise_error(ArgumentError)
77
77
  end
78
78
 
@@ -80,17 +80,17 @@ shared_examples_for GroupDocs::Signature::EntityMethods do
80
80
  if described_class == GroupDocs::Signature::Form
81
81
  it 'uses new_name as parameter' do
82
82
  api = stub(GroupDocs::Api::Request)
83
- api.stub!(execute!: {})
84
- GroupDocs::Api::Request.stub(new: api)
85
- api.should_receive(:add_params).with(new_name: 'Name')
83
+ api.stub!(:execute! => {})
84
+ GroupDocs::Api::Request.stub(:new => api)
85
+ api.should_receive(:add_params).with(:new_name => 'Name')
86
86
  subject.rename!('Name')
87
87
  end
88
88
  else
89
89
  it 'uses name as parameter' do
90
90
  api = stub(GroupDocs::Api::Request)
91
- api.stub!(execute!: {})
92
- GroupDocs::Api::Request.stub(new: api)
93
- api.should_receive(:add_params).with(name: 'Name')
91
+ api.stub!(:execute! => {})
92
+ GroupDocs::Api::Request.stub(:new => api)
93
+ api.should_receive(:add_params).with(:name => 'Name')
94
94
  subject.rename!('Name')
95
95
  end
96
96
  end
@@ -109,7 +109,7 @@ shared_examples_for GroupDocs::Signature::EntityMethods do
109
109
 
110
110
  it 'accepts access credentials hash' do
111
111
  lambda do
112
- subject.delete!(client_id: 'client_id', private_key: 'private_key')
112
+ subject.delete!(:client_id => 'client_id', :private_key => 'private_key')
113
113
  end.should_not raise_error(ArgumentError)
114
114
  end
115
115
  end
@@ -1,7 +1,7 @@
1
1
  shared_examples_for GroupDocs::Signature::FieldMethods do
2
2
 
3
3
  describe '#fields!' do
4
- let(:document) { GroupDocs::Document.new(file: GroupDocs::Storage::File.new) }
4
+ let(:document) { GroupDocs::Document.new(:file => GroupDocs::Storage::File.new) }
5
5
  let(:recipient) { GroupDocs::Signature::Recipient.new }
6
6
 
7
7
  before(:each) do
@@ -10,16 +10,16 @@ shared_examples_for GroupDocs::Signature::FieldMethods do
10
10
 
11
11
  it 'accepts access credentials hash' do
12
12
  lambda do
13
- subject.fields!(document, recipient, client_id: 'client_id', private_key: 'private_key')
13
+ subject.fields!(document, recipient, :client_id => 'client_id', :private_key => 'private_key')
14
14
  end.should_not raise_error(ArgumentError)
15
15
  end
16
16
 
17
17
  it 'raises error if document is not GroupDocs::Document object' do
18
- -> { subject.fields!('Document', recipient) }.should raise_error(ArgumentError)
18
+ lambda { subject.fields!('Document', recipient) }.should raise_error(ArgumentError)
19
19
  end
20
20
 
21
21
  it 'raises error if recipient is not GroupDocs::Signature::Recipient object' do
22
- -> { subject.fields!(document, 'Recipient') }.should raise_error(ArgumentError)
22
+ lambda { subject.fields!(document, 'Recipient') }.should raise_error(ArgumentError)
23
23
  end
24
24
 
25
25
  it 'returns array of GroupDocs::Signature::Field objects' do
@@ -32,8 +32,8 @@ shared_examples_for GroupDocs::Signature::FieldMethods do
32
32
  end
33
33
 
34
34
  describe '#add_field!' do
35
- let(:field) { GroupDocs::Signature::Field.new(location: { location_x: 0.1, page: 1 }) }
36
- let(:document) { GroupDocs::Document.new(file: GroupDocs::Storage::File.new) }
35
+ let(:field) { GroupDocs::Signature::Field.new(:location => { :location_x => 0.1, :page => 1 }) }
36
+ let(:document) { GroupDocs::Document.new(:file => GroupDocs::Storage::File.new) }
37
37
  let(:recipient) { GroupDocs::Signature::Recipient.new }
38
38
 
39
39
  before(:each) do
@@ -42,25 +42,25 @@ shared_examples_for GroupDocs::Signature::FieldMethods do
42
42
 
43
43
  it 'accepts access credentials hash' do
44
44
  lambda do
45
- subject.add_field!(field, document, recipient, { force_new_field: false }, client_id: 'client_id', private_key: 'private_key')
45
+ subject.add_field!(field, document, recipient, { :force_new_field => false }, :client_id => 'client_id', :private_key => 'private_key')
46
46
  end.should_not raise_error(ArgumentError)
47
47
  end
48
48
 
49
49
  it 'raises error if field is not GroupDocs::Signature::Field object' do
50
- -> { subject.add_field!('Field', document, recipient) }.should raise_error(ArgumentError)
50
+ lambda { subject.add_field!('Field', document, recipient) }.should raise_error(ArgumentError)
51
51
  end
52
52
 
53
53
  it 'raises error if document is not GroupDocs::Document object' do
54
- -> { subject.add_field!(field, 'Document', recipient) }.should raise_error(ArgumentError)
54
+ lambda { subject.add_field!(field, 'Document', recipient) }.should raise_error(ArgumentError)
55
55
  end
56
56
 
57
57
  it 'raises error if recipient is not GroupDocs::Signature::Recipient object' do
58
- -> { subject.add_field!(field, document, 'Recipient') }.should raise_error(ArgumentError)
58
+ lambda { subject.add_field!(field, document, 'Recipient') }.should raise_error(ArgumentError)
59
59
  end
60
60
 
61
61
  it 'raises error if field does not specify location' do
62
62
  field = GroupDocs::Signature::Field.new
63
- -> { subject.add_field!(field, document, recipient) }.should raise_error(ArgumentError)
63
+ lambda { subject.add_field!(field, document, recipient) }.should raise_error(ArgumentError)
64
64
  end
65
65
 
66
66
  it 'uses field and field locationas payload' do
@@ -70,7 +70,7 @@ shared_examples_for GroupDocs::Signature::FieldMethods do
70
70
  field.should_receive(:to_hash).and_return(payload)
71
71
  field.location.should_receive(:to_hash).and_return(location)
72
72
  payload.should_receive(:merge!).with(location).and_return(payload)
73
- payload.should_receive(:merge!).with(forceNewField: true).and_return({})
73
+ payload.should_receive(:merge!).with(:forceNewField => true).and_return({})
74
74
  subject.add_field!(field, document, recipient)
75
75
  end
76
76
 
@@ -81,14 +81,14 @@ shared_examples_for GroupDocs::Signature::FieldMethods do
81
81
  field.should_receive(:to_hash).and_return(payload)
82
82
  field.location.should_receive(:to_hash).and_return(location)
83
83
  payload.should_receive(:merge!).with(location).and_return(payload)
84
- payload.should_receive(:merge!).with(forceNewField: false).and_return({})
85
- subject.add_field!(field, document, recipient, force_new_field: false)
84
+ payload.should_receive(:merge!).with(:forceNewField => false).and_return({})
85
+ subject.add_field!(field, document, recipient, :force_new_field => false)
86
86
  end
87
87
  end
88
88
 
89
89
  describe '#modify_field!' do
90
90
  let(:field) { GroupDocs::Signature::Field.new }
91
- let(:document) { GroupDocs::Document.new(file: GroupDocs::Storage::File.new) }
91
+ let(:document) { GroupDocs::Document.new(:file => GroupDocs::Storage::File.new) }
92
92
 
93
93
  before(:each) do
94
94
  mock_api_server(load_json('signature_field_add'))
@@ -96,16 +96,16 @@ shared_examples_for GroupDocs::Signature::FieldMethods do
96
96
 
97
97
  it 'accepts access credentials hash' do
98
98
  lambda do
99
- subject.modify_field!(field, document, client_id: 'client_id', private_key: 'private_key')
99
+ subject.modify_field!(field, document, :client_id => 'client_id', :private_key => 'private_key')
100
100
  end.should_not raise_error(ArgumentError)
101
101
  end
102
102
 
103
103
  it 'raises error if field is not GroupDocs::Signature::Field object' do
104
- -> { subject.modify_field!('Field', document) }.should raise_error(ArgumentError)
104
+ lambda { subject.modify_field!('Field', document) }.should raise_error(ArgumentError)
105
105
  end
106
106
 
107
107
  it 'raises error if document is not GroupDocs::Document object' do
108
- -> { subject.modify_field!(field, 'Document') }.should raise_error(ArgumentError)
108
+ lambda { subject.modify_field!(field, 'Document') }.should raise_error(ArgumentError)
109
109
  end
110
110
 
111
111
  it 'uses field and first field location as payload' do
@@ -131,19 +131,19 @@ shared_examples_for GroupDocs::Signature::FieldMethods do
131
131
  end
132
132
 
133
133
  it 'raises error if field is not GroupDocs::Signature::Field object' do
134
- -> { subject.delete_field!('Field') }.should raise_error(ArgumentError)
134
+ lambda { subject.delete_field!('Field') }.should raise_error(ArgumentError)
135
135
  end
136
136
 
137
137
  it 'accepts access credentials hash' do
138
138
  lambda do
139
- subject.delete_field!(field, client_id: 'client_id', private_key: 'private_key')
139
+ subject.delete_field!(field, :client_id => 'client_id', :private_key => 'private_key')
140
140
  end.should_not raise_error(ArgumentError)
141
141
  end
142
142
  end
143
143
 
144
144
  describe '#modify_field_location!' do
145
145
  let(:field) { GroupDocs::Signature::Field.new }
146
- let(:document) { GroupDocs::Document.new(file: GroupDocs::Storage::File.new) }
146
+ let(:document) { GroupDocs::Document.new(:file => GroupDocs::Storage::File.new) }
147
147
  let(:recipient) { GroupDocs::Signature::Recipient.new }
148
148
  let(:location) { GroupDocs::Signature::Field::Location.new }
149
149
 
@@ -152,24 +152,24 @@ shared_examples_for GroupDocs::Signature::FieldMethods do
152
152
  end
153
153
 
154
154
  it 'raises error if location is not GroupDocs::Signature::Field::Location object' do
155
- -> { subject.modify_field_location!('Location', field, document, recipient) }.should raise_error(ArgumentError)
155
+ lambda { subject.modify_field_location!('Location', field, document, recipient) }.should raise_error(ArgumentError)
156
156
  end
157
157
 
158
158
  it 'raises error if field is not GroupDocs::Signature::Field object' do
159
- -> { subject.modify_field_location!(location, 'Field', document, recipient) }.should raise_error(ArgumentError)
159
+ lambda { subject.modify_field_location!(location, 'Field', document, recipient) }.should raise_error(ArgumentError)
160
160
  end
161
161
 
162
162
  it 'raises error if document is not GroupDocs::Document object' do
163
- -> { subject.modify_field_location!(location, field, 'Document', recipient) }.should raise_error(ArgumentError)
163
+ lambda { subject.modify_field_location!(location, field, 'Document', recipient) }.should raise_error(ArgumentError)
164
164
  end
165
165
 
166
166
  it 'raises error if recipient is not GroupDocs::Signature::Recipient object' do
167
- -> { subject.modify_field_location!(location, field, document, 'Recipient') }.should raise_error(ArgumentError)
167
+ lambda { subject.modify_field_location!(location, field, document, 'Recipient') }.should raise_error(ArgumentError)
168
168
  end
169
169
 
170
170
  it 'accepts access credentials hash' do
171
171
  lambda do
172
- subject.modify_field_location!(location, field, document, recipient, client_id: 'client_id', private_key: 'private_key')
172
+ subject.modify_field_location!(location, field, document, recipient, :client_id => 'client_id', :private_key => 'private_key')
173
173
  end.should_not raise_error(ArgumentError)
174
174
  end
175
175
  end
@@ -183,16 +183,16 @@ shared_examples_for GroupDocs::Signature::FieldMethods do
183
183
  end
184
184
 
185
185
  it 'raises error if location is not GroupDocs::Signature::Field::Location object' do
186
- -> { subject.delete_field_location!('Location', field) }.should raise_error(ArgumentError)
186
+ lambda { subject.delete_field_location!('Location', field) }.should raise_error(ArgumentError)
187
187
  end
188
188
 
189
189
  it 'raises error if field is not GroupDocs::Signature::Field object' do
190
- -> { subject.delete_field_location!(location, 'Field') }.should raise_error(ArgumentError)
190
+ lambda { subject.delete_field_location!(location, 'Field') }.should raise_error(ArgumentError)
191
191
  end
192
192
 
193
193
  it 'accepts access credentials hash' do
194
194
  lambda do
195
- subject.delete_field_location!(location, field, client_id: 'client_id', private_key: 'private_key')
195
+ subject.delete_field_location!(location, field, :client_id => 'client_id', :private_key => 'private_key')
196
196
  end.should_not raise_error(ArgumentError)
197
197
  end
198
198
  end