Class: LinkedIn::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/linkedin/base.rb

Direct Known Subclasses

Company, Profile

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Base

Returns a new instance of Base.



5
6
7
# File 'lib/linkedin/base.rb', line 5

def initialize(attributes={})
  @attributes = Hashie::Mash.new attributes
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



9
10
11
12
# File 'lib/linkedin/base.rb', line 9

def method_missing(method, *args, &block)
  return @attributes.send(method, *args, &block) if @attributes.respond_to?(method)
  super
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



3
4
5
# File 'lib/linkedin/base.rb', line 3

def attributes
  @attributes
end

Class Method Details

.clientObject



23
24
25
# File 'lib/linkedin/base.rb', line 23

def self.client
  @@client ||= self.reset_client
end

.reset_clientObject



27
28
29
# File 'lib/linkedin/base.rb', line 27

def self.reset_client
  @@client = LinkedIn.new
end

Instance Method Details

#clientObject



19
20
21
# File 'lib/linkedin/base.rb', line 19

def client
  Base.client
end

#respond_to?(method, include_all = false) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/linkedin/base.rb', line 14

def respond_to?(method, include_all=false)
  return true if @attributes.respond_to method, include_all
  super
end