Class: MixCloud::User
- Inherits:
-
Hashie::Dash
- Object
- Hashie::Dash
- MixCloud::User
- Includes:
- HTTParty
- Defined in:
- lib/mixcloud/user.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
writeonly
Sets the attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(user_name, options = {}) ⇒ User
constructor
A new instance of User.
Constructor Details
#initialize(user_name, options = {}) ⇒ User
Returns a new instance of User.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/mixcloud/user.rb', line 32 def initialize(user_name, ={}) @options = @user = self.class.get("/#{user_name}?metadata=1", :query => @options) @user['metadata']['connections'].each do |k,v| @user['metadata'][k.to_sym] = v end @user['metadata'].delete('connections') @user['metadata'].each do |k,v| self.class.send(:define_method, "#{k}".downcase) do || = ||= @options self.class.get("#{self.[k.to_sym]}", :query => @options) end end super @user end |
Instance Attribute Details
#options=(value) ⇒ Object (writeonly)
Sets the attribute options
8 9 10 |
# File 'lib/mixcloud/user.rb', line 8 def (value) @options = value end |
Class Method Details
.find(user_name, options = {}) ⇒ Object
51 52 53 |
# File 'lib/mixcloud/user.rb', line 51 def self.find(user_name, ={}) self.new user_name, end |