Class: MaimaiNet::Client::Base
- Inherits:
-
Object
- Object
- MaimaiNet::Client::Base
- Extended by:
- ConnectionProvider
- Includes:
- ModuleExt
- Defined in:
- lib/maimai_net/client.rb,
lib/maimai_net/client.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cookies ⇒ Object
readonly
Returns the value of attribute cookies.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(username = nil, password = nil) ⇒ Base
constructor
A new instance of Base.
Methods included from ConnectionProvider
default_connection, default_connection=, new, register_connection
Constructor Details
#initialize(username = nil, password = nil) ⇒ Base
Returns a new instance of Base.
37 38 39 40 41 |
# File 'lib/maimai_net/client.rb', line 37 def initialize(username = nil, password = nil) @username = username @password = password @cookies = HTTP::CookieJar.new end |
Instance Attribute Details
#cookies ⇒ Object (readonly)
Returns the value of attribute cookies.
43 44 45 |
# File 'lib/maimai_net/client.rb', line 43 def @cookies end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
43 44 45 |
# File 'lib/maimai_net/client.rb', line 43 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
43 44 45 |
# File 'lib/maimai_net/client.rb', line 43 def username @username end |
Class Method Details
.inherited(cls) ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/maimai_net/client.rb', line 48 def inherited(cls) super return unless self.singleton_class == method(__method__).owner @_subclasses ||= [] @_subclasses << cls unless @_subclasses.include?(cls) cls.singleton_class.undef_method :regions end |
.region_info ⇒ Object
63 64 65 66 |
# File 'lib/maimai_net/client.rb', line 63 def region_info fail NotImplementedError, "this client is not associated with region information" if (@_properties.to_h rescue {}).empty? @_properties.dup end |
.regions ⇒ Object
58 59 60 61 |
# File 'lib/maimai_net/client.rb', line 58 def regions fail NoMethodError, "invalid call" unless self == method(__method__).owner @_subclasses.dup end |