Sha256: efb2819f9cc747fc2d469d28495f474a6fb624d4f51d269dd4da67e9364ce695
Contents?: true
Size: 871 Bytes
Versions: 4
Compression:
Stored size: 871 Bytes
Contents
require 'restclient' class MLS::Photo < MLS::Resource property :id, Fixnum property :digest, String property :created_at, DateTime property :updated_at, DateTime property :file_content_type, String property :file_name, String property :file_size, Fixnum property :url_template, String property :caption, String property :similar_subject_id, Fixnum, :serialize => false def url(style='700x467#', protocol='http') "#{protocol}://#{MLS.image_host}/#{digest}.jpg?s=#{URI.escape(style)}" end def self.create(attrs) attrs[:file].rewind url = MLS.url.dup url.user = nil url.path = "/api/photos" response = RestClient.post(url.to_s, {:file => attrs[:file]}, MLS.headers) attrs[:file].close unless attrs[:file].closed? MLS::Photo::Parser.parse(response.body) end end class MLS::Photo::Parser < MLS::Parser end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
mls-0.5.6 | lib/mls/models/photo.rb |
mls-0.5.5 | lib/mls/models/photo.rb |
mls-0.5.4 | lib/mls/models/photo.rb |
mls-0.5.3 | lib/mls/models/photo.rb |