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
@@ -1,3 +1,3 @@
1
1
  module GroupDocs
2
- VERSION = '1.2.11'
2
+ VERSION = '1.3.0'
3
3
  end # GroupDocs
@@ -10,23 +10,23 @@ describe GroupDocs::Api::Entity do
10
10
  describe '#to_hash' do
11
11
  it 'converts object attributes to hash' do
12
12
  subject.test = 'Test'
13
- subject.to_hash.should == { id: 1, test: 'Test' }
13
+ subject.to_hash.should == { :id => 1, :test => 'Test' }
14
14
  end
15
15
 
16
16
  it 'converts attribute to hash if it is object' do
17
- object = described_class.new(id: 1)
18
- object.should_receive(:to_hash).and_return({ id: 1 })
17
+ object = described_class.new(:id => 1)
18
+ object.should_receive(:to_hash).and_return({ :id => 1 })
19
19
  subject.test = object
20
- subject.to_hash.should == { id: 1, test: { id: 1 } }
20
+ subject.to_hash.should == { :id => 1, :test => { :id => 1 } }
21
21
  end
22
22
 
23
23
  it 'converts attribute to hash if it is array' do
24
- object1 = described_class.new(id: 1)
25
- object2 = described_class.new(id: 2)
26
- object1.should_receive(:to_hash).and_return({ id: 1 })
27
- object2.should_receive(:to_hash).and_return({ id: 2 })
24
+ object1 = described_class.new(:id => 1)
25
+ object2 = described_class.new(:id => 2)
26
+ object1.should_receive(:to_hash).and_return({ :id => 1 })
27
+ object2.should_receive(:to_hash).and_return({ :id => 2 })
28
28
  subject.test = [object1, object2]
29
- subject.to_hash.should == { id: 1, test: [{ id: 1 }, { id: 2 }] }
29
+ subject.to_hash.should == { :id => 1, :test => [{ :id => 1 }, { :id => 2 }] }
30
30
  end
31
31
  end
32
32
 
@@ -34,7 +34,7 @@ describe GroupDocs::Api::Entity do
34
34
  it 'uses accessors instead of instance variables' do
35
35
  subject.instance_variable_set(:@test1, 1)
36
36
  subject.instance_variable_set(:@test2, 1)
37
- subject.instance_eval('def test1; { fire: 1 }.invert[@test1] end')
37
+ subject.instance_eval('def test1; { :fire => 1 }.invert[@test1] end')
38
38
  subject.instance_eval('def test2; { 1 => "fire" }[@test2] end')
39
39
  subject.inspect.should include('@test1=:fire')
40
40
  subject.inspect.should include('@test2="fire"')
@@ -46,37 +46,10 @@ describe GroupDocs::Api::Entity do
46
46
  end
47
47
  end
48
48
 
49
- describe '#variable_to_accessor' do
50
- it 'converts instance variable symbol to accessor method symbol' do
51
- subject.send(:variable_to_accessor, :@test).should == :test
52
- end
53
-
54
- it 'converts camelized words to underscored' do
55
- subject.send(:variable_to_accessor, :@TestOneAndTWO).should == :test_one_and_two
56
- end
57
- end
58
-
59
- describe '#accessor_to_variable' do
60
- it 'converts accessor method symbol to instance variable symbol' do
61
- subject.send(:accessor_to_variable, :test).should == :@Test
62
- end
63
-
64
- it 'converts underscored words to camelized ' do
65
- subject.send(:accessor_to_variable, :test_one_and_two).should == :@TestOneAndTwo
66
- end
67
- end
68
-
69
49
  describe '#class_name' do
70
50
  it 'returns downcased class name' do
71
51
  object = GroupDocs::Storage::File.new
72
52
  object.send(:class_name).should == 'file'
73
53
  end
74
54
  end
