class WeebSh::Interface
Represents a generic interface
Attributes
api_url[R]
@return [String] the URL being used for weeb.sh.
auth[RW]
@return [String] the authorization used in weeb.sh.
user_agent[RW]
@return [String] the user agent used in weeb.sh.
Public Class Methods
new(auth, user_agent = nil, api_url: 'https://api.weeb.sh', client: nil)
click to toggle source
@param auth [String] the authentication required to use weeb.sh. @param user_agent
[String, Hash] the user agent to use on endpoints. @param api_url
[String] the URL to use when using the weeb.sh API
. @param client [Client] the client this is tied to.
# File lib/weeb/data.rb, line 33 def initialize(auth, user_agent = nil, api_url: 'https://api.weeb.sh', client: nil) @user_agent = WeebSh::API.format_user_agent(user_agent) @auth = auth @api_url = api_url @client = client return if client raise WeebSh::Err::BadAuth, 'Authorization is empty!' if auth.empty? puts "[#{self.class.name}] Your User Agent is empty. Please consider adding a user agent to help identify issues easier." if user_agent.nil? puts "[#{self.class.name}] Your User Agent is not ideal. Please consider adding a user agent to help identify issues easier." if !user_agent.nil? && user_agent.split('/').count < 2 end
Public Instance Methods
inspect()
click to toggle source
@!visibility private
# File lib/weeb/data.rb, line 46 def inspect "#<#{self.class.name} @api_url=#{@api_url.inspect} @user_agent=#{@user_agent.inspect}>" end