groupdocs 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. data/CHANGELOG.md +41 -0
  2. data/examples/README.md +2 -3
  3. data/examples/api-samples/Gemfile +5 -0
  4. data/examples/api-samples/Gemfile.lock +27 -0
  5. data/examples/api-samples/README.md +12 -0
  6. data/examples/api-samples/app.rb +17 -0
  7. data/examples/api-samples/public/css/style.css +166 -0
  8. data/examples/api-samples/samples/sample1.rb +17 -0
  9. data/examples/api-samples/samples/sample10.rb +36 -0
  10. data/examples/api-samples/samples/sample2.rb +19 -0
  11. data/examples/api-samples/samples/sample3.rb +23 -0
  12. data/examples/api-samples/samples/sample4.rb +31 -0
  13. data/examples/api-samples/samples/sample5.rb +44 -0
  14. data/examples/api-samples/samples/sample6.rb +3 -0
  15. data/examples/api-samples/samples/sample7.rb +33 -0
  16. data/examples/api-samples/samples/sample8.rb +40 -0
  17. data/examples/api-samples/samples/sample9.rb +22 -0
  18. data/examples/api-samples/views/index.haml +23 -0
  19. data/examples/api-samples/views/layout.haml +7 -0
  20. data/examples/api-samples/views/sample1.haml +71 -0
  21. data/examples/api-samples/views/sample10.haml +69 -0
  22. data/examples/api-samples/views/sample2.haml +59 -0
  23. data/examples/api-samples/views/sample3.haml +62 -0
  24. data/examples/api-samples/views/sample4.haml +58 -0
  25. data/examples/api-samples/views/sample5.haml +62 -0
  26. data/examples/api-samples/views/sample6.haml +145 -0
  27. data/examples/api-samples/views/sample7.haml +59 -0
  28. data/examples/api-samples/views/sample8.haml +75 -0
  29. data/examples/api-samples/views/sample9.haml +61 -0
  30. data/examples/{annotations → viewer}/Gemfile +0 -0
  31. data/examples/viewer/app.rb +52 -0
  32. data/groupdocs.gemspec +5 -4
  33. data/lib/groupdocs/api.rb +1 -0
  34. data/lib/groupdocs/api/entity.rb +2 -0
  35. data/lib/groupdocs/api/helpers.rb +2 -0
  36. data/lib/groupdocs/api/helpers/accessor_helper.rb +30 -0
  37. data/lib/groupdocs/api/helpers/mime_helper.rb +21 -0
  38. data/lib/groupdocs/api/helpers/rest_helper.rb +3 -2
  39. data/lib/groupdocs/api/request.rb +1 -3
  40. data/lib/groupdocs/datasource.rb +1 -2
  41. data/lib/groupdocs/document.rb +133 -3
  42. data/lib/groupdocs/document/annotation.rb +14 -13
  43. data/lib/groupdocs/document/annotation/reply.rb +4 -8
  44. data/lib/groupdocs/document/annotation/reviewer.rb +2 -4
  45. data/lib/groupdocs/document/field.rb +10 -8
  46. data/lib/groupdocs/document/rectangle.rb +10 -18
  47. data/lib/groupdocs/job.rb +1 -1
  48. data/lib/groupdocs/questionnaire.rb +138 -44
  49. data/lib/groupdocs/questionnaire/collector.rb +262 -0
  50. data/lib/groupdocs/questionnaire/execution.rb +93 -10
  51. data/lib/groupdocs/questionnaire/question.rb +1 -2
  52. data/lib/groupdocs/signature.rb +16 -24
  53. data/lib/groupdocs/signature/contact.rb +2 -4
  54. data/lib/groupdocs/signature/envelope.rb +3 -6
  55. data/lib/groupdocs/signature/envelope/log.rb +2 -4
  56. data/lib/groupdocs/signature/field.rb +21 -42
  57. data/lib/groupdocs/signature/field/location.rb +18 -36
  58. data/lib/groupdocs/signature/form.rb +9 -18
  59. data/lib/groupdocs/signature/list.rb +1 -2
  60. data/lib/groupdocs/signature/recipient.rb +3 -6
  61. data/lib/groupdocs/signature/role.rb +4 -8
  62. data/lib/groupdocs/signature/shared/entity_fields.rb +12 -20
  63. data/lib/groupdocs/signature/template.rb +1 -2
  64. data/lib/groupdocs/storage/file.rb +3 -1
  65. data/lib/groupdocs/storage/folder.rb +7 -1
  66. data/lib/groupdocs/subscription.rb +6 -12
  67. data/lib/groupdocs/subscription/limit.rb +4 -8
  68. data/lib/groupdocs/user.rb +3 -6
  69. data/lib/groupdocs/version.rb +1 -1
  70. data/spec/groupdocs/api/helpers/accessor_helper_spec.rb +16 -0
  71. data/spec/groupdocs/api/helpers/mime_helper_spec.rb +16 -0
  72. data/spec/groupdocs/api/helpers/rest_helper_spec.rb +4 -0
  73. data/spec/groupdocs/api/request_spec.rb +3 -5
  74. data/spec/groupdocs/datasource/field_spec.rb +3 -6
  75. data/spec/groupdocs/datasource_spec.rb +8 -15
  76. data/spec/groupdocs/document/annotation/reply_spec.rb +13 -24
  77. data/spec/groupdocs/document/annotation/reviewer_spec.rb +5 -9
  78. data/spec/groupdocs/document/annotation_spec.rb +35 -40
  79. data/spec/groupdocs/document/change_spec.rb +6 -11
  80. data/spec/groupdocs/document/field_spec.rb +13 -13
  81. data/spec/groupdocs/document/metadata_spec.rb +5 -10
  82. data/spec/groupdocs/document/rectangle_spec.rb +6 -18
  83. data/spec/groupdocs/document/view_spec.rb +3 -6
  84. data/spec/groupdocs/document_spec.rb +123 -10
  85. data/spec/groupdocs/job_spec.rb +9 -18
  86. data/spec/groupdocs/questionnaire/collector_spec.rb +201 -0
  87. data/spec/groupdocs/questionnaire/execution_spec.rb +91 -23
  88. data/spec/groupdocs/questionnaire/page_spec.rb +3 -6
  89. data/spec/groupdocs/questionnaire/question/answer_spec.rb +2 -4
  90. data/spec/groupdocs/questionnaire/question_spec.rb +7 -14
  91. data/spec/groupdocs/questionnaire_spec.rb +117 -41
  92. data/spec/groupdocs/signature/contact_spec.rb +9 -17
  93. data/spec/groupdocs/signature/envelope/log_spec.rb +8 -16
  94. data/spec/groupdocs/signature/envelope_spec.rb +9 -17
  95. data/spec/groupdocs/signature/field/location_spec.rb +32 -65
  96. data/spec/groupdocs/signature/field_spec.rb +48 -95
  97. data/spec/groupdocs/signature/form_spec.rb +22 -43
  98. data/spec/groupdocs/signature/list_spec.rb +6 -11
  99. data/spec/groupdocs/signature/recipient_spec.rb +11 -22
  100. data/spec/groupdocs/signature/role_spec.rb +11 -21
  101. data/spec/groupdocs/signature/template_spec.rb +2 -4
  102. data/spec/groupdocs/signature_spec.rb +28 -54
  103. data/spec/groupdocs/storage/file_spec.rb +14 -26
  104. data/spec/groupdocs/storage/folder_spec.rb +16 -22
  105. data/spec/groupdocs/storage/package_spec.rb +2 -4
  106. data/spec/groupdocs/subscription/limit_spec.rb +8 -16
  107. data/spec/groupdocs/subscription_spec.rb +11 -22
  108. data/spec/groupdocs/user_spec.rb +21 -41
  109. data/spec/groupdocs_spec.rb +4 -8
  110. data/spec/spec_helper.rb +12 -0
  111. data/spec/support/files/signature.png +0 -0
  112. data/spec/support/json/annotation_list.json +6 -6
  113. data/spec/support/json/comparison_changes.json +8 -8
  114. data/spec/support/json/document_fields.json +8 -8
  115. data/spec/support/json/document_page_images_get.json +20 -0
  116. data/spec/support/json/questionnaire_collector.json +17 -0
  117. data/spec/support/json/questionnaire_collectors.json +38 -0
  118. data/spec/support/json/questionnaire_collectors_add.json +10 -0
  119. data/spec/support/json/questionnaire_create.json +3 -1
  120. data/spec/support/json/{questionnaire_execution_create.json → questionnaire_execution_add.json} +1 -1
  121. data/spec/support/json/questionnaire_get.json +3 -0
  122. data/spec/support/json/questionnaires_get.json +36 -18
  123. data/spec/support/json/sign_documents.json +16 -0
  124. data/spec/support/json/templates_get.json +21 -0
  125. data/spec/support/shared_examples/api/entity.rb +2 -0
  126. data/spec/support/shared_examples/api/helpers/access_mode_helper.rb +1 -2
  127. data/spec/support/shared_examples/api/helpers/status_helper.rb +1 -2
  128. data/spec/support/shared_examples/signature/shared/entity_fields.rb +22 -43
  129. metadata +82 -16
  130. data/examples/annotations/app.rb +0 -67
