Class: SpeakerdeckApi::Speaker

Inherits:
Object
  • Object
show all
Defined in:
lib/speakerdeck_api/speaker.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Speaker

Returns a new instance of Speaker.



7
8
9
10
11
# File 'lib/speakerdeck_api/speaker.rb', line 7

def initialize(params = {})
  @number_of_talks = params[:number_of_talks] || 0
  @name = params[:name] || ''
  @website = params[:website] || ''
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/speakerdeck_api/speaker.rb', line 5

def name
  @name
end

#number_of_talksObject (readonly)

Returns the value of attribute number_of_talks.



5
6
7
# File 'lib/speakerdeck_api/speaker.rb', line 5

def number_of_talks
  @number_of_talks
end

#websiteObject (readonly)

Returns the value of attribute website.



5
6
7
# File 'lib/speakerdeck_api/speaker.rb', line 5

def website
  @website
end

Class Method Details

.get(speaker_name) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/speakerdeck_api/speaker.rb', line 13

def self.get(speaker_name)
  begin
    speaker_data = SpeakerdeckApi::Connection.new.get_speaker_data speaker_name
    speaker_details = SpeakerdeckApi::Parser.new.get_speaker_details speaker_data
    SpeakerdeckApi::Speaker.new speaker_details
  rescue
    raise SpeakerdeckApi::Exceptions::SpeakerNotFoundException
  end
end