Created
December 9, 2021 04:39
-
-
Save billyyarosh/5dd50128ebd01ce4bc3d1013c2ff63f0 to your computer and use it in GitHub Desktop.
Song Service class
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
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