@@ -39,14 +39,10 @@ module GroupDocs
39
39
  attr_accessor :canDelegate
40
40
 
41
41
  # Human-readable accessors
42
- alias_method :can_edit, :canEdit
43
- alias_method :can_edit=, :canEdit=
44
- alias_method :can_sign, :canSign
45
- alias_method :can_sign=, :canSign=
46
- alias_method :can_annotate, :canAnnotate
47
- alias_method :can_annotate=, :canAnnotate=
48
- alias_method :can_delegate, :canDelegate
49
- alias_method :can_delegate=, :canDelegate=
42
+ alias_accessor :can_edit, :canEdit
43
+ alias_accessor :can_sign, :canSign
44
+ alias_accessor :can_annotate, :canAnnotate
45
+ alias_accessor :can_delegate, :canDelegate
50
46
 
51
47
  #
52
48
  # Returns true if role can edit.
@@ -8,6 +8,8 @@ module GroupDocs
8
8
  #
9
9
  module EntityFields
10
10
 
11
+ extend Api::Helpers::Accessor
12
+
11
13
  # @attr [String] id
12
14
  attr_accessor :id
13
15
  # @attr [String] name
@@ -36,26 +38,16 @@ module GroupDocs
36
38
  attr_accessor :recipients
37
39
 
