pintrest-api 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/.gitignore +61 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +74 -0
- data/Rakefile +9 -0
- data/lib/pintrest_api/pin.rb +6 -1
- data/lib/pintrest_api/version.rb +3 -0
- data/lib/pintrest_api.rb +1 -0
- data/pintrest_api.gemspec +38 -0
- data/watch.rb +32 -0
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f95bd14d7dbe82e141e14b08b6e10fe817e7aa4e
|
4
|
+
data.tar.gz: ddeef50cbaeae86ff075580d4b1b9a6e4056c81a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18978b0c2f7f2bf2a4cd5124025e3229c8c9f08e55d8c18764aa7e952c84ac4c275400f1028d078af20b4c582a41473b7285558d1d180771600dd2ae4f0d44a3
|
7
|
+
data.tar.gz: b61ba90bcb685e60f8bac7d392a3209dab26c228c5009cad1bb52d4e623d4c1581c4c2d5925a2cffd65122306e1bf155dbbeab9b406d8b67c7c64c35cd05390f
|
data/.DS_Store
ADDED
Binary file
|
data/.gitignore
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Created by https://www.gitignore.io
|
2
|
+
|
3
|
+
### Ruby ###
|
4
|
+
*.gem
|
5
|
+
*.rbc
|
6
|
+
/.config
|
7
|
+
/coverage/
|
8
|
+
/InstalledFiles
|
9
|
+
/pkg/
|
10
|
+
/spec/reports/
|
11
|
+
/test/tmp/
|
12
|
+
/test/version_tmp/
|
13
|
+
/tmp/
|
14
|
+
|
15
|
+
## Specific to RubyMotion:
|
16
|
+
.dat*
|
17
|
+
.repl_history
|
18
|
+
build/
|
19
|
+
|
20
|
+
## Documentation cache and generated files:
|
21
|
+
/.yardoc/
|
22
|
+
/_yardoc/
|
23
|
+
/doc/
|
24
|
+
/rdoc/
|
25
|
+
|
26
|
+
## Environment normalisation:
|
27
|
+
/.bundle/
|
28
|
+
/lib/bundler/man/
|
29
|
+
|
30
|
+
# for a library or gem, you might want to ignore these files since the code is
|
31
|
+
# intended to run in multiple environments; otherwise, check them in:
|
32
|
+
# Gemfile.lock
|
33
|
+
# .ruby-version
|
34
|
+
# .ruby-gemset
|
35
|
+
|
36
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
37
|
+
.rvmrc
|
38
|
+
|
39
|
+
|
40
|
+
### OSX ###
|
41
|
+
.DS_Store
|
42
|
+
.AppleDouble
|
43
|
+
.LSOverride
|
44
|
+
|
45
|
+
# Icon must end with two \r
|
46
|
+
Icon
|
47
|
+
|
48
|
+
# Thumbnails
|
49
|
+
._*
|
50
|
+
|
51
|
+
# Files that might appear on external disk
|
52
|
+
.Spotlight-V100
|
53
|
+
.Trashes
|
54
|
+
|
55
|
+
# Directories potentially created on remote AFP share
|
56
|
+
.AppleDB
|
57
|
+
.AppleDesktop
|
58
|
+
Network Trash Folder
|
59
|
+
Temporary Items
|
60
|
+
.apdisk
|
61
|
+
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
pintrest-api (0.0.6)
|
5
|
+
capybara (~> 2.4)
|
6
|
+
nokogiri (~> 1.6)
|
7
|
+
poltergeist (~> 1.5)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
ast (2.0.0)
|
13
|
+
astrolabe (1.3.0)
|
14
|
+
parser (>= 2.2.0.pre.3, < 3.0)
|
15
|
+
capybara (2.4.4)
|
16
|
+
mime-types (>= 1.16)
|
17
|
+
nokogiri (>= 1.3.3)
|
18
|
+
rack (>= 1.0.0)
|
19
|
+
rack-test (>= 0.5.4)
|
20
|
+
xpath (~> 2.0)
|
21
|
+
cliver (0.3.2)
|
22
|
+
coderay (1.1.0)
|
23
|
+
method_source (0.8.2)
|
24
|
+
mime-types (2.4.3)
|
25
|
+
mini_portile (0.6.2)
|
26
|
+
minitest (5.5.1)
|
27
|
+
multi_json (1.10.1)
|
28
|
+
nokogiri (1.6.6.2)
|
29
|
+
mini_portile (~> 0.6.0)
|
30
|
+
parser (2.2.0.2)
|
31
|
+
ast (>= 1.1, < 3.0)
|
32
|
+
poltergeist (1.5.1)
|
33
|
+
capybara (~> 2.1)
|
34
|
+
cliver (~> 0.3.1)
|
35
|
+
multi_json (~> 1.0)
|
36
|
+
websocket-driver (>= 0.2.0)
|
37
|
+
powerpack (0.0.9)
|
38
|
+
pry (0.10.1)
|
39
|
+
coderay (~> 1.1.0)
|
40
|
+
method_source (~> 0.8.1)
|
41
|
+
slop (~> 3.4)
|
42
|
+
rack (1.6.0)
|
43
|
+
rack-test (0.6.3)
|
44
|
+
rack (>= 1.0)
|
45
|
+
rainbow (2.0.0)
|
46
|
+
rake (10.4.2)
|
47
|
+
rb-fsevent (0.9.4)
|
48
|
+
rubocop (0.28.0)
|
49
|
+
astrolabe (~> 1.3)
|
50
|
+
parser (>= 2.2.0.pre.7, < 3.0)
|
51
|
+
powerpack (~> 0.0.6)
|
52
|
+
rainbow (>= 1.99.1, < 3.0)
|
53
|
+
ruby-progressbar (~> 1.4)
|
54
|
+
ruby-progressbar (1.7.1)
|
55
|
+
slop (3.6.0)
|
56
|
+
terminal-notifier (1.6.2)
|
57
|
+
websocket-driver (0.5.1)
|
58
|
+
websocket-extensions (>= 0.1.0)
|
59
|
+
websocket-extensions (0.1.1)
|
60
|
+
xpath (2.0.0)
|
61
|
+
nokogiri (~> 1.3)
|
62
|
+
|
63
|
+
PLATFORMS
|
64
|
+
ruby
|
65
|
+
|
66
|
+
DEPENDENCIES
|
67
|
+
bundler (~> 1.7)
|
68
|
+
minitest (~> 5.5)
|
69
|
+
pintrest-api!
|
70
|
+
pry (~> 0.10)
|
71
|
+
rake (~> 10.1)
|
72
|
+
rb-fsevent (~> 0.9)
|
73
|
+
rubocop (~> 0.28)
|
74
|
+
terminal-notifier (~> 1.6)
|
data/Rakefile
ADDED
data/lib/pintrest_api/pin.rb
CHANGED
@@ -4,11 +4,12 @@ module PintrestApi
|
|
4
4
|
class Pin < Core
|
5
5
|
attr_reader :image_url, :title, :credits_url, :url, :description
|
6
6
|
|
7
|
+
PINTREST_URL = 'http://www.pintrest.com'
|
7
8
|
PIN_BASE_CSS = '.Grid .Module.Pin.PinBase'
|
8
9
|
PIN_IMAGE_CSS = '.pinHolder .pinImg'
|
9
10
|
PIN_TITLE_CSS = '.richPinGridTitle'
|
10
11
|
PIN_CREDIT_CSS = '.creditItem a'
|
11
|
-
PIN_URL_CSS = '.
|
12
|
+
PIN_URL_CSS = '.pinHolder .pinImageWrapper'
|
12
13
|
PIN_DESCRIPT_CSS = '.pinDescription'
|
13
14
|
|
14
15
|
def initialize(image_url, title, credits_url, url, description)
|
@@ -45,6 +46,7 @@ module PintrestApi
|
|
45
46
|
login(authentication) if !@is_logged_in || authentication
|
46
47
|
@is_logged_in = true
|
47
48
|
@session.visit http_url(board.url)
|
49
|
+
sleep 2
|
48
50
|
parse_pins get_with_ajax_scroll(PIN_BASE_CSS)
|
49
51
|
end
|
50
52
|
|
@@ -66,10 +68,13 @@ module PintrestApi
|
|
66
68
|
nokogiri_items.each do |item|
|
67
69
|
pin_image = attribute_value(item, PIN_IMAGE_CSS, 'src')
|
68
70
|
pin_credits = attribute_value(item, PIN_CREDIT_CSS, 'href')
|
71
|
+
pin_credits = pin_credits && PINTREST_URL + pin_credits
|
69
72
|
pin_url = attribute_value(item, PIN_URL_CSS, 'href')
|
73
|
+
pin_url = pin_url && PINTREST_URL + pin_url
|
70
74
|
pin_description = item.css(PIN_DESCRIPT_CSS).inner_text.strip
|
71
75
|
pin_title = item.css('.richPinGridTitle').inner_text.strip
|
72
76
|
|
77
|
+
|
73
78
|
pins << Pin.new(pin_image, pin_title, pin_credits, pin_url, pin_description)
|
74
79
|
end
|
75
80
|
|
data/lib/pintrest_api.rb
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'pintrest_api/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = 'pintrest-api'
|
8
|
+
s.version = PintrestApi::VERSION
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.required_ruby_version = '>= 1.9.3'
|
11
|
+
s.require_paths = 'lib'
|
12
|
+
s.date = '2014-12-20'
|
13
|
+
s.summary = 'Pintrest Api'
|
14
|
+
s.extra_rdoc_files = ['LICENSE.txt', 'README.md']
|
15
|
+
s.description = <<-DESCRIPTION
|
16
|
+
A gem to create a pintrest api to gather
|
17
|
+
pins using Capybara and PhantomJS.
|
18
|
+
DESCRIPTION
|
19
|
+
s.authors = ['Mika Kalathil']
|
20
|
+
s.email = 'me@mikakalathil.ca'
|
21
|
+
s.files = `git ls-files -z`.split("\x0")
|
22
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
23
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
24
|
+
s.require_paths = ["lib"]
|
25
|
+
s.homepage = 'http://rubygems.org/gems/pintrest-api'
|
26
|
+
s.license = 'MIT'
|
27
|
+
s.rubygems_version = '1.8.23'
|
28
|
+
s.add_runtime_dependency('capybara', '~> 2.4')
|
29
|
+
s.add_runtime_dependency('poltergeist', '~> 1.5')
|
30
|
+
s.add_runtime_dependency('nokogiri', '~> 1.6')
|
31
|
+
s.add_development_dependency('rake', '~> 10.1')
|
32
|
+
s.add_development_dependency('bundler', '~> 1.7')
|
33
|
+
s.add_development_dependency('rubocop', '~> 0.28')
|
34
|
+
s.add_development_dependency('rb-fsevent', '~> 0.9')
|
35
|
+
s.add_development_dependency('terminal-notifier', '~> 1.6')
|
36
|
+
s.add_development_dependency('minitest', '~> 5.5')
|
37
|
+
s.add_development_dependency('pry', '~> 0.10')
|
38
|
+
end
|
data/watch.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require './lib/pintrest_api.rb'
|
4
|
+
require 'pry'
|
5
|
+
require 'rb-fsevent'
|
6
|
+
|
7
|
+
puts 'Starting watch for Pintrest Api'
|
8
|
+
fsevent = FSEvent.new
|
9
|
+
|
10
|
+
def test_files
|
11
|
+
test_files = Dir[Dir.pwd + '/test/test_*.rb']
|
12
|
+
test_files.each do |f|
|
13
|
+
`ruby #{f}`
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_result
|
18
|
+
if (test_files)
|
19
|
+
puts `terminal-notifier -title 'Auto Watch' -message 'Pintrest Api Test' -subtitle 'Success!'`
|
20
|
+
else
|
21
|
+
puts `terminal-notifier -title 'Auto Watch' -message 'Pintrest Api Test' -subtitle 'Failure'`
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
fsevent.watch [Dir.pwd + '/lib', Dir.pwd + '/test'] do |directories|
|
26
|
+
puts "\nChange detected running tests....."
|
27
|
+
puts `rubocop lib/`
|
28
|
+
test_result
|
29
|
+
puts "Finshed running specs"
|
30
|
+
end
|
31
|
+
|
32
|
+
fsevent.run
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pintrest-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mika Kalathil
|
@@ -160,16 +160,24 @@ extra_rdoc_files:
|
|
160
160
|
- LICENSE.txt
|
161
161
|
- README.md
|
162
162
|
files:
|
163
|
+
- ".DS_Store"
|
164
|
+
- ".gitignore"
|
165
|
+
- Gemfile
|
166
|
+
- Gemfile.lock
|
163
167
|
- LICENSE.txt
|
164
168
|
- README.md
|
169
|
+
- Rakefile
|
165
170
|
- lib/pintrest_api.rb
|
166
171
|
- lib/pintrest_api/authentication.rb
|
167
172
|
- lib/pintrest_api/board.rb
|
168
173
|
- lib/pintrest_api/core.rb
|
169
174
|
- lib/pintrest_api/pin.rb
|
175
|
+
- lib/pintrest_api/version.rb
|
176
|
+
- pintrest_api.gemspec
|
170
177
|
- test/spec_helper.rb
|
171
178
|
- test/test_board.rb
|
172
179
|
- test/test_pin.rb
|
180
|
+
- watch.rb
|
173
181
|
homepage: http://rubygems.org/gems/pintrest-api
|
174
182
|
licenses:
|
175
183
|
- MIT
|
@@ -190,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
198
|
version: '0'
|
191
199
|
requirements: []
|
192
200
|
rubyforge_project:
|
193
|
-
rubygems_version: 2.4.
|
201
|
+
rubygems_version: 2.4.5
|
194
202
|
signing_key:
|
195
203
|
specification_version: 4
|
196
204
|
summary: Pintrest Api
|