75
-
76
- describe '#pluralized_class_name' do
77
- it 'returns class name ending with s' do
78
- object = GroupDocs::Storage::File.new
79
- object.send(:pluralized_class_name).should == 'files'
80
- end
81
- end
82
55
  end
@@ -15,7 +15,7 @@ describe GroupDocs::Api::Helpers::AccessMode do
15
15
  end
16
16
 
17
17
  it 'raises error if argument is not string or symbol' do
18
- -> { subject.send(:parse_access_mode, 1) }.should raise_error(ArgumentError)
18
+ lambda { subject.send(:parse_access_mode, 1) }.should raise_error(ArgumentError)
19
19
  end
20
20
  end
21
21
  end
@@ -9,11 +9,11 @@ describe GroupDocs::Api::Helpers::AccessRights do
9
9
  let(:rights) { %w(export view proof download) }
10
10
 
11
11
  it 'raises error if rights is not an array' do
12
- -> { subject.send(:convert_access_rights_to_byte, :export) }.should raise_error(ArgumentError)
12
+ lambda { subject.send(:convert_access_rights_to_byte, :export) }.should raise_error(ArgumentError)
13
13
  end
14
14
 
15
15
  it 'raises error if right is unknown' do
16
- -> { subject.send(:convert_access_rights_to_byte, %w(unknown)) }.should raise_error(ArgumentError)
16
+ lambda { subject.send(:convert_access_rights_to_byte, %w(unknown)) }.should raise_error(ArgumentError)
17
17
  end
18
18
 
19
19
  it 'converts each right to Symbol' do
@@ -33,7 +33,7 @@ describe GroupDocs::Api::Helpers::AccessRights do
33
33
  let(:rights) { %w(export view proof) }
34
34
 
35
35
  it 'raises error if rights is not an integer' do
36
- -> { subject.send(:convert_byte_to_access_rights, :export) }.should raise_error(ArgumentError)
36
+ lambda { subject.send(:convert_byte_to_access_rights, :export) }.should raise_error(ArgumentError)
37
37
  end
38
38
 
39
39
  it 'returns correct rights array flag' do
@@ -3,12 +3,12 @@ require 'spec_helper'
3
3
  describe GroupDocs::Api::Helpers::Credentials do
4
4
 
5
5
  subject do
6
- GroupDocs::Api::Request.new(method: :GET)
6
+ GroupDocs::Api::Request.new(:method => :GET)
7
7
  end
8
8
 
9
9
  describe '#client_id' do
10
10
  it 'returns passed to method client ID' do
11
- subject.options[:access] = { client_id: 'method_client_id' }
11
+ subject.options[:access] = { :client_id => 'method_client_id' }
12
12
  subject.options[:access].should_receive(:[]).with(:client_id).and_return('method_client_id')
13
13
  subject.send(:client_id).should == 'method_client_id'
14
14
  end
@@ -22,13 +22,13 @@ describe GroupDocs::Api::Helpers::Credentials do
22
22
  it 'raises error if client ID has not been set' do
23
23
  subject.options[:access] = {}
24
24
  GroupDocs.client_id = nil
25
- -> { subject.send(:client_id) }.should raise_error(GroupDocs::NoClientIdError)
25
+ lambda { subject.send(:client_id) }.should raise_error(GroupDocs::NoClientIdError)
26
26
  end
27
27
  end
28
28
 
29
29
  describe '#private_key' do
30
30
  it 'returns passed to method private key' do
31
- subject.options[:access] = { private_key: 'method_private_key' }
31
+ subject.options[:access] = { :private_key => 'method_private_key' }
32
32
  subject.options[:access].should_receive(:[]).with(:private_key).and_return('method_private_key')
33
33
  subject.send(:private_key).should == 'method_private_key'
34
34
  end
@@ -42,7 +42,7 @@ describe GroupDocs::Api::Helpers::Credentials do
42
42
  it 'raises error if private key has not been set' do
43
43
  subject.options[:access] = {}
44
44
  GroupDocs.private_key = nil
