Class: Tinderbot::Model::User
- Inherits:
-
Object
- Object
- Tinderbot::Model::User
- Defined in:
- lib/tinderbot/model/user.rb
Instance Attribute Summary collapse
-
#bio ⇒ Object
Returns the value of attribute bio.
-
#birth_date ⇒ Object
Returns the value of attribute birth_date.
-
#gender ⇒ Object
Returns the value of attribute gender.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#original_tinder_json ⇒ Object
Returns the value of attribute original_tinder_json.
-
#photo_urls ⇒ Object
Returns the value of attribute photo_urls.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#bio ⇒ Object
Returns the value of attribute bio.
4 5 6 |
# File 'lib/tinderbot/model/user.rb', line 4 def bio @bio end |
#birth_date ⇒ Object
Returns the value of attribute birth_date.
4 5 6 |
# File 'lib/tinderbot/model/user.rb', line 4 def birth_date @birth_date end |
#gender ⇒ Object
Returns the value of attribute gender.
4 5 6 |
# File 'lib/tinderbot/model/user.rb', line 4 def gender @gender end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/tinderbot/model/user.rb', line 4 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/tinderbot/model/user.rb', line 4 def name @name end |
#original_tinder_json ⇒ Object
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_urls ⇒ Object
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_properties ⇒ Object
18 19 20 |
# File 'lib/tinderbot/model/user.rb', line 18 def to_yaml_properties instance_variables - [:@original_tinder_json] end |