38
40
  # Human-readable accessors
39
- alias_method :owner_id, :ownerId
40
- alias_method :owner_id=, :ownerId=
41
- alias_method :owner_guid, :ownerGuid
42
- alias_method :owner_guid=, :ownerGuid=
43
- alias_method :reminder_time, :reminderTime
44
- alias_method :reminder_time=, :reminderTime=
45
- alias_method :step_expire_time, :stepExpireTime
46
- alias_method :step_expire_time=, :stepExpireTime=
47
- alias_method :owner_should_sign, :ownerShouldSign
48
- alias_method :owner_should_sign=, :ownerShouldSign=
49
- alias_method :ordered_signature, :orderedSignature
50
- alias_method :ordered_signature=, :orderedSignature=
51
- alias_method :email_subject, :emailSubject
52
- alias_method :email_subject=, :emailSubject=
53
- alias_method :email_body, :emailBody
54
- alias_method :email_body=, :emailBody=
55
- alias_method :documents_count, :documentsCount
56
- alias_method :documents_count=, :documentsCount=
57
- alias_method :documents_pages, :documentsPages
58
- alias_method :documents_pages=, :documentsPages=
41
+ alias_accessor :owner_id, :ownerId
42
+ alias_accessor :owner_guid, :ownerGuid
43
+ alias_accessor :reminder_time, :reminderTime
44
+ alias_accessor :step_expire_time, :stepExpireTime
45
+ alias_accessor :owner_should_sign, :ownerShouldSign
46
+ alias_accessor :ordered_signature, :orderedSignature
47
+ alias_accessor :email_subject, :emailSubject
48
+ alias_accessor :email_body, :emailBody
49
+ alias_accessor :documents_count, :documentsCount
50
+ alias_accessor :documents_pages, :documentsPages
59
51
 
60
52
  #
61
53
  # Converts each recipient to GroupDocs::Signature::Recipient object.
@@ -37,8 +37,7 @@ module GroupDocs
37
37
  attr_accessor :templateExpireTime
38
38
 
39
39
  # Human-readable accessors
40
- alias_method :template_expire_time, :templateExpireTime
41
- alias_method :template_expire_time=, :templateExpireTime=
40
+ alias_accessor :template_expire_time, :templateExpireTime
42
41
 