45
- -> { subject.send(:private_key) }.should raise_error(GroupDocs::NoPrivateKeyError)
45
+ lambda { subject.send(:private_key) }.should raise_error(GroupDocs::NoPrivateKeyError)
46
46
  end
47
47
  end
48
48
  end
@@ -3,29 +3,29 @@ require 'spec_helper'
3
3
  describe GroupDocs::Api::Helpers::REST do
4
4
 
5
5
  subject do
6
- GroupDocs::Api::Request.new(method: :GET)
6
+ GroupDocs::Api::Request.new(:method => :GET)
7
7
  end
8
8
 
9
9
  describe 'DEFAULT_HEADERS' do
10
10
  subject { described_class::DEFAULT_HEADERS }
11
11
 
12
12
  it 'includes "Accept: application/json"' do
13
- subject.should include(accept: 'application/json')
13
+ subject.should include(:accept => 'application/json')
14
14
  end
15
15
 
16
16
  it 'includes "Content-length: 0"' do
17
- subject.should include(content_length: 0)
17
+ subject.should include(:content_length => 0)
18
18
  end
19
19
 
20
20
  it 'includes Groupdocs-Referrer with SDK version' do
21
- subject.should include(groupdocs_referrer: "ruby/#{GroupDocs::VERSION}")
21
+ subject.should include(:groupdocs_referrer => "ruby/#{GroupDocs::VERSION}")
22
22
  end
23
23
  end
24
24
 
25
25
  describe '#prepare_request' do
26
26
  it 'merges default headers with passed' do
27
- subject.options[:headers] = { keep_alive: 300 }
28
- merged_headers = described_class::DEFAULT_HEADERS.merge(keep_alive: 300)
27
+ subject.options[:headers] = { :keep_alive => 300 }
28
+ merged_headers = described_class::DEFAULT_HEADERS.merge(:keep_alive => 300)
29
29
  lambda do
30
30
  subject.send(:prepare_request)
31
31
  end.should change { subject.options[:headers] }.to(merged_headers)
@@ -52,7 +52,7 @@ describe GroupDocs::Api::Helpers::REST do
52
52
 
53
53
  it 'coverts request body to JSON' do
54
54
  subject.options[:method] = :POST
55
- subject.options[:request_body] = { body: 'test' }
55
+ subject.options[:request_body] = { :body => 'test' }
56
56
  lambda do
57
57
  subject.send(:prepare_request)
58
58
  end.should change { subject.options[:request_body] }.to('{"body":"test"}')
@@ -69,7 +69,7 @@ describe GroupDocs::Api::Helpers::REST do
69
69
  it 'calculates and sets Content-length' do
70
70
  subject.options[:method] = :POST
71
71
  subject.options[:headers] = {}
72
- subject.options[:request_body] = { body: 'test' }
72
+ subject.options[:request_body] = { :body => 'test' }
73
73
  lambda do
74
74
  subject.send(:prepare_request)
75
75
  end.should change { subject.options[:headers][:content_length] }.to(15)
@@ -78,7 +78,7 @@ describe GroupDocs::Api::Helpers::REST do
78
78
  it 'sets Content-Type header if necessary' do
79
79
  subject.options[:method] = :POST
80
80
  subject.options[:headers] = {}
81
- subject.options[:request_body] = { body: 'test' }
81
+ subject.options[:request_body] = { :body => 'test' }
82
82
  lambda do
83
83
  subject.send(:prepare_request)
84
84
  end.should change { subject.options[:headers][:content_type] }.to('application/json')
@@ -108,7 +108,7 @@ describe GroupDocs::Api::Helpers::REST do
108
108
 
109
109
  it 'raises error if incorrect method has been passed' do
110
110
  subject.options[:method] = :TEST
111
- -> { subject.send(:send_request) }.should raise_error(GroupDocs::UnsupportedMethodError)
111
+ lambda { subject.send(:send_request) }.should raise_error(GroupDocs::UnsupportedMethodError)
112
112
  end
