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.
31 32 33 34 35 |
# File 'lib/maimai_net/client.rb', line 31 def initialize(username = nil, password = nil) @username = username @password = password = HTTP::CookieJar.new end |
Instance Attribute Details
#cookies ⇒ Object (readonly)
Returns the value of attribute cookies.
37 38 39 |
# File 'lib/maimai_net/client.rb', line 37 def end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
37 38 39 |
# File 'lib/maimai_net/client.rb', line 37 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
37 38 39 |
# File 'lib/maimai_net/client.rb', line 37 def username @username end |
Class Method Details
.inherited(cls) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/maimai_net/client.rb', line 42 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
57 58 59 60 |
# File 'lib/maimai_net/client.rb', line 57 def region_info fail NotImplementedError, "this client is not associated with region information" if (@_properties.to_h rescue {}).empty? @_properties.dup end |
.regions ⇒ Object
52 53 54 55 |
# File 'lib/maimai_net/client.rb', line 52 def regions fail NoMethodError, "invalid call" unless self == method(__method__).owner @_subclasses.dup end |