Class: Geni::Profile

Inherits:
Base
  • Object
show all
Defined in:
lib/geni/profile.rb,
lib/geni/profile/immediate_family.rb

Defined Under Namespace

Classes: ImmediateFamily

Instance Attribute Summary

Attributes inherited from Base

#client, #id

Instance Method Summary collapse

Methods inherited from Base

#fetch, #fetched?, has_fetchable_attributes, #initialize

Constructor Details

This class inherits a constructor from Geni::Base

Instance Method Details

#childrenObject



33
34
35
# File 'lib/geni/profile.rb', line 33

def children
  immediate_family.children
end

#curatorObject



63
64
65
# File 'lib/geni/profile.rb', line 63

def curator
  @curator_profile ||= @curator.nil? ? nil : client.get_profile(@curator.split('/').last)
end

#documentsObject



87
88
89
90
91
92
93
94
95
# File 'lib/geni/profile.rb', line 87

def documents
  @documents ||= client.access_token.get("/api/#{id}/documents")['results'].collect do |documents_attrs|
    Geni::Photo.new({
      :client  => client,
      :attrs   => documents_attrs,
      :fetched => true
    })
  end
end

#fatherObject



25
26
27
# File 'lib/geni/profile.rb', line 25

def father
  @father ||= parents.select { |profile| profile.gender == 'male' }.first
end

#immediate_familyObject



14
15
16
17
18
19
# File 'lib/geni/profile.rb', line 14

def immediate_family
  @immediate_family ||= Geni::Profile::ImmediateFamily.new({
    :client => client,
    :attrs  => client.access_token.get("/api/#{id}/immediate-family")
  })
end

#managersObject



45
46
47
48
49
# File 'lib/geni/profile.rb', line 45

def managers
  @manager_profiles ||= @managers.collect do |profile_link|
    client.get_profile(profile_link.split('-').last)
  end
end

#merged_intoObject



51
52
53
54
55
# File 'lib/geni/profile.rb', line 51

def merged_into
  @merged_into_profiles ||= @merged_into.to_a.collect do |profile_link|
    client.get_profile(profile_link.split('-').last)
  end
end

#motherObject



29
30
31
# File 'lib/geni/profile.rb', line 29

def mother
  @mother ||= parents.select { |profile| profile.gender == 'female' }.first
end

#parentsObject



21
22
23
# File 'lib/geni/profile.rb', line 21

def parents
  immediate_family.parents
end

#partnersObject



41
42
43
# File 'lib/geni/profile.rb', line 41

def partners
  immediate_family.partners
end

#photosObject



67
68
69
70
71
72
73
74
75
# File 'lib/geni/profile.rb', line 67

def photos
  @photos ||= client.access_token.get("/api/#{id}/photos")['results'].to_a.collect do |photo_attrs|
    Geni::Photo.new({
      :client  => client,
      :attrs   => photo_attrs,
      :fetched => true
    })
  end
end

#requested_mergesObject



57
58
59
60
61
# File 'lib/geni/profile.rb', line 57

def requested_merges
  @requested_merges_profiles ||= @requested_merges.to_a.collect do |profile_link|
    client.get_profile(profile_link.split('-').last)
  end
end

#siblingsObject



37
38
39
# File 'lib/geni/profile.rb', line 37

def siblings
  immediate_family.siblings
end

#videosObject



77
78
79
80
81
82
83
84
85
# File 'lib/geni/profile.rb', line 77

def videos
  @videos ||= client.access_token.get("/api/#{id}/videos")['results'].to_a.collect do |video_attrs|
    Geni::Photo.new({
      :client  => client,
      :attrs   => video_attrs,
      :fetched => true
    })
  end
end