43
42
  #
44
43
  # Adds recipient to template.
@@ -98,6 +98,8 @@ module GroupDocs
98
98
  attr_accessor :access
99
99
  # @attr [String] path
100
100
  attr_accessor :path
101
+ # @attr [String] local_path
102
+ attr_accessor :local_path
101
103
 
102
104
  # Compatibility with response JSON
103
105
  alias_method :adj_name=, :name=
@@ -175,7 +177,7 @@ module GroupDocs
175
177
  response = Api::Request.new do |request|
176
178
  request[:access] = access
177
179
  request[:method] = :DOWNLOAD
178
- request[:path] = "/storage/{{client_id}}/files/#{id}"
180
+ request[:path] = "/storage/{{client_id}}/files/#{guid}"
179
181
  end.execute!
180
182
 
181
183
  filepath = "#{path}/#{name}"
@@ -105,13 +105,19 @@ module GroupDocs
105
105
  # @option options [Integer] :count How many items to list
106
106
  # @option options [String] :order_by Field name to sort by
107
107
  # @option options [Boolean] :order_asc Set to true to return in ascending order
108
+ # @option options [String] :filter Filter by name
109
+ # @option options [Array<Symbol>] :file_types Array of file types to return
110
+ # @option options [Boolean] :extended Set to true to return extended information
108
111
  # @param [Hash] access Access credentials
109
112
  # @option access [String] :client_id
110
113
  # @option access [String] :private_key
111
114
  # @return [Array<GroupDocs::Storage::Folder, GroupDocs::Storage::File>]
112
115
  #
113
116
  def list!(options = {}, access = {})
114
- options[:order_by].capitalize! if options[:order_by]
117
+ if options[:order_by]
118
+ options[:order_by] = accessor_to_variable(options[:order_by].capitalize).to_s.delete(?@)
119
+ end
120
+
115
121
  full_path = prepare_path("#{path}/#{name}")
116
122
 
117
123
  api = Api::Request.new do |request|
@@ -75,16 +75,11 @@ module GroupDocs
75
75
  attr_accessor :CurrencyCode
76
76
 
77
77
  # Human-readable accessors
78
- alias_method :id, :Id
79
- alias_method :id=, :Id=
80
- alias_method :name, :Name
81
- alias_method :name=, :Name=
82
- alias_method :pricing_plan_id, :PricingPlanId
83
- alias_method :pricing_plan_id=, :PricingPlanId=
84
- alias_method :price, :Price
85
- alias_method :price=, :Price=
86
- alias_method :currency_code, :CurrencyCode
87
- alias_method :currency_code=, :CurrencyCode=
78
+ alias_accessor :id, :Id
79
+ alias_accessor :name, :Name
80
+ alias_accessor :pricing_plan_id, :PricingPlanId
81
+ alias_accessor :price, :Price
82
+ alias_accessor :currency_code, :CurrencyCode
88
83
 
89
84
  # Compatibility with response JSON
90
85
  alias_method :ref_id=, :id=
@@ -97,8 +92,7 @@ module GroupDocs
97
92
  attr_accessor camel
98
93
 
99
94
  # Human-readable accessors
100
- alias_method :"#{snake}", :"#{camel}"
101
- alias_method :"#{snake}=", :"#{camel}="
95
+ alias_accessor snake, camel.to_sym
102
96
 
103
97
  #
104
98
  # Converts hash to subscription plan limit.
@@ -11,14 +11,10 @@ module GroupDocs
11
11
  attr_accessor :Description
12
12
 
13
13
  # Human-readable accessors
14
- alias_method :id, :Id
15
- alias_method :id=, :Id=
16
- alias_method :min, :Min
17
- alias_method :min=, :Min=
18
- alias_method :max, :Max
19
- alias_method :max=, :Max=
20
- alias_method :description, :Description
21
- alias_method :description=, :Description=
14
+ alias_accessor :id, :Id
15
+ alias_accessor :min, :Min
16
+ alias_accessor :max, :Max
17
+ alias_accessor :description, :Description
22
18
 
23
19
  end # Subscription::Limit
24
20
  end # GroupDocs
@@ -62,12 +62,9 @@ module GroupDocs
62
62
  attr_accessor :customEmailMessage
63
63
 
64
64
  # Human-readable accessors
