Sha256: b409d60d5cab1079042bfcec9e581a8c68ea24ddc0c51c2862e485dbd0a9f2e6

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

module EzLinkedin
	module Api

		module UpdateMethods
			#
			# post a share to Linkedin
			# @param  share [Hash] a hash containing at least the required
			#   attributes for a share.
			#   post_share({:comment => "I'm a comment",
			#               :content => { :title => "A title!",
			#                             :description => "A description",
			#                             :submitted_url => "http...",
			#                             :submitted_image_url => "http..."
			#                             },
			#               :visibility => { :code => "anyone"}
			#               })
			#
			# @return [HTTP::Response] response of post call
			def post_share(share)
				path = "/people/~/shares"
				defaults = { visibility: { code: 'anyone' } }
				post(path, defaults.merge(share).to_json, "Content-Type" => "application/json")
			end


			#
			# Join a group
			# @param  id [Fixnum] number representing group id
			#
			# @return [HTTP:Response] response of put call
			def join_group(id)
				path = "/people/~/group-memberships/#{id}"
				body = {'membership-state' => {'code' => 'member'}}
				put(path, body.to_json, "Content-Type" => "application/json")
			end
		end
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ezlinkedin-0.5.3 lib/ezlinkedin/api/update_methods.rb
ezlinkedin-0.5.2 lib/ezlinkedin/api/update_methods.rb
ezlinkedin-0.4.2 lib/ezlinkedin/api/update_methods.rb
ezlinkedin-0.2.2 lib/ezlinkedin/api/update_methods.rb