Class: WeebSh::Client
- Inherits:
-
Object
- Object
- WeebSh::Client
- Defined in:
- lib/weeb/interfaces/client.rb
Instance Attribute Summary collapse
-
#api_url ⇒ String
The URL being used for weeb.sh.
-
#auth ⇒ String
The authorization used in weeb.sh.
-
#korra ⇒ String
(also: #image_gen, #auto_image)
readonly
The korra class tied with the client.
-
#shimakaze ⇒ String
(also: #reputation, #rep)
readonly
The shimakaze class tied with the client.
-
#tama ⇒ String
(also: #settings)
readonly
The tama class tied with the client.
-
#toph ⇒ Topc
(also: #image, #images)
readonly
The toph class tied with the client.
-
#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
constructor
Groups all interfaces into one.
- #inspect ⇒ Object
Constructor Details
#initialize(auth, user_agent = nil, api_url: 'https://api.weeb.sh') ⇒ Client
Groups all interfaces into one.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/weeb/interfaces/client.rb', line 39 def initialize(auth, user_agent = nil, api_url: 'https://api.weeb.sh') @user_agent = WeebSh::API.format_user_agent(user_agent) @auth = auth @api_url = api_url raise WeebSh::Err::BadAuth, 'Authorization is empty!' if auth.empty? puts '[WeebSh::Client] Your User Agent is empty. Please consider adding a user agent to help identify issues easier.' if user_agent.nil? puts '[WeebSh::Client] 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 @toph = WeebSh::Toph.new(auth, user_agent, api_url: api_url, client: self) @korra = WeebSh::Korra.new(auth, user_agent, api_url: api_url, client: self) @shimakaze = WeebSh::Shimakaze.new(auth, user_agent, api_url: api_url, client: self) @tama = WeebSh::Tama.new(auth, user_agent, api_url: api_url, client: self) end |
Instance Attribute Details
#api_url ⇒ String
Returns the URL being used for weeb.sh.
15 16 17 |
# File 'lib/weeb/interfaces/client.rb', line 15 def api_url @api_url end |
#auth ⇒ String
Returns the authorization used in weeb.sh.
9 10 11 |
# File 'lib/weeb/interfaces/client.rb', line 9 def auth @auth end |
#korra ⇒ String (readonly) Also known as: image_gen, auto_image
Returns the korra class tied with the client.
23 24 25 |
# File 'lib/weeb/interfaces/client.rb', line 23 def korra @korra end |
#shimakaze ⇒ String (readonly) Also known as: reputation, rep
Returns the shimakaze class tied with the client.
28 29 30 |
# File 'lib/weeb/interfaces/client.rb', line 28 def shimakaze @shimakaze end |
#tama ⇒ String (readonly) Also known as: settings
Returns the tama class tied with the client.
33 34 35 |
# File 'lib/weeb/interfaces/client.rb', line 33 def tama @tama end |
#toph ⇒ Topc (readonly) Also known as: image, images
Returns the toph class tied with the client.
18 19 20 |
# File 'lib/weeb/interfaces/client.rb', line 18 def toph @toph end |
#user_agent ⇒ String
Returns the user agent used in weeb.sh.
12 13 14 |
# File 'lib/weeb/interfaces/client.rb', line 12 def user_agent @user_agent end |
Instance Method Details
#inspect ⇒ Object
78 79 80 |
# File 'lib/weeb/interfaces/client.rb', line 78 def inspect "#<WeebSh::Client @api_url=#{@api_url.inspect} @user_agent=#{@user_agent.inspect}>" end |