scraperd 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: c89ab4e737da21e3401a8277ffa15c336763d05d
4
- data.tar.gz: f8346f873afd1328f202933d9949a4b07a6353cf
3
+ metadata.gz: 4c8ef633ae60393ebfd3fa5d149953575975d43a
4
+ data.tar.gz: 91330eff4e4289d8b90411ad6742072e6f1a200d
5
5
  SHA512:
6
- metadata.gz: d609b4c5e82e571719ff7e43f4585a0530a0870e648cf8f9d1c1a9d5bb7f289084b49306694593966b31dfdbb6cd0b18253368b982bd18da04ea272a7761ba3b
7
- data.tar.gz: a75213d34d42cc685a71dc1089d89d20c4a3873b735fe31ab09da833ae52ddea20f42138b04865d8619bdbd0fac26b7be071a5b536d03971ef9d3f478d79489a
6
+ metadata.gz: 272f8ac102e1b632153a0d735fcd9641e0acbfb84285e630486bec1194109484ba873f5614c4292d36bec30790514de2ef01265b5c5b83db4f880646999d0244
7
+ data.tar.gz: 51ca1921d90f058a112e75bf276ce3b263e3f64ddcd2c6af32b3ee68c75bffe8d1964339e0c5072f767f45fa6b1816c35400a3b5e50d33433135ea5f14858301
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
data/Gemfile CHANGED
@@ -2,3 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in scraperd.gemspec
4
4
  gemspec
5
+ gem 'pry'
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Scraperd
2
2
 
3
- Scraperd is a very simple scraper for the public user activity RSS in [Letterboxd](http://letterboxd.com). It relies in OpenStruct to build objects.
3
+ Scraperd is a very simple scraper for the public user activity RSS in [Letterboxd](http://letterboxd.com). It relies on OpenStruct to build objects.
4
4
 
5
5
 
6
6
  ## Installation
@@ -9,6 +9,7 @@ module Scraperd
9
9
  super(Hashie::Mash.new({
10
10
  id: item[:guid].force_encoding("UTF-8"),
11
11
  title: title_from_title(item[:title]),
12
+ year: year_from_title(item[:title]),
12
13
  score: score_from_title(item[:title]),
13
14
  link: item[:link].force_encoding("UTF-8"),
14
15
  film_link: "http://letterboxd.com/film/#{nicetitle_from_url(item[:link])}/".force_encoding("UTF-8"),
@@ -28,7 +29,17 @@ module Scraperd
28
29
  end
29
30
 
30
31
  def title_from_title(title)
31
- title.split(' - ')[0..-2].join(' - ').force_encoding("UTF-8")
32
+ title.split(' - ')[0..-2].join(' - ')
33
+ .split(',')[0..-2].join(',')
34
+ .strip
35
+ .force_encoding("UTF-8")
36
+ end
37
+
38
+ def year_from_title(title)
39
+ title.split(' - ')[0..-2].join(' - ')
40
+ .split(',').last
41
+ .strip
42
+ .force_encoding("UTF-8")
32
43
  end
33
44
 
34
45
  def score_from_title(title)
@@ -1,3 +1,3 @@
1
1
  module Scraperd
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class ActivityTest < MiniTest::Unit::TestCase
3
+ class ActivityTest < MiniTest::Test
4
4
  def test_activity_conversion
5
5
  item = { :title => "Nausica\xC3\xA4 of the Valley of the Wind, 1984 - \xE2\x98\x85\xE2\x98\x85\xE2\x98\x85\xC2\xBD",
6
6
  :link => "http://letterboxd.com/eltercero/film/nausicaa-of-the-valley-of-the-wind/",
@@ -11,7 +11,8 @@ class ActivityTest < MiniTest::Unit::TestCase
11
11
 
12
12
  activity = Scraperd::Activity.new(item)
13
13
 
14
- assert_equal activity.title, "Nausica\xC3\xA4 of the Valley of the Wind, 1984"
14
+ assert_equal activity.title, "Nausica\xC3\xA4 of the Valley of the Wind"
15
+ assert_equal activity.year, "1984"
15
16
  assert_equal activity.score, 7
16
17
  assert_equal activity.link, "http://letterboxd.com/eltercero/film/nausicaa-of-the-valley-of-the-wind/"
17
18
  assert_equal activity.film_link, "http://letterboxd.com/film/nausicaa-of-the-valley-of-the-wind/"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scraperd
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
  - Víctor Martín
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-15 00:00:00.000000000 Z
11
+ date: 2015-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,6 +94,7 @@ extensions: []
94
94
  extra_rdoc_files: []
95
95
  files:
96
96
  - ".gitignore"
97
+ - ".travis.yml"
97
98
  - Gemfile
98
99
  - LICENSE.txt
99
100
  - README.md