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



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

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

#post_group_discussion(group_id, discussion) ⇒ Object



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

def post_group_discussion(group_id, discussion)
  path = "/groups/#{group_id}/posts"

  discussion_post = {
    'title' => discussion['title'],
    'summary' => discussion['summary']
  }

  post(path, discussion_post.to_json, "Content-Type" => "application/json")
end

#send_message(subject, body, recipient_paths) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/linked_in/api/update_methods.rb', line 40

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



35
36
37
38
# File 'lib/linked_in/api/update_methods.rb', line 35

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



24
25
26
27
28
# File 'lib/linked_in/api/update_methods.rb', line 24

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