class JustimmoClient::V1::Attachment
Constants
- BASE_URL
Public Instance Methods
inspect()
click to toggle source
# File lib/justimmo_client/api/v1/models/attachment.rb, line 38 def inspect "#<#{self.class} #{self}>" end
url(size = nil)
click to toggle source
# File lib/justimmo_client/api/v1/models/attachment.rb, line 30 def url(size = nil) size ||= @size "#{BASE_URL}/#{@type}/#{size}/#{file}.#{format}" end
url=(value)
click to toggle source
FIXME: the attachment can be something other than a image file
maybe move type detection into representer?
# File lib/justimmo_client/api/v1/models/attachment.rb, line 21 def url=(value) path = URI.parse(value).path.sub("/public/", "") @type, size, file = path.split("/") return if file.nil? @format ||= ::File.extname(file).tr(".", "") @file = ::File.basename(file, ".#{@format}") @size = size.start_with?("user") ? :user_big : :big end