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
@@ -34,11 +34,9 @@ describe GroupDocs::Signature::Template do
34
34
  end
35
35
  end
36
36
 
37
- it { should respond_to(:templateExpireTime) }
38
- it { should respond_to(:templateExpireTime=) }
37
+ it { should have_accessor(:templateExpireTime) }
39
38
 
40
- it { should have_alias(:template_expire_time, :templateExpireTime) }
41
- it { should have_alias(:template_expire_time=, :templateExpireTime=) }
39
+ it { should alias_accessor(:template_expire_time, :templateExpireTime) }
42
40
 
43
41
  describe '#add_recipient!' do
44
42
  let(:recipient) do
@@ -24,61 +24,35 @@ describe GroupDocs::Signature do
24
24
  end
25
25
  end
26
26
 
27
- it { should respond_to(:id) }
28
- it { should respond_to(:id=) }
29
- it { should respond_to(:userGuid) }
30
- it { should respond_to(:userGuid=) }
31
- it { should respond_to(:recipientId) }
32
- it { should respond_to(:recipientId=) }
33
- it { should respond_to(:name) }
34
- it { should respond_to(:name=) }
35
- it { should respond_to(:companyName) }
36
- it { should respond_to(:companyName=) }
37
- it { should respond_to(:position) }
38
- it { should respond_to(:position=) }
39
- it { should respond_to(:firstName) }
40
- it { should respond_to(:firstName=) }
41
- it { should respond_to(:lastName) }
42
- it { should respond_to(:lastName=) }
43
- it { should respond_to(:fullName) }
44
- it { should respond_to(:fullName=) }
45
- it { should respond_to(:textInitials) }
46
- it { should respond_to(:textInitials=) }
47
- it { should respond_to(:signatureImageFileId) }
48
- it { should respond_to(:signatureImageFileId=) }
49
- it { should respond_to(:initialsImageFileId) }
50
- it { should respond_to(:initialsImageFileId=) }
51
- it { should respond_to(:signatureImageUrl) }
52
- it { should respond_to(:signatureImageUrl=) }
53
- it { should respond_to(:initialsImageUrl) }
54
- it { should respond_to(:initialsImageUrl=) }
55
- it { should respond_to(:createdTimeStamp) }
56
- it { should respond_to(:createdTimeStamp=) }
27
+ it { should have_accessor(:id) }
28
+ it { should have_accessor(:userGuid) }
29
+ it { should have_accessor(:recipientId) }
30
+ it { should have_accessor(:name) }
31
+ it { should have_accessor(:companyName) }
32
+ it { should have_accessor(:position) }
33
+ it { should have_accessor(:firstName) }
34
+ it { should have_accessor(:lastName) }
35
+ it { should have_accessor(:fullName) }
36
+ it { should have_accessor(:textInitials) }
37
+ it { should have_accessor(:signatureImageFileId) }
38
+ it { should have_accessor(:initialsImageFileId) }
39
+ it { should have_accessor(:signatureImageUrl) }
40
+ it { should have_accessor(:initialsImageUrl) }
41
+ it { should have_accessor(:createdTimeStamp) }
42
+ it { should have_accessor(:image_path) }
57
43
 
