Class: WeebSh::Interface
- Inherits:
-
Object
- Object
- WeebSh::Interface
- Defined in:
- lib/weeb/data.rb
Overview
Represents a generic interface
Instance Attribute Summary collapse
-
#api_url ⇒ String
readonly
The URL being used for weeb.sh.
-
#auth ⇒ String
The authorization used in weeb.sh.
-
#user_agent ⇒ String
The user agent used in weeb.sh.
Instance Method Summary collapse
-
#initialize(auth, user_agent = nil, api_url: 'https://api.weeb.sh', client: nil) ⇒ Interface
constructor
A new instance of Interface.
Constructor Details
#initialize(auth, user_agent = nil, api_url: 'https://api.weeb.sh', client: nil) ⇒ Interface
Returns a new instance of Interface.
33 34 35 36 37 38 39 40 41 42 43 |
# 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 |
Instance Attribute Details
#api_url ⇒ String (readonly)
Returns the URL being used for weeb.sh.
27 28 29 |
# File 'lib/weeb/data.rb', line 27 def api_url @api_url end |
#auth ⇒ String
Returns the authorization used in weeb.sh.
21 22 23 |
# File 'lib/weeb/data.rb', line 21 def auth @auth end |
#user_agent ⇒ String
Returns the user agent used in weeb.sh.
24 25 26 |
# File 'lib/weeb/data.rb', line 24 def user_agent @user_agent end |