Module: LinkedIn::Api::UpdateMethods
- Included in:
- Client
- Defined in:
- lib/linked_in/api/update_methods.rb
Instance Method Summary collapse
- #add_company_share(company_id, share) ⇒ Object
- #add_group_share(group_id, share) ⇒ Object
- #add_job_bookmark(bookmark) ⇒ Object
- #add_share(share) ⇒ Object
- #follow_company(company_id) ⇒ Object
- #join_group(group_id) ⇒ Object
- #like_share(network_key) ⇒ Object
- #post_group_discussion(group_id, discussion) ⇒ Object
- #send_message(subject, body, recipient_paths) ⇒ Object
- #unfollow_company(company_id) ⇒ Object
- #unlike_share(network_key) ⇒ Object
- #update_comment(network_key, comment) ⇒ Object
Instance Method Details
#add_company_share(company_id, share) ⇒ Object
12 13 14 15 16 |
# File 'lib/linked_in/api/update_methods.rb', line 12 def add_company_share(company_id, share) path = "/companies/#{company_id}/shares" defaults = {:visibility => {:code => "anyone"}} post(path, defaults.merge(share).to_json, "Content-Type" => "application/json") end |
#add_group_share(group_id, share) ⇒ Object
23 24 25 26 |
# File 'lib/linked_in/api/update_methods.rb', line 23 def add_group_share(group_id, share) path = "/groups/#{group_id}/posts" post(path, share.to_json, "Content-Type" => "application/json") end |
#add_job_bookmark(bookmark) ⇒ Object
45 46 47 48 49 |
# File 'lib/linked_in/api/update_methods.rb', line 45 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 |
#follow_company(company_id) ⇒ Object
28 29 30 31 32 |
# File 'lib/linked_in/api/update_methods.rb', line 28 def follow_company(company_id) path = "/people/~/following/companies" body = {:id => company_id } post(path, body.to_json, "Content-Type" => "application/json") end |
#join_group(group_id) ⇒ Object
39 40 41 42 43 |
# File 'lib/linked_in/api/update_methods.rb', line 39 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
57 58 59 60 |
# File 'lib/linked_in/api/update_methods.rb', line 57 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
18 19 20 21 |
# File 'lib/linked_in/api/update_methods.rb', line 18 def post_group_discussion(group_id, discussion) warn 'Use add_group_share over post_group_discussion. This will be taken out in future versions' add_group_share(group_id, discussion) end |
#send_message(subject, body, recipient_paths) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/linked_in/api/update_methods.rb', line 67 def (subject, body, recipient_paths) path = "/people/~/mailbox" = { 'subject' => subject, 'body' => body, 'recipients' => { 'values' => recipient_paths.map do |profile_path| { 'person' => { '_path' => "/people/#{profile_path}" } } end } } post(path, .to_json, "Content-Type" => "application/json") end |
#unfollow_company(company_id) ⇒ Object
34 35 36 37 |
# File 'lib/linked_in/api/update_methods.rb', line 34 def unfollow_company(company_id) path = "/people/~/following/companies/id=#{company_id}" delete(path) end |
#unlike_share(network_key) ⇒ Object
62 63 64 65 |
# File 'lib/linked_in/api/update_methods.rb', line 62 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
51 52 53 54 55 |
# File 'lib/linked_in/api/update_methods.rb', line 51 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 |