airrecord 1.0.10 → 1.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/airrecord/client.rb +3 -6
- data/lib/airrecord/table.rb +2 -2
- data/lib/airrecord/version.rb +1 -1
- metadata +3 -4
- data/lib/airrecord/query_string.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8f0c64c9918dc87febb581a9606e7efd7790f36c9f00d378a0e60ec00478929
|
4
|
+
data.tar.gz: 177f93c0f57ef26ea409f053ff0ead57a31929a2a776fc1cfcfa283bafada909
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd7a540d701aced403ae169892d8c819ebd885e6032bf899d4dba684177d204ca1cd96a0683eab9493c5776a915755ea2ed1855cf9483ced1c6617689f99795e
|
7
|
+
data.tar.gz: 1f136512474cec58ae55f16cd08fc52c58342ef151e0a9200fca10ae9e9681cbff7fa4f0119a5eae7133b2a30ca775b31e98b737c86fbf9f2a36ad08381d4834
|
data/CHANGELOG.md
CHANGED
data/lib/airrecord/client.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
require 'uri'
|
2
|
-
require_relative 'query_string'
|
3
1
|
require_relative 'faraday_rate_limiter'
|
2
|
+
require 'erb'
|
4
3
|
|
5
4
|
module Airrecord
|
6
5
|
class Client
|
@@ -21,9 +20,7 @@ module Airrecord
|
|
21
20
|
headers: {
|
22
21
|
"Authorization" => "Bearer #{api_key}",
|
23
22
|
"User-Agent" => "Airrecord/#{Airrecord::VERSION}",
|
24
|
-
"X-API-VERSION" => "0.1.0",
|
25
23
|
},
|
26
|
-
request: { params_encoder: Airrecord::QueryString }
|
27
24
|
) do |conn|
|
28
25
|
if Airrecord.throttle?
|
29
26
|
conn.request :airrecord_rate_limiter, requests_per_second: AIRTABLE_RPS_LIMIT
|
@@ -32,8 +29,8 @@ module Airrecord
|
|
32
29
|
end
|
33
30
|
end
|
34
31
|
|
35
|
-
def escape(*args)
|
36
|
-
|
32
|
+
def escape(*args)
|
33
|
+
ERB::Util.url_encode(*args)
|
37
34
|
end
|
38
35
|
|
39
36
|
def parse(body)
|
data/lib/airrecord/table.rb
CHANGED
@@ -76,8 +76,8 @@ module Airrecord
|
|
76
76
|
options[:maxRecords] = max_records if max_records
|
77
77
|
options[:pageSize] = page_size if page_size
|
78
78
|
|
79
|
-
path = "/v0/#{base_key}/#{client.escape(table_name)}"
|
80
|
-
response = client.connection.
|
79
|
+
path = "/v0/#{base_key}/#{client.escape(table_name)}/listRecords"
|
80
|
+
response = client.connection.post(path, options.to_json, { 'Content-Type' => 'application/json' })
|
81
81
|
parsed_response = client.parse(response.body)
|
82
82
|
|
83
83
|
if response.success?
|
data/lib/airrecord/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airrecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Eskildsen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -135,7 +135,6 @@ files:
|
|
135
135
|
- lib/airrecord.rb
|
136
136
|
- lib/airrecord/client.rb
|
137
137
|
- lib/airrecord/faraday_rate_limiter.rb
|
138
|
-
- lib/airrecord/query_string.rb
|
139
138
|
- lib/airrecord/table.rb
|
140
139
|
- lib/airrecord/version.rb
|
141
140
|
homepage: https://github.com/sirupsen/airrecord
|
@@ -157,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
156
|
- !ruby/object:Gem::Version
|
158
157
|
version: '0'
|
159
158
|
requirements: []
|
160
|
-
rubygems_version: 3.
|
159
|
+
rubygems_version: 3.2.3
|
161
160
|
signing_key:
|
162
161
|
specification_version: 4
|
163
162
|
summary: Airtable client
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'erb'
|
2
|
-
|
3
|
-
module Airrecord
|
4
|
-
# Airtable expects that arrays in query strings be encoded with indices.
|
5
|
-
# Faraday follows Rack conventions and encodes arrays _without_ indices.
|
6
|
-
#
|
7
|
-
# Airrecord::QueryString is a Faraday-compliant params_encoder that follows
|
8
|
-
# the Airtable spec.
|
9
|
-
module QueryString
|
10
|
-
def self.encode(params)
|
11
|
-
params.map { |key, val| Encodings[val].call(key, val) }.join('&')
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.decode(query)
|
15
|
-
Faraday::NestedParamsEncoder.decode(query)
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.escape(*query)
|
19
|
-
query.map { |qs| ERB::Util.url_encode(qs) }.join('')
|
20
|
-
end
|
21
|
-
|
22
|
-
module Encodings
|
23
|
-
def self.[](value)
|
24
|
-
TYPES.fetch(value.class, DEFAULT)
|
25
|
-
end
|
26
|
-
|
27
|
-
TYPES = {
|
28
|
-
Array => lambda do |prefix, array|
|
29
|
-
array.each_with_index.map do |value, index|
|
30
|
-
self[value].call("#{prefix}[#{index}]", value)
|
31
|
-
end
|
32
|
-
end,
|
33
|
-
Hash => lambda do |prefix, hash|
|
34
|
-
hash.map do |key, value|
|
35
|
-
self[value].call("#{prefix}[#{key}]", value)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
}.freeze
|
39
|
-
|
40
|
-
DEFAULT = lambda do |key, value|
|
41
|
-
"#{QueryString.escape(key)}=#{QueryString.escape(value)}"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|