113
113
 
114
114
  it 'saves response' do
@@ -133,14 +133,14 @@ describe GroupDocs::Api::Helpers::REST do
133
133
 
134
134
  it 'returns JSON result key value' do
135
135
  mock_response('{"status": "Ok", "result": { "entities": [] }}')
136
- parsed_json = { status: 'Ok', result: { entities: [] } }
137
- JSON.should_receive(:parse).with(subject.response, symbolize_names: true).and_return(parsed_json)
138
- subject.send(:parse_response).should == { entities: [] }
136
+ parsed_json = { :status => 'Ok', :result => { :entities => [] } }
137
+ JSON.should_receive(:parse).with(subject.response, :symbolize_names => true).and_return(parsed_json)
138
+ subject.send(:parse_response).should == { :entities => [] }
139
139
  end
140
140
 
141
141
  it 'raises error if response status is not "Ok"' do
142
142
  unparsed_json = '{"status": "Failed", "error_message": "The source path is not found."}'
143
- parsed_json = { status: "Failed", error_message: "The source path is not found." }
143
+ parsed_json = { :status => "Failed", :error_message => "The source path is not found." }
144
144
  mock_response(unparsed_json)
145
145
  subject.should_receive(:raise_bad_request_error).with(parsed_json)
146
146
  subject.send(:parse_response)
@@ -149,7 +149,7 @@ describe GroupDocs::Api::Helpers::REST do
149
149
 
150
150
  describe '#raise_bad_request_error' do
151
151
  let(:json) do
152
- { status: 'Failed', error_message: 'The source path is not found.' }
152
+ { :status => 'Failed', :error_message => 'The source path is not found.' }
153
153
  end
154
154
 
155
155
  it 'raises error with message from response' do
@@ -16,7 +16,7 @@ describe GroupDocs::Api::Helpers::Status do
16
16
  end
17
17
 
18
18
  it 'raises error if argument is not string or symbol' do
19
- -> { subject.send(:parse_status, 1) }.should raise_error(ArgumentError)
19
+ lambda { subject.send(:parse_status, 1) }.should raise_error(ArgumentError)
20
20
  end
21
21
  end
22
22
  end
@@ -3,26 +3,26 @@ require 'spec_helper'
3
3
  describe GroupDocs::Api::Helpers::URL do
4
4
 
5
5
  subject do
6
- GroupDocs::Api::Request.new(path: '/1/files/2?new_name=invoice.docx')
6
+ GroupDocs::Api::Request.new(:path => '/1/files/2?new_name=invoice.docx')
7
7
  end
8
8
 
9
9
  describe '#add_params' do
10
10
  it 'adds parameters to query' do
11
11
  subject.options[:path].should_receive(:<<).with('&param=value')
12
- subject.add_params({ param: 'value' })
12
+ subject.add_params({ :param => 'value' })
13
13
  end
14
14
 
15
15
  it 'joins values with comma if it is array' do
16
16
  subject.options[:path] = '/1/files/2'
17
17
  value = [1, 2]
18
- value.should_receive(:join).with(?,).and_return('1,2')
19
- subject.add_params({ param: value })
18
+ value.should_receive(:join).with(',').and_return('1,2')
19
+ subject.add_params({ :param => value })
20
20
  end
21
21
 
22
22
  it 'determines correct URL separator' do
23
23
  subject.options[:path] = '/1/files/2'
24
24
  subject.should_receive(:separator)
25
- subject.add_params({ param: 'value' })
25
+ subject.add_params({ :param => 'value' })
26
26
  end
27
27
  end
28
28
 
@@ -64,14 +64,14 @@ describe GroupDocs::Api::Helpers::URL do
64
64
  end
65
65
 
66
66
  it 'adds signature to path' do
