Class: Size

Inherits:
Object
  • Object
show all
Includes:
MongoMapper::Document
Defined in:
lib/oii_twitter_goodies/model/size.rb

Class Method Summary collapse

Class Method Details

.exampleObject



10
11
12
# File 'lib/oii_twitter_goodies/model/size.rb', line 10

def self.example
  {"thumb"=>{"resize"=>"crop", "h"=>150, "w"=>150}}
end

.new_from_raw(size_type, size_data, media_id) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/oii_twitter_goodies/model/size.rb', line 14

def self.new_from_raw(size_type, size_data, media_id)
  size_data = Hashie::Mash[size_data]
  obj = self.new
  obj.size   = size_type
  obj.resize = size_data["resize"]
  obj.h      = size_data["h"]
  obj.w      = size_data["w"]
  obj.media_id = media_id
  obj.save!
  obj
end