58
- it { should have_alias(:user_guid, :userGuid) }
59
- it { should have_alias(:user_guid=, :userGuid=) }
60
- it { should have_alias(:recipient_id, :recipientId) }
61
- it { should have_alias(:recipient_id=, :recipientId=) }
62
- it { should have_alias(:company_name, :companyName) }
63
- it { should have_alias(:company_name=, :companyName=) }
64
- it { should have_alias(:first_name, :firstName) }
65
- it { should have_alias(:first_name=, :firstName=) }
66
- it { should have_alias(:last_name, :lastName) }
67
- it { should have_alias(:last_name=, :lastName=) }
68
- it { should have_alias(:full_name, :fullName) }
69
- it { should have_alias(:full_name=, :fullName=) }
70
- it { should have_alias(:text_initials, :textInitials) }
71
- it { should have_alias(:text_initials=, :textInitials=) }
72
- it { should have_alias(:signature_image_file_id, :signatureImageFileId) }
73
- it { should have_alias(:signature_image_file_id=, :signatureImageFileId=) }
74
- it { should have_alias(:initials_image_file_id, :initialsImageFileId) }
75
- it { should have_alias(:initials_image_file_id=, :initialsImageFileId=) }
76
- it { should have_alias(:signature_image_url, :signatureImageUrl) }
77
- it { should have_alias(:signature_image_url=, :signatureImageUrl=) }
78
- it { should have_alias(:initials_image_url, :initialsImageUrl) }
79
- it { should have_alias(:initials_image_url=, :initialsImageUrl=) }
80
- it { should have_alias(:created_time_stamp, :createdTimeStamp) }
81
- it { should have_alias(:created_time_stamp=, :createdTimeStamp=) }
44
+ it { should alias_accessor(:user_guid, :userGuid) }
45
+ it { should alias_accessor(:recipient_id, :recipientId) }
46
+ it { should alias_accessor(:company_name, :companyName) }
47
+ it { should alias_accessor(:first_name, :firstName) }
48
+ it { should alias_accessor(:last_name, :lastName) }
49
+ it { should alias_accessor(:full_name, :fullName) }
50
+ it { should alias_accessor(:text_initials, :textInitials) }
51
+ it { should alias_accessor(:signature_image_file_id, :signatureImageFileId) }
52
+ it { should alias_accessor(:initials_image_file_id, :initialsImageFileId) }
53
+ it { should alias_accessor(:signature_image_url, :signatureImageUrl) }
54
+ it { should alias_accessor(:initials_image_url, :initialsImageUrl) }
55
+ it { should alias_accessor(:created_time_stamp, :createdTimeStamp) }
82
56
 
83
57
  describe '#create!' do
84
58
  before(:each) do
@@ -61,32 +61,20 @@ describe GroupDocs::Storage::File do
61
61
  end
62
62
  end
63
63
 
64
- it { should respond_to(:id) }
65
- it { should respond_to(:id=) }
66
- it { should respond_to(:guid) }
67
- it { should respond_to(:guid=) }
68
- it { should respond_to(:known) }
69
- it { should respond_to(:known=) }
70
- it { should respond_to(:size) }
71
- it { should respond_to(:size=) }
72
- it { should respond_to(:thumbnail) }
73
- it { should respond_to(:thumbnail=) }
74
- it { should respond_to(:created_on) }
75
- it { should respond_to(:created_on=) }
76
- it { should respond_to(:modified_on) }
77
- it { should respond_to(:modified_on=) }
78
- it { should respond_to(:url) }
79
- it { should respond_to(:url=) }
80
- it { should respond_to(:name) }
81
- it { should respond_to(:name=) }
82
- it { should respond_to(:version) }
83
- it { should respond_to(:version=) }
84
- it { should respond_to(:type) }
85
- it { should respond_to(:type=) }
86
- it { should respond_to(:file_type) }
87
- it { should respond_to(:file_type=) }
88
- it { should respond_to(:path) }
89
- it { should respond_to(:path=) }
64
+ it { should have_accessor(:id) }
65
+ it { should have_accessor(:guid) }
66
+ it { should have_accessor(:known) }
67
+ it { should have_accessor(:size) }
68
+ it { should have_accessor(:thumbnail) }
69
+ it { should have_accessor(:created_on) }
70
+ it { should have_accessor(:modified_on) }
71
+ it { should have_accessor(:url) }
72
+ it { should have_accessor(:name) }
73
+ it { should have_accessor(:version) }
74
+ it { should have_accessor(:type) }
75
+ it { should have_accessor(:file_type) }
76
+ it { should have_accessor(:path) }
77
+ it { should have_accessor(:local_path) }
90
78
 
91
79
  it { should have_alias(:adj_name=, :name=) }
92
80
 
@@ -49,26 +49,16 @@ describe GroupDocs::Storage::Folder do
49
49
  end
50
50
  end
51
51
 