67
- subject.options[:access] = { private_key: 'e98ea443354183fd1fb434047232c687' }
68
- GroupDocs.stub(api_version: nil)
67
+ subject.options[:access] = { :private_key => 'e98ea443354183fd1fb434047232c687' }
68
+ GroupDocs.stub(:api_version => nil)
69
69
  subject.send(:sign_url)
70
70
  subject.options[:path].should == '/1/files/2?new_name=invoice.docx&signature=gw%2BLupOB3krtliSSM0dvUBSznJY'
71
71
  end
72
72
 
73
73
  it 'determines correct URL separator' do
74
- subject.options[:access] = { private_key: 'e98ea443354183fd1fb434047232c687' }
74
+ subject.options[:access] = { :private_key => 'e98ea443354183fd1fb434047232c687' }
75
75
  subject.should_receive(:separator)
76
76
  subject.send(:sign_url)
77
77
  end
@@ -90,15 +90,15 @@ describe GroupDocs::Api::Helpers::URL do
90
90
 
91
91
  describe '#prepend_version' do
92
92
  it 'does not modify URL if API version is not specified' do
93
- GroupDocs.stub(api_version: nil)
93
+ GroupDocs.stub(:api_version => nil)
94
94
  subject.options.should_not_receive(:[]=).with(:path, '/v2.0/1/files/2?new_name=invoice.docx')
95
95
  subject.send(:prepend_version)
96
96
  end
97
97
 
98
98
  it 'prepends API version number' do
99
- GroupDocs.stub(api_version: '2.0')
99
+ GroupDocs.stub(:api_version => '2.0')
100
100
  path = '/1/files/2?new_name=invoice.docx'
101
- subject = GroupDocs::Api::Request.new(path: path)
101
+ subject = GroupDocs::Api::Request.new(:path => path)
102
102
  subject.options.should_receive(:[]=).with(:path, "/v2.0#{path}").and_return("/v2.0#{path}")
103
103
  subject.send(:prepend_version)
104
104
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe GroupDocs::Api::Request do
4
4
 
5
- subject { described_class.new(method: :GET, path: '/folders') }
5
+ subject { described_class.new(:method => :GET, :path => '/folders') }
6
6
 
7
7
  it { should respond_to(:resource) }
8
8
  it { should have_accessor(:response) }
@@ -10,17 +10,17 @@ describe GroupDocs::Api::Request do
10
10
 
11
11
  describe '#initialize' do
12
12
  it 'allows passing options' do
13
- options = { method: :GET, path: '/folders' }
13
+ options = { :method => :GET, :path => '/folders' }
14
14
  request = described_class.new(options)
15
15
  request.options.should == options
16
16
  end
17
17
 
18
18
  it 'allows passing block to configure options' do
19
19
  described_class.new do |request|
20
- request[:access] = { client_id: 'client_id', private_key: 'private_key' }
20
+ request[:access] = { :client_id => 'client_id', :private_key => 'private_key' }
21
21
  request[:method] = :GET
22
22
  request[:path] = '/folders'
23
- end.options.should == { method: :GET, path: '/folders', access: { client_id: 'client_id', private_key: 'private_key' }}
23
+ end.options.should == { :method => :GET, :path => '/folders', :access => { :client_id => 'client_id', :private_key => 'private_key' }}
24
24
  end
25
25
 
26
26
  it 'sets access hash to empty if it was not passed' do
@@ -30,7 +30,7 @@ describe GroupDocs::Api::Request do
30
30
  end
31
31
 
32
32
  it 'creates resource as API server' do
33
- GroupDocs.stub(api_server: 'https://dev-api.groupdocs.com')
33
+ GroupDocs.stub(:api_server => 'https://dev-api.groupdocs.com')
34
34
  subject.resource.should be_a(RestClient::Resource)
35
35
  end
36
36
  end
@@ -62,7 +62,7 @@ describe GroupDocs::Api::Request do
62
62
 
63
63
  describe '#execute!' do
64
64
  before(:each) do
