-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathphoto.rb
37 lines (30 loc) · 945 Bytes
/
photo.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require_relative '../base_classes/base_class_for_resource'
class Photo < BaseClassForResource
FIELDS = Set.new([
:albumId,
:id,
:title,
:url,
:thumbnailUrl,
])
attr_accessor *FIELDS
# Constructor.
Contract Hash => nil
def initialize(values = {})
super(FIELDS, values)
nil
end
Contract Log, VERDICT_ID => Bool
def verdict_valid?(log, verdict_id)
log.verdict_assert_integer_positive?([verdict_id, :album_id], self.albumId)
log.verdict_assert_integer_positive?([verdict_id, :id], self.id)
log.verdict_assert_string_not_empty?([verdict_id, :title], self.title)
log.verdict_assert_string_not_empty?([verdict_id, :url], self.url)
log.verdict_assert_string_not_empty?([verdict_id, :thumbnailUrl], self.thumbnailUrl)
end
# This is redundant, but it helps RubyMine code inspection.
attr_accessor \
:albumId,
:thumbnailUrl,
:url
end