65
- alias_method :first_name, :firstname
66
- alias_method :first_name=, :firstname=
67
- alias_method :last_name, :lastname
68
- alias_method :last_name=, :lastname=
69
- alias_method :custom_email_message, :customEmailMessage
70
- alias_method :custom_email_message=, :customEmailMessage=
65
+ alias_accessor :first_name, :firstname
66
+ alias_accessor :last_name, :lastname
67
+ alias_accessor :custom_email_message, :customEmailMessage
71
68
 
72
69
  #
73
70
  # Converts access rights to human-readable format flag.
@@ -1,3 +1,3 @@
1
1
  module GroupDocs
2
- VERSION = '1.1.0'
2
+ VERSION = '1.2.0'
3
3
  end # GroupDocs
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe GroupDocs::Api::Helpers::Accessor do
4
+ describe '.alias_accessor' do
5
+ it 'aliases accessor to new name' do
6
+ klass = GroupDocs::Api::Entity
7
+ klass.class_eval <<-RUBY
8
+ attr_accessor :guid
9
+ alias_accessor :guiD, :guid
10
+ RUBY
11
+ subject = klass.new
12
+ subject.should have_alias(:guiD, :guid)
13
+ subject.should have_alias(:guiD=, :guid=)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe GroupDocs::Api::Helpers::MIME do
4
+ subject do
5
+ GroupDocs::Signature.new
6
+ end
7
+
8
+ describe '#mime_type' do
9
+ it 'returns first MIME type of file' do
10
+ types = ['application/ruby']
11
+ ::MIME::Types.should_receive(:type_for).with(__FILE__).and_return(types)
12
+ types.should_receive(:first).and_return('application/ruby')
13
+ subject.send(:mime_type, __FILE__)
14
+ end
15
+ end
16
+ end
@@ -16,6 +16,10 @@ describe GroupDocs::Api::Helpers::REST do
16
16
  it 'includes "Content-length: 0"' do
17
17
  subject.should include(content_length: 0)
18
18
  end
19
+
20
+ it 'includes Groupdocs-Referrer with SDK version' do
21
+ subject.should include(groupdocs_referrer: "ruby/#{GroupDocs::VERSION}")
22
+ end
19
23
  end
20
24
 
21
25
  describe '#prepare_request' do
@@ -4,11 +4,9 @@ describe GroupDocs::Api::Request do
4
4
 
5
5
  subject { described_class.new(method: :GET, path: '/folders') }
6
6
 
7
- it { should respond_to(:resource) }
8
- it { should respond_to(:response) }
9
- it { should respond_to(:response=) }
10
- it { should respond_to(:options) }
11
- it { should respond_to(:options=) }
7
+ it { should respond_to(:resource) }
8
+ it { should have_accessor(:response) }
9
+ it { should have_accessor(:options) }
12
10
 
13
11
  describe '#initialize' do
14
12
  it 'allows passing options' do
@@ -4,12 +4,9 @@ describe GroupDocs::DataSource::Field do
4
4
 
5
5
  it_behaves_like GroupDocs::Api::Entity
6
6
 
7
- it { should respond_to(:name) }
8
- it { should respond_to(:name=) }
9
- it { should respond_to(:type) }
10
- it { should respond_to(:type=) }
11
- it { should respond_to(:values) }
12
- it { should respond_to(:values=) }
7
+ it { should have_accessor(:name) }
8
+ it { should have_accessor(:type) }
9
+ it { should have_accessor(:values) }
13
10
 
14
11
  describe '#type=' do
15
12
  it 'saves type in machine readable format if symbol is passed' do
@@ -31,21 +31,14 @@ describe GroupDocs::DataSource do
31
31
  end
32
32
  end
33
33
 
34
- it { should respond_to(:id) }
35
- it { should respond_to(:id=) }
36
- it { should respond_to(:descr) }
37
- it { should respond_to(:descr=) }
38
- it { should respond_to(:questionnaire_id) }
39
- it { should respond_to(:questionnaire_id=) }
40
- it { should respond_to(:created_on) }
41
- it { should respond_to(:created_on=) }
42
- it { should respond_to(:modified_on) }
43
- it { should respond_to(:modified_on=) }
44
- it { should respond_to(:fields) }
45
- it { should respond_to(:fields=) }
46
-
47
- it { should have_alias(:description, :descr) }
48
- it { should have_alias(:description=, :descr=) }
34
+ it { should have_accessor(:id) }
35
+ it { should have_accessor(:descr) }
36
+ it { should have_accessor(:questionnaire_id) }
37
+ it { should have_accessor(:created_on) }
38
+ it { should have_accessor(:modified_on) }
39
+ it { should have_accessor(:fields) }
40
+
41
+ it { should alias_accessor(:description, :descr) }
49
42
 
