phone_sites 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee3017edbc12038119f51fb0d29a699a6311fda1
|
4
|
+
data.tar.gz: 3cad47d4c8adc9998f370a5e9b2be03f65a09917
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df5bf06acade11cf8b8a584ba3c65de40c27c5cee3324e288371f68a98b64f3d6cb8a37dcc6b2c248b52a93e056cb7df5c3209bc2e7850e000edf7b849d3d04f
|
7
|
+
data.tar.gz: feb1efefca197f9d937fe7aaa140b2ad16318a1b3322b7daa6d280217a1885b7a34daedb12ee10513b06553d67aeb5dbeddec7ec72cab993fa9fc86b86a25555
|
data/PhoneSites.gemspec
CHANGED
@@ -11,23 +11,14 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.email = ["gophan1992@gmail.com"]
|
12
12
|
|
13
13
|
spec.summary = "Gem for web-scraping data for phone sites"
|
14
|
-
spec.description = "This gem is for scraping data and organize workflow without storing
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
"
|
14
|
+
spec.description = "This gem is for scraping data and organize workflow without storing
|
15
|
+
something in databases. \r\nUsage: ```PhoneSites::GsmArena::Connection.get_manufacturers```
|
16
|
+
will return list of manufacturers. \r\nThen you can call ```manufacturer.models```
|
17
|
+
to get list of its models. Each model has method ```info``` that \r\n
|
18
|
+
takes model data from site with description"
|
20
19
|
spec.homepage = "http://bitbucket.org/BEaStia/phone_sites/"
|
21
20
|
spec.license = "MIT"
|
22
21
|
|
23
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
24
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
25
|
-
#if spec.respond_to?(:metadata)
|
26
|
-
# spec.metadata['allowed_push_host'] = "http://rubygems.org"
|
27
|
-
#else
|
28
|
-
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
29
|
-
#end
|
30
|
-
|
31
22
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
32
23
|
f.match(%r{^(test|spec|features)/})
|
33
24
|
end
|
@@ -10,6 +10,17 @@ module PhoneSites
|
|
10
10
|
manufacturer.models
|
11
11
|
end
|
12
12
|
|
13
|
+
def self.get_description(arg)
|
14
|
+
case arg
|
15
|
+
when PhoneModel
|
16
|
+
arg.info
|
17
|
+
when String
|
18
|
+
ModelInfoResponse.new.perform(URI.join(PhoneSites::GsmArena::BASE_URL, arg).to_s)
|
19
|
+
else
|
20
|
+
raise NotImplementedException
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
13
24
|
def self.search(name)
|
14
25
|
SearchResponse.new.perform(name)
|
15
26
|
end
|
@@ -15,17 +15,18 @@ module PhoneSites
|
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
18
|
+
|
18
19
|
def normalize_property_value(value)
|
19
20
|
val = value.tr("\r\n ", '').strip
|
20
21
|
case val
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
when "Yes"
|
23
|
+
true
|
24
|
+
when "No"
|
25
|
+
false
|
26
|
+
when "-"
|
27
|
+
nil
|
28
|
+
else
|
29
|
+
val
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
@@ -3,8 +3,7 @@ module PhoneSites
|
|
3
3
|
module GsmArena
|
4
4
|
class SearchResponse < ::PhoneSites::BaseResponse
|
5
5
|
def perform(name, method = 'get', options = {})
|
6
|
-
|
7
|
-
url = "http://www.gsmarena.com/results.php3?sQuickSearch=yes&sName="+ URI::encode(name)
|
6
|
+
url = "http://www.gsmarena.com/results.php3?sQuickSearch=yes&sName=" + URI.encode(name)
|
8
7
|
response = super(url, method, options)
|
9
8
|
Nokogiri::HTML(response.body).css('.makers li a').map do |elem|
|
10
9
|
PhoneSites::GsmArena::PhoneModel.new(elem)
|
@@ -13,5 +12,3 @@ module PhoneSites
|
|
13
12
|
end
|
14
13
|
end
|
15
14
|
end
|
16
|
-
|
17
|
-
|
data/lib/phone_sites/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phone_sites
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Pavlov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -120,12 +120,11 @@ dependencies:
|
|
120
120
|
- - "~>"
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
|
-
description:
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
123
|
+
description: "This gem is for scraping data and organize workflow without storing\n
|
124
|
+
\ something in databases. \r\nUsage: ```PhoneSites::GsmArena::Connection.get_manufacturers```\n
|
125
|
+
\ will return list of manufacturers. \r\nThen you can call ```manufacturer.models```\n
|
126
|
+
\ to get list of its models. Each model has method ```info``` that \r\n\n takes
|
127
|
+
model data from site with description"
|
129
128
|
email:
|
130
129
|
- gophan1992@gmail.com
|
131
130
|
executables: []
|