Skip to content

Instantly share code, notes, and snippets.

@billyyarosh
Created December 9, 2021 04:39
Show Gist options
  • Save billyyarosh/5dd50128ebd01ce4bc3d1013c2ff63f0 to your computer and use it in GitHub Desktop.
Save billyyarosh/5dd50128ebd01ce4bc3d1013c2ff63f0 to your computer and use it in GitHub Desktop.
Song Service class
class SongService
attr_reader :gateway_service
def initialize(gateway_service: SongGatewayService.new)
@gateway_service = gateway_service
end
# Creates a song
# @param [Song] song
# @return [Song] created song
def create_song(song)
song.validate!
result = gateway_service.create_song(song)
created_song = Song.new
created_song.from_json(result)
created_song
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment