Created
September 25, 2015 19:18
-
-
Save rjhornsby/84d0e1481216808c18f7 to your computer and use it in GitHub Desktop.
This file contains 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
def to_h | |
{ | |
:title => title, | |
:artist => artist, | |
:album => album, | |
:remarks => remarks, | |
:url => url, | |
:short_url => short_url, | |
} | |
end | |
def to_json(*a) | |
{ | |
:json_class => self.class.name, | |
:data => self.to_h | |
}.to_json(*a) | |
end | |
def self.json_create(*o) | |
new( | |
o[0]['data']['title'], | |
o[0]['data']['artist'], | |
o[0]['data']['album'], | |
o[0]['data']['remarks'], | |
o[0]['data']['url'], | |
o[0]['data']['short_url'] | |
) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment