class CrystalSDK::EmailSample::Request
Public Class Methods
new(id)
click to toggle source
# File lib/crystal_sdk/email_sample/request.rb, line 8 def initialize(id) @id = id end
Public Instance Methods
check_for_error(resp)
click to toggle source
# File lib/crystal_sdk/email_sample/request.rb, line 23 def check_for_error(resp) raise EmailSample::NotAuthedError.new(Base.key) if resp.code == '401' raise EmailSample::NotFoundError if resp.code == '404' end
from_all()
click to toggle source
# File lib/crystal_sdk/email_sample/request.rb, line 12 def from_all begin resp = Api.make_request(:get, "emails/#{@id}") rescue Nestful::ResponseError => e check_for_error(e.response) raise e end body = JSON.parse(resp.body || '{}', symbolize_names: true) end