groupdocs 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
data/lib/groupdocs/document.rb
CHANGED
@@ -449,9 +449,13 @@ module GroupDocs
|
|
449
449
|
request[:path] = "/ant/{{client_id}}/files/#{file.guid}/annotations"
|
450
450
|
end.execute!
|
451
451
|
|
452
|
-
json[:annotations]
|
453
|
-
|
454
|
-
|
452
|
+
if json[:annotations]
|
453
|
+
json[:annotations].map do |annotation|
|
454
|
+
annotation.merge!(document: self)
|
455
|
+
Document::Annotation.new(annotation)
|
456
|
+
end
|
457
|
+
else
|
458
|
+
[]
|
455
459
|
end
|
456
460
|
end
|
457
461
|
|
@@ -1,13 +1,18 @@
|
|
1
1
|
module GroupDocs
|
2
2
|
class Document::Annotation < GroupDocs::Api::Entity
|
3
3
|
|
4
|
+
require 'groupdocs/document/annotation/reply'
|
5
|
+
|
4
6
|
TYPES = {
|
5
7
|
text: 0,
|
6
8
|
area: 1,
|
7
9
|
point: 2,
|
8
10
|
}
|
9
11
|
|
10
|
-
|
12
|
+
ACCESS = {
|
13
|
+
private: 0,
|
14
|
+
public: 1,
|
15
|
+
}
|
11
16
|
|
12
17
|
# @attr [GroupDocs::Document] document
|
13
18
|
attr_accessor :document
|
@@ -72,7 +77,7 @@ module GroupDocs
|
|
72
77
|
end
|
73
78
|
|
74
79
|
#
|
75
|
-
# Returns
|
80
|
+
# Returns type in human-readable format.
|
76
81
|
#
|
77
82
|
# @return [Symbol]
|
78
83
|
#
|
@@ -80,6 +85,30 @@ module GroupDocs
|
|
80
85
|
TYPES.invert[@type]
|
81
86
|
end
|
82
87
|
|
88
|
+
#
|
89
|
+
# Updates access mode with machine-readable format.
|
90
|
+
#
|
91
|
+
# @param [Symbol] access
|
92
|
+
# @raise [ArgumentError] if access mode is unknown
|
93
|
+
#
|
94
|
+
def access=(access)
|
95
|
+
if access.is_a?(Symbol)
|
96
|
+
ACCESS.keys.include?(access) or raise ArgumentError, "Unknown access mode: #{access.inspect}"
|
97
|
+
access = ACCESS[access]
|
98
|
+
end
|
99
|
+
|
100
|
+
@access = access
|
101
|
+
end
|
102
|
+
|
103
|
+
#
|
104
|
+
# Returns access mode in human-readable format.
|
105
|
+
#
|
106
|
+
# @return [Symbol]
|
107
|
+
#
|
108
|
+
def access
|
109
|
+
ACCESS.invert[@access]
|
110
|
+
end
|
111
|
+
|
83
112
|
#
|
84
113
|
# Converts timestamp which is return by API server to Time object.
|
85
114
|
#
|
data/lib/groupdocs/version.rb
CHANGED
@@ -90,6 +90,29 @@ describe GroupDocs::Document::Annotation do
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
+
describe '#access=' do
|
94
|
+
it 'saves access mode in machine readable format if symbol is passed' do
|
95
|
+
subject.access = :public
|
96
|
+
subject.instance_variable_get(:@access).should == 1
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'does nothing if parameter is not symbol' do
|
100
|
+
subject.access = 1
|
101
|
+
subject.instance_variable_get(:@access).should == 1
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'raises error if access mode is unknown' do
|
105
|
+
-> { subject.access = :unknown }.should raise_error(ArgumentError)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
describe '#access' do
|
110
|
+
it 'returns access in human-readable format' do
|
111
|
+
subject.access = 1
|
112
|
+
subject.access.should == :public
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
93
116
|
describe '#created_on' do
|
94
117
|
it 'returns converted to Time object Unix timestamp' do
|
95
118
|
subject.created_on = 1332950825000
|
@@ -454,6 +454,11 @@ describe GroupDocs::Document do
|
|
454
454
|
annotation.should be_a(GroupDocs::Document::Annotation)
|
455
455
|
end
|
456
456
|
end
|
457
|
+
|
458
|
+
it 'returns empty array if annotations are null in reponse' do
|
459
|
+
mock_api_server('{"status": "Ok", "result": {"annotations": null }}')
|
460
|
+
subject.annotations!.should be_empty
|
461
|
+
end
|
457
462
|
end
|
458
463
|
|
459
464
|
describe '#details!' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groupdocs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
16
|
-
requirement: &
|
16
|
+
requirement: &7274960 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.6'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *7274960
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: json
|
27
|
-
requirement: &
|
27
|
+
requirement: &7289660 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '1.7'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *7289660
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: ruby-hmac
|
38
|
-
requirement: &
|
38
|
+
requirement: &7288280 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0.4'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *7288280
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &7286440 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '2.9'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *7286440
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rake
|
60
|
-
requirement: &
|
60
|
+
requirement: &7285540 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0.9'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *7285540
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
|
-
requirement: &
|
71
|
+
requirement: &7284620 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0.6'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *7284620
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: yard
|
82
|
-
requirement: &
|
82
|
+
requirement: &7283220 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0.8'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *7283220
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: webmock
|
93
|
-
requirement: &
|
93
|
+
requirement: &7295620 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: '1.8'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *7295620
|
102
102
|
description: Ruby SDK for GroupDocs REST API
|
103
103
|
email: p0deje@gmail.com
|
104
104
|
executables: []
|
@@ -253,7 +253,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
253
253
|
version: '0'
|
254
254
|
segments:
|
255
255
|
- 0
|
256
|
-
hash: -
|
256
|
+
hash: -158613049644168809
|
257
257
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
258
258
|
none: false
|
259
259
|
requirements:
|
@@ -262,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
262
262
|
version: '0'
|
263
263
|
segments:
|
264
264
|
- 0
|
265
|
-
hash: -
|
265
|
+
hash: -158613049644168809
|
266
266
|
requirements: []
|
267
267
|
rubyforge_project:
|
268
268
|
rubygems_version: 1.8.10
|