Class: Thingiverse::Users

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/thingiverse/users.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Users

Returns a new instance of Users.



10
11
12
13
14
# File 'lib/thingiverse/users.rb', line 10

def initialize(attributes={})
  attributes.each do |name, value|
    send("#{name}=", value)
  end
end

Instance Attribute Details

#bioObject

Returns the value of attribute bio.



6
7
8
# File 'lib/thingiverse/users.rb', line 6

def bio
  @bio
end

#copies_urlObject

Returns the value of attribute copies_url.



8
9
10
# File 'lib/thingiverse/users.rb', line 8

def copies_url
  @copies_url
end

#default_licenseObject

Returns the value of attribute default_license.



7
8
9
# File 'lib/thingiverse/users.rb', line 7

def default_license
  @default_license
end

#emailObject

Returns the value of attribute email.



7
8
9
# File 'lib/thingiverse/users.rb', line 7

def email
  @email
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/thingiverse/users.rb', line 6

def id
  @id
end

#last_activeObject

Returns the value of attribute last_active.



6
7
8
# File 'lib/thingiverse/users.rb', line 6

def last_active
  @last_active
end

#likes_urlObject

Returns the value of attribute likes_url.



8
9
10
# File 'lib/thingiverse/users.rb', line 8

def likes_url
  @likes_url
end

#locationObject

Returns the value of attribute location.



6
7
8
# File 'lib/thingiverse/users.rb', line 6

def location
  @location
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/thingiverse/users.rb', line 6

def name
  @name
end

#public_urlObject

Returns the value of attribute public_url.



6
7
8
# File 'lib/thingiverse/users.rb', line 6

def public_url
  @public_url
end

#registeredObject

Returns the value of attribute registered.



6
7
8
# File 'lib/thingiverse/users.rb', line 6

def registered
  @registered
end

#things_urlObject

Returns the value of attribute things_url.



8
9
10
# File 'lib/thingiverse/users.rb', line 8

def things_url
  @things_url
end

#thumbnailObject

Returns the value of attribute thumbnail.



6
7
8
# File 'lib/thingiverse/users.rb', line 6

def thumbnail
  @thumbnail
end

#urlObject

Returns the value of attribute url.



6
7
8
# File 'lib/thingiverse/users.rb', line 6

def url
  @url
end

Class Method Details

.find(user_name) ⇒ Object



35
36
37
38
39
# File 'lib/thingiverse/users.rb', line 35

def self.find(user_name)
  response = Thingiverse::Connection.get("/users/#{user_name}")
  raise "#{response.code}: #{JSON.parse(response.body)['error']}" unless response.success?
  self.new response.parsed_response
end

Instance Method Details

#attributesObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/thingiverse/users.rb', line 16

def attributes
  {
    :id => id,
    :name => name,
    :thumbnail => thumbnail,
    :url => url,
    :public_url => public_url, 
    :bio => bio,
    :location => location,
    :registered => registered,
    :last_active => last_active,
    :things_url => things_url,
    :copies_url => copies_url,
    :likes_url => likes_url,
    :email => email,
    :default_license => default_license
  }
end