Skip to content

Commit c0ab648

Browse files
authored
Merge pull request #117 from daniel-kovacs-tulip/airtable-custom-endpoint
Custom API endpoint
2 parents 9b1e61a + 853331a commit c0ab648

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/airrecord/client.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,17 @@ def initialize(api_key)
1414
@api_key = api_key
1515
end
1616

17+
def self.api_uri=(uri)
18+
@api_uri = URI.parse(uri)
19+
end
20+
21+
def self.api_uri
22+
@api_uri || URI.parse("https://api.airtable.com")
23+
end
24+
1725
def connection
1826
@connection ||= Faraday.new(
19-
url: "https://api.airtable.com",
27+
url: self.class.api_uri,
2028
headers: {
2129
"Authorization" => "Bearer #{api_key}",
2230
"User-Agent" => "Airrecord/#{Airrecord::VERSION}",
@@ -29,7 +37,7 @@ def connection
2937
end
3038
end
3139

32-
def escape(*args)
40+
def escape(*args)
3341
ERB::Util.url_encode(*args)
3442
end
3543

0 commit comments

Comments
 (0)