Skip to content

Instantly share code, notes, and snippets.

@rjhornsby
Created September 25, 2015 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjhornsby/84d0e1481216808c18f7 to your computer and use it in GitHub Desktop.
Save rjhornsby/84d0e1481216808c18f7 to your computer and use it in GitHub Desktop.
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