Skip to content

feat(repo): update occurrences of .io with .com #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Give it a couple of seconds, and you should receive, posted to the webhook_url s
"event": "render.succeeded",
"renderId": "2cf5ffe2-7736-4d41-8c30-f13e16d35248",
"result": {
"renderUrl": "https://renders.urlbox.io/urlbox1/renders/61431b47b8538a00086c29dd/2021/11/25/e2dcec18-8353-435c-ba17-b549c849eec5.png"
"renderUrl": "https://renders.urlbox.com/urlbox1/renders/61431b47b8538a00086c29dd/2021/11/25/e2dcec18-8353-435c-ba17-b549c849eec5.png"
},
"meta": {
"startTime": "2021-11-25T16:32:32.453Z",
Expand Down Expand Up @@ -203,7 +203,7 @@ payload = {
"event": "render.succeeded",
"renderId": "794383cd-b09e-4aef-a12b-fadf8aad9d63",
"result": {
"renderUrl": "https://renders.urlbox.io/urlbox1/renders/foo.png"
"renderUrl": "https://renders.urlbox.com/urlbox1/renders/foo.png"
},
"meta": {
"startTime": "2021-11-24T16:49:48.307Z",
Expand Down
2 changes: 1 addition & 1 deletion lib/urlbox/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module Urlbox
class Client
BASE_API_URL = 'https://api.urlbox.io/v1/'.freeze
BASE_API_URL = 'https://api.urlbox.com/v1/'.freeze
POST_END_POINT = 'render'.freeze

def initialize(api_key: nil, api_secret: nil, api_host_name: nil)
Expand Down
34 changes: 17 additions & 17 deletions test/test_urlbox_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_api_secret_provided_and_env_var_is_set

def test_api_host_name_provided
param_api_key = 'PARAM_KEY'
api_host_name = ['api-eu.urlbox.io', 'api-direct.urlbox.io'].sample
api_host_name = ['api-eu.urlbox.com', 'api-direct.urlbox.com'].sample

urlbox_client = Urlbox::Client.new(api_key: param_api_key, api_host_name: api_host_name)

Expand Down Expand Up @@ -96,7 +96,7 @@ def test_successful_get_request
param_api_key = 'KEY'
options = { url: 'https://www.example.com' }

stub_request(:get, "https://api.urlbox.io/v1/#{param_api_key}/png?format=png&url=https://www.example.com")
stub_request(:get, "https://api.urlbox.com/v1/#{param_api_key}/png?format=png&url=https://www.example.com")
.to_return(status: 200, body: '', headers: { 'content-type': 'image/png' })

urlbox_client = Urlbox::Client.new(api_key: param_api_key)
Expand All @@ -111,7 +111,7 @@ def test_successful_get_request_no_schema_url
param_api_key = 'KEY'
options = { url: 'www.example.com' }

stub_request(:get, "https://api.urlbox.io/v1/#{param_api_key}/png?format=png&url=http://www.example.com")
stub_request(:get, "https://api.urlbox.com/v1/#{param_api_key}/png?format=png&url=http://www.example.com")
.to_return(status: 200, body: '', headers: {})

urlbox_client = Urlbox::Client.new(api_key: param_api_key)
Expand Down Expand Up @@ -154,7 +154,7 @@ def test_successful_get_request_authenticated
url_encoded_options = URI.encode_www_form(options)
token = OpenSSL::HMAC.hexdigest('sha1', api_secret.encode('UTF-8'), url_encoded_options.encode('UTF-8'))

stub_request(:get, "https://api.urlbox.io/v1/KEY/#{token}/png?format=png&url=https://www.example.com")
stub_request(:get, "https://api.urlbox.com/v1/KEY/#{token}/png?format=png&url=https://www.example.com")
.to_return(status: 200, body: '', headers: { 'content-type': 'image/png' })

urlbox_client = Urlbox::Client.new(api_key: api_key, api_secret: api_secret)
Expand All @@ -169,7 +169,7 @@ def test_successful_get_request_options_with_string_keys
param_api_key = 'KEY'
options = { 'url' => 'https://www.example.com' }

stub_request(:get, "https://api.urlbox.io/v1/#{param_api_key}/png?format=png&url=https://www.example.com")
stub_request(:get, "https://api.urlbox.com/v1/#{param_api_key}/png?format=png&url=https://www.example.com")
.to_return(status: 200, body: '', headers: { 'content-type': 'image/png' })

urlbox_client = Urlbox::Client.new(api_key: param_api_key)
Expand All @@ -189,7 +189,7 @@ def test_get_with_header_array_in_options

urlbox_client = Urlbox::Client.new(api_key: api_key)

stub_request(:get, "https://api.urlbox.io/v1/KEY/png?format=png&header=x-my-second-header=someothervalue&url=https://www.example.com")
stub_request(:get, "https://api.urlbox.com/v1/KEY/png?format=png&header=x-my-second-header=someothervalue&url=https://www.example.com")
.to_return(status: 200, body: "", headers: {})

response = urlbox_client.get(options)
Expand All @@ -202,7 +202,7 @@ def test_delete_request
api_key = 'KEY'
options = { url: 'https://www.example.com' }

stub_request(:delete, 'https://api.urlbox.io/v1/KEY/png?format=png&url=https://www.example.com')
stub_request(:delete, 'https://api.urlbox.com/v1/KEY/png?format=png&url=https://www.example.com')
.to_return(status: 200, body: '', headers: {})

urlbox_client = Urlbox::Client.new(api_key: api_key)
Expand All @@ -225,7 +225,7 @@ def test_head_request
width: [500, 700].sample
}

stub_request(:head, "https://api.urlbox.io/v1/#{api_key}/#{format}?format=#{format}&full_page=#{options[:full_page]}&url=#{url}&width=#{options[:width]}")
stub_request(:head, "https://api.urlbox.com/v1/#{api_key}/#{format}?format=#{format}&full_page=#{options[:full_page]}&url=#{url}&width=#{options[:width]}")
.to_return(status: 200, body: '', headers: {})

urlbox_client = Urlbox::Client.new(api_key: api_key)
Expand All @@ -244,7 +244,7 @@ def test_post_request_successful
webhook_url: 'https://www.example.com/webhook'
}

stub_request(:post, 'https://api.urlbox.io/v1/render')
stub_request(:post, 'https://api.urlbox.com/v1/render')
.with(
body: "{\"url\":\"https://www.example.com\",\"webhook_url\":\"https://www.example.com/webhook\",\"format\":\"png\"}",
headers: {
Expand All @@ -265,7 +265,7 @@ def test_post_request_successful_warning_missing_webhook_url
api_secret = 'SECRET'
options = { url: 'https://www.example.com' }

stub_request(:post, 'https://api.urlbox.io/v1/render')
stub_request(:post, 'https://api.urlbox.com/v1/render')
.with(
body: "{\"url\":\"https://www.example.com\",\"format\":\"png\"}",
headers: {
Expand Down Expand Up @@ -307,7 +307,7 @@ def test_generate_url_with_only_api_key

urlbox_url = urlbox_client.generate_url(options)

assert_equal 'https://api.urlbox.io/v1/KEY/png?url=https%3A%2F%2Fwww.example.com&format=png', urlbox_url
assert_equal 'https://api.urlbox.com/v1/KEY/png?url=https%3A%2F%2Fwww.example.com&format=png', urlbox_url
end

def test_generate_url_with_api_key_and_secret
Expand All @@ -321,7 +321,7 @@ def test_generate_url_with_api_key_and_secret

urlbox_url = urlbox_client.generate_url(options)

assert_equal "https://api.urlbox.io/v1/KEY/#{token}/png?url=https%3A%2F%2Fwww.example.com&format=png", urlbox_url
assert_equal "https://api.urlbox.com/v1/KEY/#{token}/png?url=https%3A%2F%2Fwww.example.com&format=png", urlbox_url
end

# test module like methods
Expand All @@ -331,7 +331,7 @@ def test_successful_class_get_request
options = { url: 'https://www.example.com' }

ClimateControl.modify URLBOX_API_KEY: env_var_api_key do
stub_request(:get, "https://api.urlbox.io/v1/#{env_var_api_key}/png?format=png&url=https://www.example.com")
stub_request(:get, "https://api.urlbox.com/v1/#{env_var_api_key}/png?format=png&url=https://www.example.com")
.to_return(status: 200, body: '', headers: { 'content-type': 'image/png' })

response = Urlbox::Client.get(options)
Expand All @@ -347,7 +347,7 @@ def test_successful_class_delete_request
options = { url: 'https://www.example.com' }

ClimateControl.modify URLBOX_API_KEY: env_var_api_key do
stub_request(:delete, "https://api.urlbox.io/v1/#{env_var_api_key}/png?format=png&url=https://www.example.com")
stub_request(:delete, "https://api.urlbox.com/v1/#{env_var_api_key}/png?format=png&url=https://www.example.com")
.to_return(status: 200, body: '', headers: { 'content-type': 'image/png' })

response = Urlbox::Client.delete(options)
Expand All @@ -363,7 +363,7 @@ def test_successful_class_head_request
options = { url: 'https://www.example.com' }

ClimateControl.modify URLBOX_API_KEY: env_var_api_key do
stub_request(:head, "https://api.urlbox.io/v1/#{env_var_api_key}/png?format=png&url=https://www.example.com")
stub_request(:head, "https://api.urlbox.com/v1/#{env_var_api_key}/png?format=png&url=https://www.example.com")
.to_return(status: 200, body: '', headers: { 'content-type': 'image/png' })

response = Urlbox::Client.head(options)
Expand All @@ -383,7 +383,7 @@ def test_successful_class_post_request
}

ClimateControl.modify URLBOX_API_KEY: api_key, URLBOX_API_SECRET: api_secret do
stub_request(:post, 'https://api.urlbox.io/v1/render')
stub_request(:post, 'https://api.urlbox.com/v1/render')
.with(
body: "{\"url\":\"https://www.example.com\",\"webhook_url\":\"https://www.example.com/webhook\",\"format\":\"png\"}",
headers: {
Expand All @@ -406,7 +406,7 @@ def test_successful_class_generate_url
ClimateControl.modify URLBOX_API_KEY: env_var_api_key do
urlbox_url = Urlbox::Client.generate_url(options)

assert_equal 'https://api.urlbox.io/v1/KEY/png?url=https%3A%2F%2Fwww.example.com&format=png', urlbox_url
assert_equal 'https://api.urlbox.com/v1/KEY/png?url=https%3A%2F%2Fwww.example.com&format=png', urlbox_url
end
end
end
Expand Down
Loading