Class: Pipl::Source
- Inherits:
-
FieldsContainer
- Object
- FieldsContainer
- Pipl::Source
- Defined in:
- lib/pipl/containers.rb
Constant Summary
Constants inherited from FieldsContainer
FieldsContainer::CLASS_CONTAINER
Instance Attribute Summary collapse
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#match ⇒ Object
readonly
Returns the value of attribute match.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#origin_url ⇒ Object
readonly
Returns the value of attribute origin_url.
-
#person_id ⇒ Object
readonly
Returns the value of attribute person_id.
-
#premium ⇒ Object
readonly
Returns the value of attribute premium.
-
#source_id ⇒ Object
readonly
Returns the value of attribute source_id.
-
#sponsored ⇒ Object
readonly
Returns the value of attribute sponsored.
-
#valid_since ⇒ Object
readonly
Returns the value of attribute valid_since.
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
-
#initialize(params = {}) ⇒ Source
constructor
A new instance of Source.
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
Constructor Details
#initialize(params = {}) ⇒ Source
Returns a new instance of Source.
214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/pipl/containers.rb', line 214 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
#category ⇒ Object (readonly)
Returns the value of attribute category.
212 213 214 |
# File 'lib/pipl/containers.rb', line 212 def category @category end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
212 213 214 |
# File 'lib/pipl/containers.rb', line 212 def domain @domain end |
#match ⇒ Object (readonly)
Returns the value of attribute match.
212 213 214 |
# File 'lib/pipl/containers.rb', line 212 def match @match end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
212 213 214 |
# File 'lib/pipl/containers.rb', line 212 def name @name end |
#origin_url ⇒ Object (readonly)
Returns the value of attribute origin_url.
212 213 214 |
# File 'lib/pipl/containers.rb', line 212 def origin_url @origin_url end |
#person_id ⇒ Object (readonly)
Returns the value of attribute person_id.
212 213 214 |
# File 'lib/pipl/containers.rb', line 212 def person_id @person_id end |
#premium ⇒ Object (readonly)
Returns the value of attribute premium.
212 213 214 |
# File 'lib/pipl/containers.rb', line 212 def premium @premium end |
#source_id ⇒ Object (readonly)
Returns the value of attribute source_id.
212 213 214 |
# File 'lib/pipl/containers.rb', line 212 def source_id @source_id end |
#sponsored ⇒ Object (readonly)
Returns the value of attribute sponsored.
212 213 214 |
# File 'lib/pipl/containers.rb', line 212 def sponsored @sponsored end |
#valid_since ⇒ Object (readonly)
Returns the value of attribute valid_since.
212 213 214 |
# File 'lib/pipl/containers.rb', line 212 def valid_since @valid_since end |
Class Method Details
.from_hash(h) ⇒ Object
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/pipl/containers.rb', line 228 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 |