Class: Socialshare::Linkdin

Inherits:
Object
  • Object
show all
Defined in:
lib/socialshare/linkdin.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Linkdin

Returns a new instance of Linkdin.



7
8
9
10
11
12
13
# File 'lib/socialshare/linkdin.rb', line 7

def initialize(options = {})
  @api_key = options[:api_key]
  @secret_key = options[:secret_key]
  @user_token = options[:user_token]
  @user_secret = options[:user_secret]
  @linkdin_user = get_linkedin_user(options) 
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



5
6
7
# File 'lib/socialshare/linkdin.rb', line 5

def api_key
  @api_key
end

#linkdin_userObject

Returns the value of attribute linkdin_user.



5
6
7
# File 'lib/socialshare/linkdin.rb', line 5

def linkdin_user
  @linkdin_user
end

#secret_keyObject

Returns the value of attribute secret_key.



5
6
7
# File 'lib/socialshare/linkdin.rb', line 5

def secret_key
  @secret_key
end

#user_secretObject

Returns the value of attribute user_secret.



5
6
7
# File 'lib/socialshare/linkdin.rb', line 5

def user_secret
  @user_secret
end

#user_tokenObject

Returns the value of attribute user_token.



5
6
7
# File 'lib/socialshare/linkdin.rb', line 5

def user_token
  @user_token
end

Instance Method Details

#get_linkedin_profile(options = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/socialshare/linkdin.rb', line 23

def get_linkedin_profile(options = {})
  begin
    if options[:id]
      self.linkdin_user.profile(:id => options[:id])
    else
      self.linkdin_user.profile 
    end
  rescue Exception => e
    return e
  end
end

#post(text) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/socialshare/linkdin.rb', line 15

def post(text)
  begin 
    self.linkdin_user.add_share(:comment => text) 
  rescue Exception => e
    return e
  end
end