ex_ua 0.0.3 → 0.1.0
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 +4 -4
- data/LICENCE +20 -0
- data/README.md +1 -2
- data/Rakefile +2 -1
- data/ex_ua.gemspec +2 -0
- data/lib/ex_ua/category.rb +16 -22
- data/lib/ex_ua/client.rb +39 -4
- data/lib/ex_ua/item.rb +23 -6
- data/lib/ex_ua/version.rb +1 -1
- data/lib/ex_ua.rb +0 -1
- data/spec/category_spec.rb +8 -6
- data/spec/client_spec.rb +14 -3
- data/spec/data/foreign_video_russia.html +234 -233
- data/spec/data/index.html +149 -220
- data/spec/data/ru_video.html +219 -218
- data/spec/data/search?s=futurama&p=0&per=20 +149 -0
- data/spec/data/video_test.html +422 -420
- data/spec/spec_helper.rb +6 -10
- data/tasks/update_spec_data.rake +20 -0
- metadata +22 -3
data/spec/spec_helper.rb
CHANGED
@@ -1,15 +1,11 @@
|
|
1
1
|
require 'ex_ua'
|
2
2
|
module StubbedExUAClient
|
3
|
-
BASE_URL = File.
|
4
|
-
def
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
Nokogiri.parse(File.new("#{BASE_URL}/#{page}", external_encoding: Encoding::UTF_8).read)
|
10
|
-
end
|
11
|
-
c
|
12
|
-
)
|
3
|
+
BASE_URL = File.expand_path('../data', __FILE__)
|
4
|
+
def stub_client
|
5
|
+
ExUA::Client.instance.stub(:get) do |page|
|
6
|
+
page = '/index.html' if page == '/'
|
7
|
+
Nokogiri.parse(File.new("#{BASE_URL}#{page}", external_encoding: Encoding::UTF_8).read)
|
8
|
+
end
|
13
9
|
end
|
14
10
|
end
|
15
11
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
desc 'Update spec data'
|
2
|
+
task :update_spec_data do
|
3
|
+
require 'httparty'
|
4
|
+
begin
|
5
|
+
base_url = 'http://www.ex.ua'
|
6
|
+
data_path = File.expand_path('../../spec/data', __FILE__)
|
7
|
+
files = {'/' => 'index.html',
|
8
|
+
'/ru/video' => 'ru_video.html',
|
9
|
+
'/view/53667787?r=2,23775' => 'video_test.html',
|
10
|
+
'/ru/video/foreign?r=23775' => 'foreign_video_russia.html',
|
11
|
+
'/search?s=futurama' => 'search?s=futurama&p=0&per=20'}
|
12
|
+
files.each do |remote, local|
|
13
|
+
url = "#{base_url}#{remote}"
|
14
|
+
puts url
|
15
|
+
File.write(File.join(data_path, local), HTTParty.get(url))
|
16
|
+
end
|
17
|
+
rescue => e
|
18
|
+
puts "Failed updating spec data: #{e.message}."
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ex_ua
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andriy Dmytrenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.5.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: addressable
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.3.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.3.0
|
69
83
|
description: Ruby API for ex.ua
|
70
84
|
email:
|
71
85
|
- refresh.xss@gmail.com
|
@@ -75,6 +89,7 @@ extra_rdoc_files: []
|
|
75
89
|
files:
|
76
90
|
- .gitignore
|
77
91
|
- Gemfile
|
92
|
+
- LICENCE
|
78
93
|
- README.md
|
79
94
|
- Rakefile
|
80
95
|
- ex_ua.gemspec
|
@@ -88,10 +103,13 @@ files:
|
|
88
103
|
- spec/data/foreign_video_russia.html
|
89
104
|
- spec/data/index.html
|
90
105
|
- spec/data/ru_video.html
|
106
|
+
- spec/data/search?s=futurama&p=0&per=20
|
91
107
|
- spec/data/video_test.html
|
92
108
|
- spec/spec_helper.rb
|
109
|
+
- tasks/update_spec_data.rake
|
93
110
|
homepage: ''
|
94
|
-
licenses:
|
111
|
+
licenses:
|
112
|
+
- MIT
|
95
113
|
metadata: {}
|
96
114
|
post_install_message:
|
97
115
|
rdoc_options: []
|
@@ -119,5 +137,6 @@ test_files:
|
|
119
137
|
- spec/data/foreign_video_russia.html
|
120
138
|
- spec/data/index.html
|
121
139
|
- spec/data/ru_video.html
|
140
|
+
- spec/data/search?s=futurama&p=0&per=20
|
122
141
|
- spec/data/video_test.html
|
123
142
|
- spec/spec_helper.rb
|