Class: LinkedIn::Base

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/linked_in/base.rb

Constant Summary collapse

API_VERSION =
'v1'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Base

Returns a new instance of Base.



10
11
12
# File 'lib/linked_in/base.rb', line 10

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



8
9
10
# File 'lib/linked_in/base.rb', line 8

def client
  @client
end

Instance Method Details

#connections(lookup = nil, fields = nil, query = {}) ⇒ Object

Query options: start=N, count=N



28
29
30
31
# File 'lib/linked_in/base.rb', line 28

def connections(lookup = nil, fields = nil, query = {})
  path = profile_path('connections', lookup, fields)
  perform_get(path, :query => query)
end

#current_status(update) ⇒ Object



38
39
40
41
42
# File 'lib/linked_in/base.rb', line 38

def current_status(update)
  path = profile_path('current-status')
  update_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><current-status>#{update}</current-status>"
  perform_put(path, :body => update_xml)
end

#network(query = {}) ⇒ Object



33
34
35
36
# File 'lib/linked_in/base.rb', line 33

def network(query = {})
  path = profile_path('network')
  perform_get(path, :query => query)
end

#people(query = {}) ⇒ Object

Query options: start=N, count=N



22
23
24
25
# File 'lib/linked_in/base.rb', line 22

def people(query = {})
  path = api_path('people')
  perform_get(path, query)
end

#person_activities(update, timestamp = nil) ⇒ Object

update is something like: ‘&lt;a href=&quot;www.linkedin.com/profile?viewProfile=&amp;key=ABCDEFG&quot;&gt;Richard Brautigan&lt;/a&gt; is reading about&lt;a href=&quot;www.tigers.com&quot;&gt;Tigers&lt;/a&gt;http://www.tigers.com&gt;Tigers&lt;/a&gt;.’}



45
46
47
48
49
50
51
52
53
# File 'lib/linked_in/base.rb', line 45

def person_activities(update, timestamp = nil)
  path = profile_path('person-activities')
  body = {'activity' => {
    'timestamp' => (timestamp || Time.now.to_i),
    'content-type' => 'linkedin-html', 
    'body' => update}
  }
  perform_post(path, body)
end

#profile(lookup = nil, fields = nil, query = {}) ⇒ Object

Lookup Options: url=<public profile URL>, id=<member id> Field Options: :full



16
17
18
19
# File 'lib/linked_in/base.rb', line 16

def profile(lookup = nil, fields = nil, query = {})
  path = profile_path(nil, lookup, fields)
  perform_get(path, :query => query)
end