Created
December 9, 2013 02:57
-
-
Save dangalipo/7866778 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JsonTarget | |
attr_accessor :votes_count, :votes_percentage, :position, :type, :media, :post | |
def factory_hash | |
{ | |
position: position, | |
type: type, | |
media: media, | |
post: post | |
} | |
end | |
def create_request_hash | |
{ | |
type: (type == "ImageTarget" ? "image" : "video"), | |
media: media, | |
position: position | |
} | |
end | |
def expected_response(record) | |
{ | |
id: record.id, | |
votes_count: votes_count, | |
votes_percentage: votes_percentage, | |
position: position, | |
type: type, | |
media: "/uploads/#{type.underscore}/media/#{record.id}/#{media.original_filename}" | |
} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment