Class: Pipl::Relationship
- Inherits:
-
FieldsContainer
- Object
- FieldsContainer
- Pipl::Relationship
- Defined in:
- lib/pipl/containers.rb
Constant Summary collapse
- CLASS_CONTAINER =
FieldsContainer::CLASS_CONTAINER.clone
Instance Attribute Summary collapse
- #inferred ⇒ Object
-
#subtype ⇒ String
Subtype of association of this relationship to a person.
-
#type ⇒ String
Possible values are: friend family work other.
- #valid_since ⇒ Object
Attributes inherited from FieldsContainer
#addresses, #dob, #educations, #emails, #ethnicities, #gender, #images, #jobs, #languages, #names, #origin_countries, #phones, #relationships, #tags, #urls, #user_ids, #usernames, #vehicles
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Relationship
constructor
A new instance of Relationship.
- #to_hash ⇒ Object
- #to_s ⇒ Object
Methods inherited from FieldsContainer
#add_field, #add_fields, #address, #all_fields, #education, #email, #ethnicity, fields_from_hash, #fields_to_hash, #image, #job, #language, #name, #origin_country, #phone, #relationship, #url, #user_id, #username, #vehicle
Constructor Details
#initialize(params = {}) ⇒ Relationship
Returns a new instance of Relationship.
190 191 192 193 194 195 196 |
# File 'lib/pipl/containers.rb', line 190 def initialize(params={}) super params @valid_since = params[:valid_since] @inferred = params[:inferred] @type = params[:type] @subtype = params[:subtype] end |
Instance Attribute Details
#inferred ⇒ Object
188 |
# File 'lib/pipl/containers.rb', line 188 attr_accessor :valid_since, :inferred, :type, :subtype |
#subtype ⇒ String
Returns Subtype of association of this relationship to a person. Free text.
188 |
# File 'lib/pipl/containers.rb', line 188 attr_accessor :valid_since, :inferred, :type, :subtype |
#type ⇒ String
Possible values are:
friend
family
work
other
188 |
# File 'lib/pipl/containers.rb', line 188 attr_accessor :valid_since, :inferred, :type, :subtype |
#valid_since ⇒ Object
188 189 190 |
# File 'lib/pipl/containers.rb', line 188 def valid_since @valid_since end |
Class Method Details
.from_hash(h) ⇒ Object
198 199 200 201 202 203 |
# File 'lib/pipl/containers.rb', line 198 def self.from_hash(h) params = Pipl::Field.base_params_from_hash h params[:subtype] = h[:@subtype] params[:fields] = self.fields_from_hash(h) self.new(params) end |
Instance Method Details
#to_hash ⇒ Object
205 206 207 |
# File 'lib/pipl/containers.rb', line 205 def to_hash fields_to_hash end |
#to_s ⇒ Object
209 210 211 |
# File 'lib/pipl/containers.rb', line 209 def to_s @names.first.to_s unless @names.empty? end |