ipstack 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 +4 -4
- data/Gemfile.lock +1 -7
- data/lib/ipstack/api.rb +3 -5
- data/lib/ipstack/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 479a63425097c0b5d1b16c1dc2123f5c3c49691c176f7b04cd899c5564230ac2
|
4
|
+
data.tar.gz: cf33e0883ea7736c80442a272ce62c425741861378da65f04338dc79c7e87c2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07f7602b0c5a14fb2f5fb97df71cfa46aaddc676704c65802e9ffa9f682cdf99e3fb468f9b3d27170795b4b6f9f6d50f02e50ff87305636205f0acbdbcf64c9a
|
7
|
+
data.tar.gz: 8120074efdd99aa70e9223614bbaf5053f004fbdb6ac9bd6da809e46c771342c0a0f6b0316e34bee64c798783b1ff4cfaba3ab09083e33660e49fa3ea43d4423
|
data/Gemfile.lock
CHANGED
@@ -1,21 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ipstack (0.
|
4
|
+
ipstack (0.1.1)
|
5
5
|
nokogiri (~> 1.8.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
coderay (1.1.2)
|
11
10
|
diff-lcs (1.3)
|
12
|
-
method_source (0.9.0)
|
13
11
|
mini_portile2 (2.3.0)
|
14
12
|
nokogiri (1.8.2)
|
15
13
|
mini_portile2 (~> 2.3.0)
|
16
|
-
pry (0.11.3)
|
17
|
-
coderay (~> 1.1.0)
|
18
|
-
method_source (~> 0.9.0)
|
19
14
|
rake (12.3.1)
|
20
15
|
rspec (3.7.0)
|
21
16
|
rspec-core (~> 3.7.0)
|
@@ -37,7 +32,6 @@ PLATFORMS
|
|
37
32
|
DEPENDENCIES
|
38
33
|
bundler (~> 1.16)
|
39
34
|
ipstack!
|
40
|
-
pry
|
41
35
|
rake (~> 12.3)
|
42
36
|
rspec (~> 3.0)
|
43
37
|
|
data/lib/ipstack/api.rb
CHANGED
@@ -5,13 +5,13 @@ require 'nokogiri'
|
|
5
5
|
|
6
6
|
module Ipstack
|
7
7
|
class API
|
8
|
-
# Make sure we can access parameters of the object
|
9
|
-
attr_accessor :api_url, :content_type, :access_key, :optionals, :params_uri, :return_raw
|
8
|
+
attr_accessor :api_url, :content_type, :access_key, :optionals, :params_uri, :return_raw # Make sure we can access parameters of the object in methods
|
10
9
|
def initialize(optionals = {}, access_key = ENV['IPSTACK_ACCESS_KEY'])
|
11
10
|
|
12
11
|
raise ArgumentError, 'Requires a hash of optional values found on https://ipstack.com/documentation' unless optionals.is_a?(Hash)
|
13
12
|
raise ArgumentError, '\'access_key\' (api key) cannot be nil. Obtain your key from https://ipstack.com/quickstart and set it as ENV[\'IPSTACK_ACCESS_KEY\']' if access_key.nil? || access_key == ''
|
14
13
|
|
14
|
+
# non-ipstack api custom optionals
|
15
15
|
@return_raw = optionals[:return_raw]
|
16
16
|
optionals.delete(:return_raw) # remove it from optionals since we each optionals for our url params
|
17
17
|
|
@@ -51,7 +51,7 @@ module Ipstack
|
|
51
51
|
|
52
52
|
def self.bulk(ips, optionals = {})
|
53
53
|
api_request_object = Ipstack::API.new(optionals)
|
54
|
-
raise ArgumentError, 'Requires a list of IPs comma separated as first parameter' if ips.nil? || ips.empty? ||
|
54
|
+
raise ArgumentError, 'Requires a list of IPs comma separated as first parameter' if ips.nil? || ips.empty? || ips.is_a?(Hash) || !( ips.include?(',') && ips.match(/((25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)(,\n|,?$))/) )
|
55
55
|
Ipstack::API.make_request(api_request_object,ips)
|
56
56
|
end
|
57
57
|
|
@@ -63,5 +63,3 @@ module Ipstack
|
|
63
63
|
|
64
64
|
end
|
65
65
|
end
|
66
|
-
|
67
|
-
|
data/lib/ipstack/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ipstack
|
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
|
- Nathan Pierce
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|