Class: Pipl::Relationship

Inherits:
FieldsContainer show all
Defined in:
lib/pipl/containers.rb

Constant Summary collapse

CLASS_CONTAINER =
FieldsContainer::CLASS_CONTAINER.clone

Instance Attribute Summary collapse

Attributes inherited from FieldsContainer

#addresses, #dob, #educations, #emails, #ethnicities, #gender, #images, #jobs, #languages, #names, #origin_countries, #phones, #relationships, #tags, #urls, #user_ids, #usernames

Class Method Summary collapse

Instance Method Summary collapse

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

Constructor Details

#initialize(params = {}) ⇒ Relationship

Returns a new instance of Relationship.



184
185
186
187
188
189
190
# File 'lib/pipl/containers.rb', line 184

def initialize(params={})
  super params
  @valid_since = params[:valid_since]
  @inferred = params[:inferred]
  @type = params[:type]
  @subtype = params[:subtype]
end

Instance Attribute Details

#inferredObject

See Also:



182
# File 'lib/pipl/containers.rb', line 182

attr_accessor :valid_since, :inferred, :type, :subtype

#subtypeString

Returns Subtype of association of this relationship to a person. Free text.

Returns:

  • (String)

    Subtype of association of this relationship to a person. Free text.



182
# File 'lib/pipl/containers.rb', line 182

attr_accessor :valid_since, :inferred, :type, :subtype

#typeString

Possible values are:

friend
family
work
other

Returns:

  • (String)

    Type of association of this relationship to a person.



182
# File 'lib/pipl/containers.rb', line 182

attr_accessor :valid_since, :inferred, :type, :subtype

#valid_sinceObject

See Also:



182
183
184
# File 'lib/pipl/containers.rb', line 182

def valid_since
  @valid_since
end

Class Method Details

.from_hash(h) ⇒ Object



192
193
194
195
196
197
# File 'lib/pipl/containers.rb', line 192

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_hashObject



199
200
201
# File 'lib/pipl/containers.rb', line 199

def to_hash
  fields_to_hash
end

#to_sObject



203
204
205
# File 'lib/pipl/containers.rb', line 203

def to_s
  @names.first.to_s unless @names.empty?
end