Class: Atlas::User

Inherits:
Resource show all
Defined in:
lib/atlas/user.rb

Overview

Representation and handling of User objects.

Instance Attribute Summary collapse

Attributes inherited from Resource

#tag, #url_builder

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

date_accessor, date_writer, #inspect, #to_hash, #update_with_response

Constructor Details

#initialize(tag, hash = {}) ⇒ User

Returns a new instance of User.



13
14
15
16
17
# File 'lib/atlas/user.rb', line 13

def initialize(tag, hash = {})
  hash['profile'] = hash['profile_markdown']

  super(tag, hash)
end

Instance Attribute Details

#avatar_urlObject

Returns the value of attribute avatar_url.



4
5
6
# File 'lib/atlas/user.rb', line 4

def avatar_url
  @avatar_url
end

#profileObject

Returns the value of attribute profile.



4
5
6
# File 'lib/atlas/user.rb', line 4

def profile
  @profile
end

#usernameObject

Returns the value of attribute username.



4
5
6
# File 'lib/atlas/user.rb', line 4

def username
  @username
end

Class Method Details

.find(tag) ⇒ Object



6
7
8
9
10
11
# File 'lib/atlas/user.rb', line 6

def self.find(tag)
  url_builder = UrlBuilder.new(tag)
  response = Atlas.client.get(url_builder.user_url)

  new(tag, response)
end

Instance Method Details

#boxesObject



19
20
21
# File 'lib/atlas/user.rb', line 19

def boxes
  @boxes ||= []
end

#boxes=(hash) ⇒ Object



23
24
25
# File 'lib/atlas/user.rb', line 23

def boxes=(hash)
  @boxes = hash.collect { |v| Box.new("#{username}/#{v['name']}", v) }
end