Module: LinkedIn::Api::UpdateMethods

Included in:
Client
Defined in:
lib/linked_in/api/update_methods.rb

Instance Method Summary collapse

Instance Method Details

#add_job_bookmark(bookmark) ⇒ Object



18
19
20
21
22
# File 'lib/linked_in/api/update_methods.rb', line 18

def add_job_bookmark(bookmark)
  path = "/people/~/job-bookmarks"
  body = {'job' => {'id' => bookmark}}
  post(path, body.to_json, "Content-Type" => "application/json")
end

#add_share(share) ⇒ Object



6
7
8
9
10
# File 'lib/linked_in/api/update_methods.rb', line 6

def add_share(share)
  path = "/people/~/shares"
  defaults = {:visibility => {:code => "anyone"}}
  post(path, defaults.merge(share).to_json, "Content-Type" => "application/json")
end

#join_group(group_id) ⇒ Object



12
13
14
15
16
# File 'lib/linked_in/api/update_methods.rb', line 12

def join_group(group_id)
  path = "/people/~/group-memberships/#{group_id}"
  body = {'membership-state' => {'code' => 'member' }}
  put(path, body.to_json, "Content-Type" => "application/json")
end

#like_share(network_key) ⇒ Object

def update_network(message)

path = "/people/~/person-activities"
post(path, network_update_to_xml(message))

end



42
43
44
45
# File 'lib/linked_in/api/update_methods.rb', line 42

def like_share(network_key)
  path = "/people/~/network/updates/key=#{network_key}/is-liked"
  put(path, 'true', "Content-Type" => "application/json")
end

#send_message(subject, body, recipient_paths) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/linked_in/api/update_methods.rb', line 52

def send_message(subject, body, recipient_paths)
  path = "/people/~/mailbox"

  message = {
      'subject' => subject, 
      'body' => body,
      'recipients' => {
          'values' => recipient_paths.map do |profile_path| 
            { 'person' => { '_path' => "/people/#{profile_path}" } } 
          end
      }
  }
  post(path, message.to_json, "Content-Type" => "application/json")
end

#unlike_share(network_key) ⇒ Object



47
48
49
50
# File 'lib/linked_in/api/update_methods.rb', line 47

def unlike_share(network_key)
  path = "/people/~/network/updates/key=#{network_key}/is-liked"
  put(path, 'false', "Content-Type" => "application/json")
end

#update_comment(network_key, comment) ⇒ Object

def share(options={})

path = "/people/~/shares"
defaults = { :visability => 'anyone' }
post(path, share_to_xml(defaults.merge(options)))

end



30
31
32
33
34
# File 'lib/linked_in/api/update_methods.rb', line 30

def update_comment(network_key, comment)
  path = "/people/~/network/updates/key=#{network_key}/update-comments"
  body = {'comment' => comment}
  post(path, body.to_json, "Content-Type" => "application/json")
end