speakerdeck_api 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55f50730158b9885ae5dfc446fa858fb9c4aa031
4
- data.tar.gz: 67801b1df47b56b551e288f1c580ac66aa083ab0
3
+ metadata.gz: 64783ecb5e2ae07f2e41ed298ab90ab16acb2513
4
+ data.tar.gz: 5b11580580d544528c1c849690e9a3a7e56a8390
5
5
  SHA512:
6
- metadata.gz: 9df5f38624f207adbbf3788621de904e8ca0881d3b9cea13ac07f3edda5a485ab7cb1c5f1f70ec7fb92195d03c765de7d44ee3cc2fd98a223f82339b83adbc16
7
- data.tar.gz: ebccac828a713621aeb4ac911fb946c7a7ee7cf1d43f1e251abbb505361a4b755aa5353e534cdc8e82c3dfc04ebbd92738d1c8d133aae53f364d7241143b22a8
6
+ metadata.gz: 99eea920280c391e6ba8fcbc19f6c29f2e27a8e63080625a40781376b89bd501269e1c1b224ff3c83bc906fe98ecac1ba6181a759da51c17a79d0c2a98ee9501
7
+ data.tar.gz: 6de5e53771d1267a643da190e9435ce0307f7a939187c1f388b5639b006e7b8ef188cfaf89a7f3048776728fc5803311f8d7b16b284e8170d417246183d09aea
data/.coveralls.yml ADDED
@@ -0,0 +1,2 @@
1
+ service_name: travis-ci
2
+ repo_token: JxZm06yoZNzNAM8823YGo8GnIjkUI7oIe
data/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/FerPerales/speakerdeck_api.png?branch=master)](https://travis-ci.org/FerPerales/speakerdeck_api)
4
4
 
5
+ [![Gem Version](https://badge.fury.io/rb/speakerdeck_api.png)](http://badge.fury.io/rb/speakerdeck_api)
6
+
7
+ [![Coverage Status](https://coveralls.io/repos/FerPerales/speakerdeck_api/badge.png)](https://coveralls.io/r/FerPerales/speakerdeck-api)
8
+
5
9
  A gem for getting data from speakerdeck.com
6
10
 
7
11
  ## Installation
@@ -28,18 +32,22 @@ First require the gem:
28
32
  require 'speakerdeck_api'
29
33
  ```
30
34
 
31
- At the moment, you can get the number of talks by a speaker via the
35
+ At the moment, you can get the number of talks, name and website of a speaker via the
32
36
  SpeakerdeckApi::Speaker class.
33
37
 
34
38
  ```ruby
35
- speaker = SpeakerdeckApi::Speaker.get 'speakerdeck.com user'
39
+ speaker = SpeakerdeckApi::Speaker.get 'speakerdeck.com_username'
36
40
  ```
37
41
 
38
- This return an object with the number_of_talks attribute:
42
+ This return an object with the *number of talks*, *name*, and *website* attributes:
39
43
 
40
44
  ```ruby
41
45
  speaker.number_of_talks
42
46
  => 8
47
+ speaker.name
48
+ => 'Fake Guy'
49
+ speaker.website
50
+ => 'http://fakeg.uy/'
43
51
  ```
44
52
 
45
53
  You will get a SpeakerNotFound exception in case the provided speaker
@@ -47,12 +55,12 @@ name does not correspond to a speackerdeck.com user.
47
55
 
48
56
  ## Upcoming
49
57
 
50
- * Retrive more information about the speaker
51
- * Add SpeakerdeckApi::Talk class to retrieve talk details
58
+ - [x] Retrive more information about the speaker
59
+ - [ ] Add SpeakerdeckApi::Talk class to retrieve talk details
52
60
 
53
61
  ## Contributing
54
62
 
55
- 1. Fork it ( https://github.com/[my-github-username]/speakerdeck_api/fork )
63
+ 1. Fork it ( https://github.com/FerPerales/speakerdeck_api/fork )
56
64
  2. Create your feature branch (`git checkout -b my-new-feature`)
57
65
  3. Commit your changes (`git commit -am 'Add some feature'`)
58
66
  4. Push to the branch (`git push origin my-new-feature`)
@@ -4,6 +4,8 @@ module SpeakerdeckApi
4
4
  def get_speaker_details(speaker_html)
5
5
  info = {}
6
6
  info[:number_of_talks] = speaker_html.css('.talk.public').size
7
+ info[:name] = speaker_html.css('.sidebar > h2').text
8
+ info[:website] = speaker_html.css('.bio > p > a').attribute('href').value
7
9
  info
8
10
  end
9
11
  end
@@ -2,10 +2,12 @@ module SpeakerdeckApi
2
2
 
3
3
  class Speaker
4
4
 
5
- attr_reader :number_of_talks
5
+ attr_reader :number_of_talks, :name, :website
6
6
 
7
7
  def initialize(params = {})
8
8
  @number_of_talks = params[:number_of_talks] || 0
9
+ @name = params[:name] || ''
10
+ @website = params[:website] || ''
9
11
  end
10
12
 
11
13
  def self.get(speaker_name)
@@ -1,3 +1,3 @@
1
1
  module SpeakerdeckApi
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -20,8 +20,9 @@ Gem::Specification.new do |spec|
20
20
  spec.add_development_dependency "bundler", "~> 1.7"
21
21
  spec.add_development_dependency "rake", "~> 10.0"
22
22
  spec.add_development_dependency "rspec"
23
- spec.add_development_dependency "nokogiri"
24
- spec.add_development_dependency "pry"
25
- spec.add_development_dependency "pry-byebug"
23
+ spec.add_development_dependency "nokogiri"
24
+ spec.add_development_dependency "pry"
25
+ spec.add_development_dependency "coveralls"
26
+ spec.add_development_dependency "pry-byebug"
26
27
 
27
28
  end
@@ -20,6 +20,23 @@ module SpeakerdeckApi
20
20
  it 'contains the right value' do
21
21
  expect(subject.get_speaker_details(speaker_profile_page).values_at(:number_of_talks)).to eql([14])
22
22
  end
23
+
24
+ it 'contains the "name" key' do
25
+ expect(subject.get_speaker_details(speaker_profile_page)).to have_key(:name)
26
+ end
27
+
28
+ it 'contains the right value' do
29
+ expect(subject.get_speaker_details(speaker_profile_page).values_at(:name)).to eql(["Fernando Perales"])
30
+ end
31
+
32
+ it 'contains the "website" key' do
33
+ expect(subject.get_speaker_details(speaker_profile_page)).to have_key(:website)
34
+ end
35
+
36
+ it 'contains the right value' do
37
+ expect(subject.get_speaker_details(speaker_profile_page).values_at(:website)).to eql(["http://ferperales.net/"])
38
+ end
39
+
23
40
  end
24
41
  end
25
42
  end
@@ -16,24 +16,36 @@ module SpeakerdeckApi
16
16
  end
17
17
 
18
18
  context 'with a valid username' do
19
+
19
20
  it 'returns a SpeakerdeckApi::Speaker object' do
20
21
  expect(subject.get('ferperales')).to be_a SpeakerdeckApi::Speaker
21
22
  end
22
23
 
23
- it 'contains the number of talks' do
24
+ it 'contains the number_of_talks attribute' do
24
25
  expect(subject.get('ferperales')).to respond_to :number_of_talks
25
26
  end
26
27
 
27
- it 'contains the number of talks' do
28
+ it 'contains the correct number of talks' do
28
29
  expect(subject.get('ferperales').number_of_talks).to eql 14
29
30
  end
30
31
 
32
+ it 'contains the name attribute' do
33
+ expect(subject.get('ferperales')).to respond_to :name
34
+ end
31
35
 
36
+ it 'contains the correct name number' do
37
+ expect(subject.get('ferperales').name).to eql 'Fernando Perales'
38
+ end
32
39
 
33
- end
40
+ it 'contains the website attribute' do
41
+ expect(subject.get('ferperales')).to respond_to :website
42
+ end
34
43
 
35
- end
44
+ it 'contains the correct website number' do
45
+ expect(subject.get('ferperales').website).to eql 'http://ferperales.net/'
46
+ end
36
47
 
48
+ end
49
+ end
37
50
  end
38
-
39
51
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
1
4
  require 'speakerdeck_api'
2
5
  require 'speakerdeck_api/speaker'
3
6
  require 'speakerdeck_api/exceptions/speaker_not_found_exception'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: speakerdeck_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fer Perales
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-12 00:00:00.000000000 Z
11
+ date: 2014-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: coveralls
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: pry-byebug
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -101,6 +115,7 @@ executables: []
101
115
  extensions: []
102
116
  extra_rdoc_files: []
103
117
  files:
118
+ - ".coveralls.yml"
104
119
  - ".gitignore"
105
120
  - ".travis.yml"
106
121
  - Gemfile