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: ba8dfd339658d482be5e287e40dc9f78e7fdcdbe
4
- data.tar.gz: de8586482c20f169fa84433f92ef9d883db58f2e
3
+ metadata.gz: ee3017edbc12038119f51fb0d29a699a6311fda1
4
+ data.tar.gz: 3cad47d4c8adc9998f370a5e9b2be03f65a09917
5
5
  SHA512:
6
- metadata.gz: 6f0421711fc6a578e72f8646308cc6d6d274bb58a5fe87e42c433673b2cb3ab749298a028eff3711207cc27058a5ed8b543d6547269341669177fe7830202373
7
- data.tar.gz: 123b7e1d557b9201b2a62cabc8625e2d2e17e5ce6f1502d05ce1fc941e272ae3e330f20d8b70e1ba5866d4cbd2c05872d26bd8d78d702a40637736caf9d9aa30
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 something in databases.
15
- Usage: ```PhoneSites::GsmArena::Connection.get_manufacturers``` will return list of manufacturers.
16
- Then you can call ```manufacturer.models``` to get list of its models. Each model has method ```info``` that
17
- takes model data from site with description
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
- when "Yes"
22
- true
23
- when "No"
24
- false
25
- when "-"
26
- nil
27
- else
28
- val
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
-
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module PhoneSites
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
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.0
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-04 00:00:00.000000000 Z
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
- This gem is for scraping data and organize workflow without storing something in databases.
125
- Usage: ```PhoneSites::GsmArena::Connection.get_manufacturers``` will return list of manufacturers.
126
- Then you can call ```manufacturer.models``` to get list of its models. Each model has method ```info``` that
127
- takes model data from site with description
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: []