class Jahuty::Snippet::Service::Get
Public Class Methods
new(connection)
click to toggle source
# File lib/jahuty/snippet/service/get.rb, line 9 def initialize(connection) @connection = connection end
Public Instance Methods
call(id)
click to toggle source
# File lib/jahuty/snippet/service/get.rb, line 14 def call(id) response = @connection.get(id.to_s) payload = JSON.parse(response.body, symbolize_names: true) if response.status != 200 raise ::Jahuty::Snippet::Exception::NotOk.new( ::Jahuty::Snippet::Data::Problem.from(payload) ) end return ::Jahuty::Snippet::Data::Snippet.from(payload) end