Class: Tumblr::Post::Photo
Constant Summary
Constants inherited
from Tumblr::Post
FIELDS, POST_BODY_SEPARATOR
Class Method Summary
collapse
Instance Method Summary
collapse
create, #date, #delete, #draft!, #draft?, dump, #edit, #format, get_post_type, #id, infer_post_type_from_extname, infer_post_type_from_string, load, load_from_binary, load_from_path, #markdown?, #meta_data, pair_post_body_types, parse, perform, #post, #private?, #publish!, #published?, #queue!, #queued?, #reblog_key, #request_parameters, #serialize, #slug, #state, #tags, #tweet, #type
Constructor Details
#initialize(post_data = {}) ⇒ Photo
Returns a new instance of Photo.
4
5
6
7
8
|
# File 'lib/tumblr/post/photo.rb', line 4
def initialize(post_data = {})
super(post_data)
@type = :photo
@source ||= first_photo_url_from_response
end
|
Class Method Details
.post_body_keys ⇒ Object
30
31
32
|
# File 'lib/tumblr/post/photo.rb', line 30
def self.post_body_keys
[:source, :caption]
end
|
Instance Method Details
#caption ⇒ Object
10
11
12
|
# File 'lib/tumblr/post/photo.rb', line 10
def caption
@caption
end
|
#data ⇒ Object
22
23
24
|
# File 'lib/tumblr/post/photo.rb', line 22
def data
@data
end
|
#first_photo_url_from_response ⇒ Object
26
27
28
|
# File 'lib/tumblr/post/photo.rb', line 26
def first_photo_url_from_response
@photos.first["original_size"]["url"] if @photos and !@photos.empty?
end
|
#link ⇒ Object
14
15
16
|
# File 'lib/tumblr/post/photo.rb', line 14
def link
@link
end
|
#source ⇒ Object
18
19
20
|
# File 'lib/tumblr/post/photo.rb', line 18
def source
@source
end
|