52
- it { should respond_to(:id) }
53
- it { should respond_to(:id=) }
54
- it { should respond_to(:size) }
55
- it { should respond_to(:size=) }
56
- it { should respond_to(:folder_count) }
57
- it { should respond_to(:folder_count=) }
58
- it { should respond_to(:file_count) }
59
- it { should respond_to(:file_count=) }
60
- it { should respond_to(:created_on) }
61
- it { should respond_to(:created_on=) }
62
- it { should respond_to(:modified_on) }
63
- it { should respond_to(:modified_on=) }
64
- it { should respond_to(:url) }
65
- it { should respond_to(:url=) }
66
- it { should respond_to(:name) }
67
- it { should respond_to(:name=) }
68
- it { should respond_to(:version) }
69
- it { should respond_to(:version=) }
70
- it { should respond_to(:type) }
71
- it { should respond_to(:type=) }
52
+ it { should have_accessor(:id) }
53
+ it { should have_accessor(:size) }
54
+ it { should have_accessor(:folder_count) }
55
+ it { should have_accessor(:file_count) }
56
+ it { should have_accessor(:created_on) }
57
+ it { should have_accessor(:modified_on) }
58
+ it { should have_accessor(:url) }
59
+ it { should have_accessor(:name) }
60
+ it { should have_accessor(:version) }
61
+ it { should have_accessor(:type) }
72
62
 
73
63
  describe '#created_on' do
74
64
  it 'returns converted to Time object Unix timestamp' do
@@ -102,8 +92,12 @@ describe GroupDocs::Storage::Folder do
102
92
 
103
93
  it 'capitalizes :order_by option' do
104
94
  options = { order_by: 'field' }
105
- options[:order_by].should_receive(:capitalize!)
106
- subject.list!(options)
95
+ -> { subject.list!(options) }.should change { options[:order_by] }.to('Field')
96
+ end
97
+
98
+ it 'camelizes :order_by option' do
99
+ options = { order_by: 'modified_on' }
100
+ -> { subject.list!(options) }.should change { options[:order_by] }.to('ModifiedOn')
107
101
  end
108
102
 
109
103
  it 'returns array' do
@@ -4,10 +4,8 @@ describe GroupDocs::Storage::Package 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(:objects) }
10
- it { should respond_to(:objects=) }
7
+ it { should have_accessor(:name) }
8
+ it { should have_accessor(:objects) }
11
9
 
12
10
  describe '#add' do
13
11
  it 'adds objects to be packed later' do
@@ -4,21 +4,13 @@ describe GroupDocs::Subscription::Limit do
4
4
 
5
5
  it_behaves_like GroupDocs::Api::Entity
6
6
 
7
- it { should respond_to(:Id) }
8
- it { should respond_to(:Id=) }
9
- it { should respond_to(:Min) }
10
- it { should respond_to(:Min=) }
11
- it { should respond_to(:Max) }
12
- it { should respond_to(:Max=) }
13
- it { should respond_to(:Description) }
14
- it { should respond_to(:Description=) }
7
+ it { should have_accessor(:Id) }
8
+ it { should have_accessor(:Min) }
9
+ it { should have_accessor(:Max) }
10
+ it { should have_accessor(:Description) }
15
11
 
16
- it { should have_alias(:id, :Id) }
17
- it { should have_alias(:id=, :Id=) }
18
- it { should have_alias(:min, :Min) }
19
- it { should have_alias(:min=, :Min=) }
20
- it { should have_alias(:max, :Max) }
21
- it { should have_alias(:max=, :Max=) }
22
- it { should have_alias(:description, :Description) }
23
- it { should have_alias(:description=, :Description=) }
12
+ it { should alias_accessor(:id, :Id) }
13
+ it { should alias_accessor(:min, :Min) }
14
+ it { should alias_accessor(:max, :Max) }
15
+ it { should alias_accessor(:description, :Description) }
24
16
  end
@@ -40,33 +40,22 @@ describe GroupDocs::Subscription do
40
40
  end
41
41
  end
42
42
 
43
- it { should respond_to(:Id) }
44
- it { should respond_to(:Id=) }
45
- it { should respond_to(:Name) }
46
- it { should respond_to(:Name=) }
47
- it { should respond_to(:PricingPlanId) }
48
- it { should respond_to(:PricingPlanId=) }
49
- it { should respond_to(:Price) }
50
- it { should respond_to(:Price=) }
51
- it { should respond_to(:CurrencyCode) }
52
- it { should respond_to(:CurrencyCode=) }
43
+ it { should have_accessor(:Id) }
44
+ it { should have_accessor(:Name) }
45
+ it { should have_accessor(:PricingPlanId) }
46
+ it { should have_accessor(:Price) }
47
+ it { should have_accessor(:CurrencyCode) }
53
48
 
