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, #vehicles

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, #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

#inferredObject

See Also:



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

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.



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

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.



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

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

#valid_sinceObject

See Also:



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_hashObject



205
206
207
# File 'lib/pipl/containers.rb', line 205

def to_hash
  fields_to_hash
end

#to_sObject



209
210
211
# File 'lib/pipl/containers.rb', line 209

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