class Tinderbot::Model::User

Attributes

bio[RW]
birth_date[RW]
gender[RW]
id[RW]
name[RW]
original_tinder_json[RW]
photo_urls[RW]

Public Class Methods

build_from_tinder_json(tinder_json) click to toggle source
# 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

Public Instance Methods

==(other) click to toggle source
# File lib/tinderbot/model/user.rb, line 22
def ==(other)
  other.class == self.class && other.state == self.state
end
to_yaml_properties() click to toggle source
# File lib/tinderbot/model/user.rb, line 18
def to_yaml_properties
  instance_variables - [:@original_tinder_json]
end

Protected Instance Methods

state() click to toggle source
# File lib/tinderbot/model/user.rb, line 28
def state
  self.instance_variables.reject { |item| item == :@original_tinder_json }.map { |variable| self.instance_variable_get variable }
end