50
43
  describe '#created_on' do
51
44
  it 'returns converted to Time object Unix timestamp' do
@@ -56,31 +56,20 @@ describe GroupDocs::Document::Annotation::Reply do
56
56
  end
57
57
  end
58
58
 
59
- it { should respond_to(:annotation) }
60
- it { should respond_to(:annotation=) }
61
- it { should respond_to(:text) }
62
- it { should respond_to(:text=) }
63
- it { should respond_to(:guid) }
64
- it { should respond_to(:guid=) }
65
- it { should respond_to(:annotationGuid) }
66
- it { should respond_to(:annotationGuid=) }
67
- it { should respond_to(:userGuid) }
68
- it { should respond_to(:userGuid=) }
69
- it { should respond_to(:userName) }
70
- it { should respond_to(:userName=) }
71
- it { should respond_to(:text) }
72
- it { should respond_to(:text=) }
73
- it { should respond_to(:repliedOn) }
74
- it { should respond_to(:repliedOn=) }
75
-
76
- it { should have_alias(:annotation_guid, :annotationGuid) }
77
- it { should have_alias(:annotation_guid=, :annotationGuid=) }
78
- it { should have_alias(:user_guid, :userGuid) }
79
- it { should have_alias(:user_guid=, :userGuid=) }
80
- it { should have_alias(:user_name, :userName) }
81
- it { should have_alias(:user_name=, :userName=) }
59
+ it { should have_accessor(:annotation) }
60
+ it { should have_accessor(:text) }
61
+ it { should have_accessor(:guid) }
62
+ it { should have_accessor(:annotationGuid) }
63
+ it { should have_accessor(:userGuid) }
64
+ it { should have_accessor(:userName) }
65
+ it { should have_accessor(:text) }
66
+ it { should have_accessor(:repliedOn) }
67
+
68
+ it { should alias_accessor(:annotation_guid, :annotationGuid) }
69
+ it { should alias_accessor(:user_guid, :userGuid) }
70
+ it { should alias_accessor(:user_name, :userName) }
82
71
  # Reply#replied_on is overwritten
83
- it { should have_alias(:replied_on=, :repliedOn=) }
72
+ it { should have_alias(:replied_on=, :repliedOn=) }
84
73
 
85
74
 
86
75
  describe '#initialize' do
@@ -45,13 +45,9 @@ describe GroupDocs::Document::Annotation::Reviewer do
45
45
  end
46
46
  end
47
47
 
48
- it { should respond_to(:emailAddress) }
49
- it { should respond_to(:emailAddress=) }
50
- it { should respond_to(:FullName) }
51
- it { should respond_to(:FullName=) }
52
-
53
- it { should have_alias(:email_address, :emailAddress) }
54
- it { should have_alias(:email_address=, :emailAddress=) }
55
- it { should have_alias(:full_name, :FullName) }
56
- it { should have_alias(:full_name=, :FullName=) }
48
+ it { should have_accessor(:emailAddress) }
49
+ it { should have_accessor(:FullName) }
50
+
51
+ it { should alias_accessor(:email_address, :emailAddress) }
52
+ it { should alias_accessor(:full_name, :FullName) }
57
53
  end
@@ -11,46 +11,28 @@ describe GroupDocs::Document::Annotation do
11
11
  described_class.new(document: document)
12
12
  end
13
13
 