54
- it { should have_alias(:id, :Id) }
55
- it { should have_alias(:id=, :Id=) }
56
- it { should have_alias(:name, :Name) }
57
- it { should have_alias(:name=, :Name=) }
58
- it { should have_alias(:pricing_plan_id, :PricingPlanId) }
59
- it { should have_alias(:pricing_plan_id=, :PricingPlanId=) }
60
- it { should have_alias(:price, :Price) }
61
- it { should have_alias(:price=, :Price=) }
62
- it { should have_alias(:currency_code, :CurrencyCode) }
63
- it { should have_alias(:currency_code=, :CurrencyCode=) }
49
+ it { should alias_accessor(:id, :Id) }
50
+ it { should alias_accessor(:name, :Name) }
51
+ it { should alias_accessor(:pricing_plan_id, :PricingPlanId) }
52
+ it { should alias_accessor(:price, :Price) }
53
+ it { should alias_accessor(:currency_code, :CurrencyCode) }
64
54
 
65
55
  it { should have_alias(:ref_id=, :id=) }
66
56
 
67
57
  GroupDocs::Subscription::LIMITS.each do |snake, camel|
68
- it { should respond_to(:"#{camel}") }
69
- it { should respond_to(:"#{camel}=") }
58
+ it { should have_accessor(camel) }
70
59
 
71
60
  # reader is overwritten
72
61
  it { should have_alias(:"#{snake}=", :"#{camel}=") }
@@ -20,47 +20,27 @@ describe GroupDocs::User do
20
20
  end
21
21
  end
22
22
 
23
- it { should respond_to(:id) }
24
- it { should respond_to(:id=) }
25
- it { should respond_to(:guid) }
26
- it { should respond_to(:guid=) }
27
- it { should respond_to(:nickname) }
28
- it { should respond_to(:nickname=) }
29
- it { should respond_to(:firstname) }
30
- it { should respond_to(:firstname=) }
31
- it { should respond_to(:lastname) }
32
- it { should respond_to(:lastname=) }
33
- it { should respond_to(:primary_email) }
34
- it { should respond_to(:primary_email=) }
35
- it { should respond_to(:private_key) }
36
- it { should respond_to(:private_key=) }
37
- it { should respond_to(:password_salt) }
38
- it { should respond_to(:password_salt=) }
39
- it { should respond_to(:claimed_id) }
40
- it { should respond_to(:claimed_id=) }
41
- it { should respond_to(:token) }
42
- it { should respond_to(:token=) }
43
- it { should respond_to(:storage) }
44
- it { should respond_to(:storage=) }
45
- it { should respond_to(:photo) }
46
- it { should respond_to(:photo=) }
47
- it { should respond_to(:active) }
48
- it { should respond_to(:active=) }
49
- it { should respond_to(:news_enabled) }
50
- it { should respond_to(:news_enabled=) }
51
- it { should respond_to(:signed_up_on) }
52
- it { should respond_to(:signed_up_on=) }
53
- it { should respond_to(:color) }
54
- it { should respond_to(:color=) }
55
- it { should respond_to(:customEmailMessage) }
56
- it { should respond_to(:customEmailMessage=) }
57
-
58
- it { should have_alias(:first_name, :firstname) }
59
- it { should have_alias(:first_name=, :firstname=) }
60
- it { should have_alias(:last_name, :lastname) }
61
- it { should have_alias(:last_name=, :lastname=) }
62
- it { should have_alias(:custom_email_message, :customEmailMessage) }
63
- it { should have_alias(:custom_email_message=, :customEmailMessage=) }
23
+ it { should have_accessor(:id) }
24
+ it { should have_accessor(:guid) }
25
+ it { should have_accessor(:nickname) }
26
+ it { should have_accessor(:firstname) }
27
+ it { should have_accessor(:lastname) }
28
+ it { should have_accessor(:primary_email) }
29
+ it { should have_accessor(:private_key) }
30
+ it { should have_accessor(:password_salt) }
31
+ it { should have_accessor(:claimed_id) }
32
+ it { should have_accessor(:token) }
33
+ it { should have_accessor(:storage) }
34
+ it { should have_accessor(:photo) }
35
+ it { should have_accessor(:active) }
36
+ it { should have_accessor(:news_enabled) }
37
+ it { should have_accessor(:signed_up_on) }
38
+ it { should have_accessor(:color) }
39
+ it { should have_accessor(:customEmailMessage) }
40
+
41
+ it { should alias_accessor(:first_name, :firstname) }
42
+ it { should alias_accessor(:last_name, :lastname) }
43
+ it { should alias_accessor(:custom_email_message, :customEmailMessage) }
64
44
 
