class CrystalSDK::Profile
Attributes
info[R]
recommendations[R]
Public Class Methods
from_request(req)
click to toggle source
# File lib/crystal_sdk/profile.rb, line 15 def from_request(req) return nil unless req.did_find_profile? profile_info = req.profile_info Profile.new(profile_info[:info], profile_info[:recommendations]) end
new(info, recommendations)
click to toggle source
# File lib/crystal_sdk/profile.rb, line 9 def initialize(info, recommendations) @info = info @recommendations = recommendations end
search(query, timeout: 30)
click to toggle source
# File lib/crystal_sdk/profile.rb, line 22 def search(query, timeout: 30) request = nil profile = nil Timeout.timeout(timeout) do request = Profile::Request.from_search(query) loop do sleep(2) && next unless request.did_finish? raise NotFoundError unless request.did_find_profile? profile = Profile.from_request(request) break end end profile rescue Timeout::Error raise NotFoundYetError.new(request) end