Class: Pipl::Source

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

Constant Summary

Constants inherited from FieldsContainer

FieldsContainer::CLASS_CONTAINER

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, #origin_country, #phone, #relationship, #url, #user_id, #username, #vehicle

Constructor Details

#initialize(params = {}) ⇒ Source

Returns a new instance of Source.



220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/pipl/containers.rb', line 220

def initialize(params={})
  super params
  @name = params[:name]
  @category = params[:category]
  @origin_url = params[:origin_url]
  @domain = params[:domain]
  @source_id = params[:source_id]
  @person_id = params[:person_id]
  @sponsored = params[:sponsored]
  @premium = params[:premium]
  @match = params[:match]
  @valid_since = params[:valid_since]
end

Instance Attribute Details

#categoryObject (readonly)

Returns the value of attribute category.



218
219
220
# File 'lib/pipl/containers.rb', line 218

def category
  @category
end

#domainObject (readonly)

Returns the value of attribute domain.



218
219
220
# File 'lib/pipl/containers.rb', line 218

def domain
  @domain
end

#matchObject (readonly)

Returns the value of attribute match.



218
219
220
# File 'lib/pipl/containers.rb', line 218

def match
  @match
end

#nameObject (readonly)

Returns the value of attribute name.



218
219
220
# File 'lib/pipl/containers.rb', line 218

def name
  @name
end

#origin_urlObject (readonly)

Returns the value of attribute origin_url.



218
219
220
# File 'lib/pipl/containers.rb', line 218

def origin_url
  @origin_url
end

#person_idObject (readonly)

Returns the value of attribute person_id.



218
219
220
# File 'lib/pipl/containers.rb', line 218

def person_id
  @person_id
end

#premiumObject (readonly)

Returns the value of attribute premium.



218
219
220
# File 'lib/pipl/containers.rb', line 218

def premium
  @premium
end

#source_idObject (readonly)

Returns the value of attribute source_id.



218
219
220
# File 'lib/pipl/containers.rb', line 218

def source_id
  @source_id
end

Returns the value of attribute sponsored.



218
219
220
# File 'lib/pipl/containers.rb', line 218

def sponsored
  @sponsored
end

#valid_sinceObject (readonly)

Returns the value of attribute valid_since.



218
219
220
# File 'lib/pipl/containers.rb', line 218

def valid_since
  @valid_since
end

Class Method Details

.from_hash(h) ⇒ Object



234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/pipl/containers.rb', line 234

def self.from_hash(h)
  params = {
      name: h[:@name],
      category: h[:@category],
      origin_url: h[:@origin_url],
      domain: h[:@domain],
      source_id: h[:@id],
      person_id: h[:@person_id],
      match: h[:@match],
      sponsored: h[:@sponsored],
      premium: h[:@premium],
  }
  params[:valid_since] = Pipl::Utils.str_to_date(h[:@valid_since]) if h.key? :@valid_since
  params[:fields] = self.fields_from_hash(h)
  self.new(params)
end