14
- it { should respond_to(:document) }
15
- it { should respond_to(:document=) }
16
- it { should respond_to(:id) }
17
- it { should respond_to(:id=) }
18
- it { should respond_to(:guid) }
19
- it { should respond_to(:guid=) }
20
- it { should respond_to(:sessionGuid) }
21
- it { should respond_to(:sessionGuid=) }
22
- it { should respond_to(:documentGuid) }
23
- it { should respond_to(:documentGuid=) }
24
- it { should respond_to(:creatorGuid) }
25
- it { should respond_to(:creatorGuid=) }
26
- it { should respond_to(:replyGuid) }
27
- it { should respond_to(:replyGuid=) }
28
- it { should respond_to(:createdOn) }
29
- it { should respond_to(:createdOn=) }
30
- it { should respond_to(:type) }
31
- it { should respond_to(:type=) }
32
- it { should respond_to(:access) }
33
- it { should respond_to(:access=) }
34
- it { should respond_to(:box) }
35
- it { should respond_to(:box=) }
36
- it { should respond_to(:replies) }
37
- it { should respond_to(:replies=) }
38
- it { should respond_to(:annotationPosition) }
39
- it { should respond_to(:annotationPosition=) }
40
-
41
- it { should have_alias(:session_guid, :sessionGuid) }
42
- it { should have_alias(:session_guid=, :sessionGuid=) }
43
- it { should have_alias(:document_guid, :documentGuid) }
44
- it { should have_alias(:document_guid=, :documentGuid=) }
45
- it { should have_alias(:creator_guid, :creatorGuid) }
46
- it { should have_alias(:creator_guid=, :creatorGuid=) }
47
- it { should have_alias(:reply_guid, :replyGuid) }
48
- it { should have_alias(:reply_guid=, :replyGuid=) }
14
+ it { should have_accessor(:document) }
15
+ it { should have_accessor(:id) }
16
+ it { should have_accessor(:guid) }
17
+ it { should have_accessor(:sessionGuid) }
18
+ it { should have_accessor(:documentGuid) }
19
+ it { should have_accessor(:creatorGuid) }
20
+ it { should have_accessor(:replyGuid) }
21
+ it { should have_accessor(:createdOn) }
22
+ it { should have_accessor(:type) }
23
+ it { should have_accessor(:access) }
24
+ it { should have_accessor(:box) }
25
+ it { should have_accessor(:replies) }
26
+ it { should have_accessor(:annotationPosition) }
27
+
28
+ it { should alias_accessor(:session_guid, :sessionGuid) }
29
+ it { should alias_accessor(:document_guid, :documentGuid) }
30
+ it { should alias_accessor(:creator_guid, :creatorGuid) }
31
+ it { should alias_accessor(:reply_guid, :replyGuid) }
49
32
  # Annotation#created_on is overwritten
50
- it { should have_alias(:created_on=, :createdOn=) }
51
- it { should have_alias(:annotation_position, :annotationPosition) }
52
- it { should have_alias(:annotation_position=, :annotationPosition=) }
53
- it { should have_alias(:position, :annotation_position) }
33
+ it { should have_alias(:created_on=, :createdOn=) }
34
+ it { should alias_accessor(:annotation_position, :annotationPosition) }
35
+ it { should alias_accessor(:position, :annotationPosition) }
54
36
 
55
37
  it { should have_alias(:annotationGuid=, :guid=) }
56
38
 
@@ -108,7 +90,7 @@ describe GroupDocs::Document::Annotation do
108
90
 
109
91
  describe '#box=' do
110
92
  it 'converts passed hash to GroupDocs::Document::Rectangle object' do
111
- subject.box = { X: 0.90, Y: 0.05, Width: 0.06745, Height: 0.005967 }
93
+ subject.box = { x: 0.90, y: 0.05, width: 0.06745, height: 0.005967 }
112
94
  subject.box.should be_a(GroupDocs::Document::Rectangle)
113
95
  subject.box.x.should == 0.90
114
96
  subject.box.y.should == 0.05
@@ -231,6 +213,19 @@ describe GroupDocs::Document::Annotation do
231
213
  subject.move_marker!(10, 10, client_id: 'client_id', private_key: 'private_key')
232
214
  end.should_not raise_error(ArgumentError)
233
215
  end
216
+
217
+ it 'updates box coordinates if it is set' do
218
+ subject.box = { x: 1, y: 2 }
219
+ subject.move_marker! 10, 10
220
+ subject.box.x.should == 10
221
+ subject.box.y.should == 10
222
+ end
223
+
224
+ it 'creates box coordinates if it is not set' do
225
+ subject.move_marker! 10, 10
226
+ subject.box.x.should == 10
227
+ subject.box.y.should == 10
228
+ end
234
229
  end
235
230
 
236
231
  describe '#set_access!' do