Class: Pastvu::Photo
Instance Method Summary
collapse
Methods inherited from Model
#initialize, #to_hash, #to_json
Constructor Details
This class inherits a constructor from Pastvu::Model
Instance Method Details
10
11
12
|
# File 'lib/pastvu/photo/photo.rb', line 10
def
Pastvu. @cid
end
|
#download(size, path) ⇒ Object
14
15
16
17
18
19
|
# File 'lib/pastvu/photo/photo.rb', line 14
def download(size, path)
raise ArgumentError, "expect size to be correct symbol" unless %i[original standard thumbnail thumb].include?(size)
raise ArgumentError, "expect file extension to be .jpeg or .jpg" unless path[-4..-1] == ".jpg" || path[-5..-1] == ".jpeg"
Request.download(method(size).call, path)
end
|
#original ⇒ Object
25
26
27
|
# File 'lib/pastvu/photo/photo.rb', line 25
def original
"https://pastvu.com/_p/a/".concat(file)
end
|
#reload ⇒ Object
VALID_ATTRIBUTES = %w[cid s file title dir geo year ccount] attr_accessor *VALID_ATTRIBUTES
6
7
8
|
# File 'lib/pastvu/photo/photo.rb', line 6
def reload
Pastvu.photo @cid
end
|
#standard ⇒ Object
21
22
23
|
# File 'lib/pastvu/photo/photo.rb', line 21
def standard
"https://pastvu.com/_p/d/".concat(file)
end
|
#thumb ⇒ Object
33
34
35
|
# File 'lib/pastvu/photo/photo.rb', line 33
def thumb
thumbnail
end
|
#thumbnail ⇒ Object
29
30
31
|
# File 'lib/pastvu/photo/photo.rb', line 29
def thumbnail
"https://pastvu.com/_p/h/".concat(file)
end
|