Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README_API_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ IP Address Lookups
* **Region**: world
* **SSL support**: yes
* **Languages**: English
* **Documentation**: https://market.mashape.com/fcambus/telize
* **Documentation**: https://rapidapi.com/fcambus/api/telize
* **Terms of Service**: ?
* **Limitations**: ?
* **Notes**: To use Telize set `Geocoder.configure(ip_lookup: :telize, api_key: "your_api_key")`. Or configure your self-hosted telize with the `host` option: `Geocoder.configure(ip_lookup: :telize, telize: {host: "localhost"})`.
Expand Down
2 changes: 1 addition & 1 deletion lib/geocoder/lookups/telize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def query_url(query)
if configuration[:host]
"#{protocol}://#{configuration[:host]}/location/#{query.sanitized_text}"
else
"#{protocol}://telize-v1.p.mashape.com/location/#{query.sanitized_text}?mashape-key=#{api_key}"
"#{protocol}://telize-v1.p.rapidapi.com/location/#{query.sanitized_text}?rapidapi-key=#{api_key}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [105/80]

end
end

Expand Down
2 changes: 1 addition & 1 deletion test/unit/lookup_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def test_geocoder_ca_showpostal
def test_telize_api_key
Geocoder.configure(:api_key => "MY_KEY")
g = Geocoder::Lookup::Telize.new
assert_match "mashape-key=MY_KEY", g.query_url(Geocoder::Query.new("232.65.123.94"))
assert_match "rapidapi-key=MY_KEY", g.query_url(Geocoder::Query.new("232.65.123.94"))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
Metrics/LineLength: Line is too long. [89/80]

end

def test_ipinfo_io_api_key
Expand Down
10 changes: 5 additions & 5 deletions test/unit/lookups/telize_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ def setup
def test_query_url
lookup = Geocoder::Lookup::Telize.new
query = Geocoder::Query.new("74.200.247.59")
assert_match %r{^https://telize-v1\.p\.mashape\.com/location/74\.200\.247\.59}, lookup.query_url(query)
assert_match %r{^https://telize-v1\.p\.rapidapi\.com/location/74\.200\.247\.59}, lookup.query_url(query)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [108/80]

end

def test_includes_api_key_when_set
Geocoder.configure(api_key: "api_key")
lookup = Geocoder::Lookup::Telize.new
query = Geocoder::Query.new("74.200.247.59")
assert_match %r{/location/74\.200\.247\.59\?mashape-key=api_key}, lookup.query_url(query)
assert_match %r{/location/74\.200\.247\.59\?rapidapi-key=api_key}, lookup.query_url(query)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [94/80]

end

def test_uses_custom_host_when_set
Expand All @@ -38,7 +38,7 @@ def test_requires_https_when_not_custom_host
Geocoder.configure(use_https: false)
lookup = Geocoder::Lookup::Telize.new
query = Geocoder::Query.new("74.200.247.59")
assert_match %r{^https://telize-v1\.p\.mashape\.com}, lookup.query_url(query)
assert_match %r{^https://telize-v1\.p\.rapidapi\.com}, lookup.query_url(query)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [82/80]

end

def test_result_on_ip_address_search
Expand Down Expand Up @@ -83,7 +83,7 @@ def test_cache_key_strips_off_query_string
query = Geocoder::Query.new("8.8.8.8")
qurl = lookup.send(:query_url, query)
key = lookup.send(:cache_key, query)
assert qurl.include?("mashape-key")
assert !key.include?("mashape-key")
assert qurl.include?("rapidapi-key")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

assert !key.include?("rapidapi-key")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

end
end