Class: Tinderbot::Model::User

Inherits:
Object
  • Object
show all
Defined in:
lib/tinderbot/model/user.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bioObject

Returns the value of attribute bio.



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

def bio
  @bio
end

#birth_dateObject

Returns the value of attribute birth_date.



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

def birth_date
  @birth_date
end

#genderObject

Returns the value of attribute gender.



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

def gender
  @gender
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#original_tinder_jsonObject

Returns the value of attribute original_tinder_json.



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

def original_tinder_json
  @original_tinder_json
end

#photo_urlsObject

Returns the value of attribute photo_urls.



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

def photo_urls
  @photo_urls
end

Class Method Details

.build_from_tinder_json(tinder_json) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/tinderbot/model/user.rb', line 6

def self.build_from_tinder_json(tinder_json)
  user = self.new
  user.original_tinder_json = tinder_json
  user.id = tinder_json['_id']
  user.name = tinder_json['name']
  user.bio = tinder_json['bio']
  user.birth_date = Date.parse tinder_json['birth_date']
  user.gender = tinder_json['gender'] == 0 ? :male : :female
  user.photo_urls = tinder_json['photos'].map { |t| t['url'] }
  user
end

Instance Method Details

#==(other) ⇒ Object



22
23
24
# File 'lib/tinderbot/model/user.rb', line 22

def ==(other)
  other.class == self.class && other.state == self.state
end

#to_yaml_propertiesObject



18
19
20
# File 'lib/tinderbot/model/user.rb', line 18

def to_yaml_properties
  instance_variables - [:@original_tinder_json]
end