65
45
  it { should have_alias(:pkey=, :private_key=) }
66
46
  it { should have_alias(:pswd_salt=, :password_salt=) }
@@ -34,14 +34,10 @@ describe GroupDocs do
34
34
  end
35
35
  end
36
36
 
37
- it { should respond_to(:client_id) }
38
- it { should respond_to(:client_id=) }
39
- it { should respond_to(:private_key) }
40
- it { should respond_to(:private_key=) }
41
- it { should respond_to(:api_server) }
42
- it { should respond_to(:api_server=) }
43
- it { should respond_to(:api_version) }
44
- it { should respond_to(:api_version=) }
37
+ it { should have_accessor(:client_id) }
38
+ it { should have_accessor(:private_key) }
39
+ it { should have_accessor(:api_server) }
40
+ it { should have_accessor(:api_version) }
45
41
 
46
42
  describe '#api_server' do
47
43
  it 'returns default URL if it has not been overwritten' do
data/spec/spec_helper.rb CHANGED
@@ -12,12 +12,24 @@ require 'groupdocs'
12
12
  Dir['spec/support/shared_examples/**/*.rb'].each { |file| file = file.sub(/spec\//, ''); require file }
13
13
 
14
14
  # matchers extension
15
+ RSpec::Matchers.define :have_accessor do |name|
16
+ match do |object|
17
+ object.should respond_to(:"#{name}")
18
+ object.should respond_to(:"#{name}=")
19
+ end
20
+ end
15
21
  RSpec::Matchers.define :have_alias do |aliased, original|
16
22
  match do |object|
17
23
  object.should respond_to(aliased)
18
24
  object.method(aliased).should == object.method(original)
19
25
  end
20
26
  end
27
+ RSpec::Matchers.define :alias_accessor do |aliased, original|
28
+ match do |object|
29
+ object.should have_alias(:"#{aliased}", :"#{original}")
30
+ object.should have_alias(:"#{aliased}=", :"#{original}=")
31
+ end
32
+ end
21
33
 
22
34
  # configure API access
23
35
  RSpec.configure do |spec|
Binary file
@@ -10,15 +10,15 @@
10
10
  "sessionGuid": null,
11
11
  "box":
12
12
  {
13
- "X": 0.8938259,
14
- "Y": 0.31941694,
15
- "Width": 0.0457534268,
16
- "Height": 0.01388945
13
+ "x": 0.8938259,
14
+ "y": 0.31941694,
15
+ "width": 0.0457534268,
16
+ "height": 0.01388945
17
17
  },
18
18
  "annotationPosition":
19
19
  {
20
- "X": null,
21
- "Y": null
20
+ "x": null,
21
+ "y": null
22
22
  },
23
23
  "type": "Text",
24
24
  "access": "Public",
@@ -14,10 +14,10 @@
14
14
  },
15
15
  "box":
16
16
  {
17
- "X": 0.8938259,
18
- "Y": 0.31941694,
19
- "Width": 0.0457534268,
20
- "Height": 0.01388945
17
+ "x": 0.8938259,
18
+ "y": 0.31941694,
19
+ "width": 0.0457534268,
20
+ "height": 0.01388945
21
21
  },
22
22
  "text": "This part was deleted"
23
23
  },
@@ -32,10 +32,10 @@
32
32
  },
33
33
  "box":
34
34
  {
35
- "X": 0.34985,
36
- "Y": 0.3476543,
37
- "Width": 0.2374,
38
- "Height": 0.4765943
35
+ "x": 0.34985,
36
+ "y": 0.3476543,
37
+ "width": 0.2374,
38
+ "height": 0.4765943
39
39
  },
40
40
  "text": "This part was inserted"
41
41
  }