yandex_locator 0.1.0 → 0.2.0

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: 92d161904fed1aaf07a644c876a53ad1fd06b56d
4
- data.tar.gz: c125f216f44388473c7dd23fd0b6940382b3a02c
3
+ metadata.gz: fb740623678a1e5908048dee785284f00b007f89
4
+ data.tar.gz: 085d0f3801eec015012b6b5c8b55e232e3a363ea
5
5
  SHA512:
6
- metadata.gz: ddf60646cf08c0473c644bb24437792558c03feafeaa1c7efab7d04f740c643fe2a75e2e8f743e1e27ff92245ab0a60df6cf3b571a907662301ed7625f5f8847
7
- data.tar.gz: 3bfc57ab6efbe5a3f69434bafd34621a7ff56f140a319a2e2d53d7d8143238335c2adc1e4468cb54e6bd21d4c7d9a8ae2c186e9ef0df0636a571706f4cde9bcc
6
+ metadata.gz: 3d3422fefa90e85ff3598fe51c0a89c02bdb6b0029e1c9cff6fb1da4da51bace878800684f318222436c13231b74fbd332f6821277390b2ad211799d9bc7f322
7
+ data.tar.gz: 79f311183c97a959852d3f3ced7c54a14888310565262d8080fc1e358ce35f449518175ec03cb7bca2691717c16e171479457d4865ada58de0865f584a8cacb5
data/.travis.yml CHANGED
@@ -1,5 +1,8 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.0.0
4
+ - 2.3.1
5
5
  before_install: gem install bundler -v 1.12.5
6
+ addons:
7
+ code_climate:
8
+ repo_token: 202213aa1fb36b77f30825aaa5b19195467a206fda46fcdd8f7278cc5064f457
data/README.md CHANGED
@@ -1,6 +1,12 @@
1
+ [![Gem](https://img.shields.io/gem/v/yandex_locator.svg?style=flat-square)](https://rubygems.org/gems/yandex_locator)
2
+ [![Build Status](https://travis-ci.org/sergey-chechaev/yandex_locator.svg?branch=master)](https://travis-ci.org/sergey-chechaev/yandex_locator)
3
+ [![Code Climate](https://codeclimate.com/github/sergey-chechaev/yandex_locator.svg)](https://codeclimate.com/github/sergey-chechaev/yandex_locator)
4
+ [![Dependency Status](https://www.versioneye.com/user/projects/57bf6ec8968d640033602245/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/57bf6ec8968d640033602245)
5
+ [![Test Coverage](https://codeclimate.com/github/sergey-chechaev/yandex_locator/badges/coverage.svg)](https://codeclimate.com/github/sergey-chechaev/yandex_locator/coverage)
6
+
1
7
  # YandexLocator
2
8
 
3
- Ruby gem for Yandex locator (https://tech.yandex.ru/locator/). Yandex locator servic that find mobile devices in a region delineated by a circle. Service return longitude, latitude and precision.
9
+ Ruby gem for Yandex locator (https://tech.yandex.ru/locator/). Yandex locator is a service that finds mobile devices in a region delineated by a circle. The service returns longitude, latitude and precision.
4
10
 
5
11
  ## Installation
6
12
 
@@ -34,6 +40,7 @@ Make request
34
40
  ```ruby
35
41
  conn = YandexLocator::Client.new
36
42
  result = conn.lookup(ip: "109.252.52.39")
43
+ # => {"position"=>{"altitude"=>0.0, "altitude_precision"=>30.0, "latitude"=>55.75395965576172, "longitude"=>37.62039184570312, "precision"=>100000.0, "type"=>"ip"}}
37
44
  ```
38
45
 
39
46
 
@@ -45,5 +52,5 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
45
52
 
46
53
  ## Contributing
47
54
 
48
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/yandex_locator.
55
+ Bug reports and pull requests are welcome on GitHub at https://github.com/sergey-chechaev/yandex_locator.
49
56
 
@@ -4,24 +4,36 @@ module YandexLocator
4
4
  @conn = YandexLocator::API.call
5
5
  end
6
6
 
7
- def lookup(ip: )
7
+ def lookup(ip: nil, mac: nil, cellid: nil, lac: nil, signal_strength: nil)
8
8
  result = @conn.post do |req|
9
9
  req.url '/geolocation'
10
10
  req.headers['Content-Type'] = 'application/json'
11
- req.params['json'] = insert_data(ip: ip).to_json
11
+ req.params['json'] = insert_data(ip: ip, mac: mac, cellid: cellid, lac: lac, signal_strength: signal_strength).to_json
12
12
  end
13
13
 
14
14
  JSON.parse(result.body)
15
15
  end
16
16
 
17
- def insert_data(ip: )
17
+ def insert_data(ip: , mac: , cellid: , lac: , signal_strength:)
18
18
  {common:
19
19
  {version: YandexLocator.configuration.version,
20
20
  api_key: YandexLocator.configuration.api_key
21
21
  },
22
22
  ip: {
23
23
  address_v4: ip
24
- }
24
+ },
25
+ wifi_networks: [
26
+ {
27
+ mac: mac
28
+ },
29
+ gsm_cells: [
30
+ {
31
+ cellid: cellid,
32
+ lac: lac,
33
+ signal_strength: signal_strength,
34
+ }
35
+ ]
36
+ ]
25
37
  }
26
38
  end
27
39
  end
@@ -1,3 +1,3 @@
1
1
  module YandexLocator
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -17,13 +17,14 @@ Gem::Specification.new do |spec|
17
17
  spec.bindir = "exe"
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
- spec.required_ruby_version = '~> 2.0'
20
+ spec.required_ruby_version = '~> 2.3'
21
21
 
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.12"
24
24
  spec.add_development_dependency "rake", "~> 10.0"
25
25
  spec.add_development_dependency "rspec", "~> 3.0"
26
26
  spec.add_development_dependency 'pry-rails'
27
+ spec.add_development_dependency 'codeclimate-test-reporter'
27
28
 
28
29
  spec.add_runtime_dependency 'faraday', '~> 0.9.2'
29
30
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yandex_locator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Chechaev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-25 00:00:00.000000000 Z
11
+ date: 2016-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: codeclimate-test-reporter
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: faraday
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -112,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
126
  requirements:
113
127
  - - "~>"
114
128
  - !ruby/object:Gem::Version
115
- version: '2.0'
129
+ version: '2.3'
116
130
  required_rubygems_version: !ruby/object:Gem::Requirement
117
131
  requirements:
118
132
  - - ">="
@@ -120,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
134
  version: '0'
121
135
  requirements: []
122
136
  rubyforge_project:
123
- rubygems_version: 2.2.2
137
+ rubygems_version: 2.5.1
124
138
  signing_key:
125
139
  specification_version: 4
126
140
  summary: ruby gem for yandex locator