ipgeobase_truf 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7103c33a6fb8d04c55fb14b5ab0fd283bc94c8009a546f809e9b79197b494631
4
+ data.tar.gz: e6c39d5218f5acfe3f931dd681cc7b70206732e5cf7c9d7fdc336e4c93ee2998
5
+ SHA512:
6
+ metadata.gz: 5e9f4604efa5f32395201483da5a7ba9b45199a480799933fc531da4e5d75cc9eba164213490857278665383cdee661be23f4743961751bb60f331a4d7578160
7
+ data.tar.gz: 63f55771c5cf85523642f0b808fe14c06789d3d2e9d44b289a9d799e1f778ccc365af9371f3b6d056507f09e46b8527e39e96bf81c9b3d8bfb6048dabeb0de9c
data/.DS_Store ADDED
Binary file
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-04-18
4
+
5
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in ipgeobase.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "minitest", "~> 5.0"
11
+
12
+ gem "rubocop", "~> 1.21"
13
+
14
+ gem "addressable"
15
+
16
+ gem 'happymapper'
17
+
18
+ gem "webmock"
data/Gemfile.lock ADDED
@@ -0,0 +1,58 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ipgeobase (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ addressable (2.8.0)
10
+ public_suffix (>= 2.0.2, < 5.0)
11
+ ast (2.4.2)
12
+ crack (0.4.5)
13
+ rexml
14
+ happymapper (0.5.0)
15
+ libxml-ruby (~> 2.9)
16
+ hashdiff (1.0.1)
17
+ libxml-ruby (2.9.0)
18
+ minitest (5.15.0)
19
+ parallel (1.22.1)
20
+ parser (3.1.2.0)
21
+ ast (~> 2.4.1)
22
+ public_suffix (4.0.7)
23
+ rainbow (3.1.1)
24
+ rake (13.0.6)
25
+ regexp_parser (2.3.0)
26
+ rexml (3.2.5)
27
+ rubocop (1.27.0)
28
+ parallel (~> 1.10)
29
+ parser (>= 3.1.0.0)
30
+ rainbow (>= 2.2.2, < 4.0)
31
+ regexp_parser (>= 1.8, < 3.0)
32
+ rexml
33
+ rubocop-ast (>= 1.16.0, < 2.0)
34
+ ruby-progressbar (~> 1.7)
35
+ unicode-display_width (>= 1.4.0, < 3.0)
36
+ rubocop-ast (1.17.0)
37
+ parser (>= 3.1.1.0)
38
+ ruby-progressbar (1.11.0)
39
+ unicode-display_width (2.1.0)
40
+ webmock (3.14.0)
41
+ addressable (>= 2.8.0)
42
+ crack (>= 0.3.2)
43
+ hashdiff (>= 0.4.0, < 2.0.0)
44
+
45
+ PLATFORMS
46
+ x86_64-darwin-21
47
+
48
+ DEPENDENCIES
49
+ addressable
50
+ happymapper
51
+ ipgeobase!
52
+ minitest (~> 5.0)
53
+ rake (~> 13.0)
54
+ rubocop (~> 1.21)
55
+ webmock
56
+
57
+ BUNDLED WITH
58
+ 2.3.7
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Ipgeobase
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ipgeobase`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'ipgeobase'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install ipgeobase_truf
20
+
21
+ ## Usage
22
+
23
+ data = Ipgeobase.lookup('enter IP') /n
24
+ data.country => 'Country Name' /n
25
+ data.city => 'city name' /n
26
+ data.lon => 'lon'' /n
27
+ etc /n
28
+
29
+ ## Development
30
+
31
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
32
+
33
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/trufanovn/ipgeobase.git.
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/test_*.rb"]
10
+ end
11
+
12
+ require "rubocop/rake_task"
13
+
14
+ RuboCop::RakeTask.new
15
+
16
+ task default: %i[test rubocop]
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ipgeobase
4
+ VERSION = "0.1.0"
5
+ end
data/lib/ipgeobase.rb ADDED
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "ipgeobase/version"
4
+
5
+ require 'happymapper'
6
+ require 'addressable/template'
7
+ require 'net/http'
8
+
9
+ module Ipgeobase
10
+ class Post
11
+ include HappyMapper
12
+ tag 'query'
13
+ element :city, String, tag: 'city'
14
+ element :country, String, tag: 'country'
15
+ element :countryCode, String, tag: 'countryCode'
16
+ element :lat, String, tag: 'lat'
17
+ element :lon, String, tag: 'lon'
18
+ end
19
+ class Error < StandardError
20
+ end
21
+ def self.lookup(ip)
22
+ template = Addressable::Template.new("http://{host}{/type}/{ip}")
23
+ uri = template.expand({ 'host' => 'ip-api.com', 'type' => 'xml', 'ip' => ip })
24
+ get_data = Net::HTTP.get_response(uri)
25
+ posts = Post.parse(get_data.body)
26
+ end
27
+ end
data/sig/ipgeobase.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Ipgeobase
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ipgeobase_truf
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Trufanov Nikita
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-04-19 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Example description.
14
+ email:
15
+ - trufanovwork@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".DS_Store"
21
+ - ".rubocop.yml"
22
+ - CHANGELOG.md
23
+ - Gemfile
24
+ - Gemfile.lock
25
+ - README.md
26
+ - Rakefile
27
+ - lib/ipgeobase.rb
28
+ - lib/ipgeobase/version.rb
29
+ - sig/ipgeobase.rbs
30
+ homepage: https://github.com/trufanovn/ipgeobase
31
+ licenses: []
32
+ metadata:
33
+ homepage_uri: https://github.com/trufanovn/ipgeobase
34
+ source_code_uri: https://github.com/trufanovn/ipgeobase
35
+ changelog_uri: https://github.com/trufanovn/ipgeobase
36
+ post_install_message:
37
+ rdoc_options: []
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 2.6.0
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubygems_version: 3.0.3.1
52
+ signing_key:
53
+ specification_version: 4
54
+ summary: Example summary.
55
+ test_files: []