65
- GroupDocs.stub(private_key: 'private_key')
65
+ GroupDocs.stub(:private_key => 'private_key')
66
66
  subject.options[:method] = :get
67
67
  subject.options[:path] = '/folders'
68
68
  subject.options[:headers] = {}
@@ -11,13 +11,13 @@ describe GroupDocs::DataSource do
11
11
 
12
12
  it 'accepts access credentials hash' do
13
13
  lambda do
14
- described_class.get!(1, {}, client_id: 'client_id', private_key: 'private_key')
14
+ described_class.get!(1, {}, :client_id => 'client_id', :private_key => 'private_key')
15
15
  end.should_not raise_error(ArgumentError)
16
16
  end
17
17
 
18
18
  it 'accepts options hash' do
19
19
  lambda do
20
- described_class.get!(1, field: %w(field1 field2))
20
+ described_class.get!(1, :field => %w(field1 field2))
21
21
  end.should_not raise_error(ArgumentError)
22
22
  end
23
23
 
@@ -56,7 +56,7 @@ describe GroupDocs::DataSource do
56
56
 
57
57
  describe '#fields=' do
58
58
  it 'converts each field to GroupDocs::DataSource::Field object if hash is passed' do
59
- subject.fields = [{ name: 'field1', values: %w(value1 value2), type: 1 }]
59
+ subject.fields = [{ :name => 'field1', :values => %w(value1 value2), :type => 1 }]
60
60
  fields = subject.fields
61
61
  fields.should be_an(Array)
62
62
  fields.each do |field|
@@ -65,8 +65,8 @@ describe GroupDocs::DataSource do
65
65
  end
66
66
 
67
67
  it 'saves each field if it is GroupDocs::DataSource::Field object' do
68
- field1 = GroupDocs::DataSource::Field.new(name: 'field1')
69
- field2 = GroupDocs::DataSource::Field.new(name: 'field2')
68
+ field1 = GroupDocs::DataSource::Field.new(:name => 'field1')
69
+ field2 = GroupDocs::DataSource::Field.new(:name => 'field2')
70
70
  subject.fields = [field1, field2]
71
71
  subject.fields.should include(field1)
72
72
  subject.fields.should include(field2)
@@ -81,7 +81,7 @@ describe GroupDocs::DataSource do
81
81
 
82
82
  describe '#add_field' do
83
83
  it 'raises error if field is not GroupDocs::DataSource::Field object' do
84
- -> { subject.add_field('Field') }.should raise_error(ArgumentError)
84
+ lambda { subject.add_field('Field') }.should raise_error(ArgumentError)
85
85
  end
86
86
 
87
87
  it 'saves field' do
@@ -98,7 +98,7 @@ describe GroupDocs::DataSource do
98
98
 
99
99
  it 'accepts access credentials hash' do
100
100
  lambda do
101
- subject.add!(client_id: 'client_id', private_key: 'private_key')
101
+ subject.add!(:client_id => 'client_id', :private_key => 'private_key')
102
102
  end.should_not raise_error(ArgumentError)
103
103
  end
104
104
 
@@ -121,7 +121,7 @@ describe GroupDocs::DataSource do
121
121
 
122
122
  it 'accepts access credentials hash' do
123
123
  lambda do
124
- subject.update!(client_id: 'client_id', private_key: 'private_key')
124
+ subject.update!(:client_id => 'client_id', :private_key => 'private_key')
125
125
  end.should_not raise_error(ArgumentError)
126
126
  end
127
127
 
@@ -138,7 +138,7 @@ describe GroupDocs::DataSource do
138
138
 
139
139
  it 'accepts access credentials hash' do
140
140
  lambda do
141
- subject.remove!(client_id: 'client_id', private_key: 'private_key')
141
+ subject.remove!(:client_id => 'client_id', :private_key => 'private_key')
142
142
  end.should_not raise_error(ArgumentError)
143
143
  end
144
144
  end