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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2140fe15354970d81a69ca08eccffeae0b01bdb2b479f90081cca5304438fbd2
4
- data.tar.gz: 76ce4af2fb471aa3a04e95b7e03481c9421120b5a5875afa5c3c1aa9d4b2dc00
3
+ metadata.gz: d8f0c64c9918dc87febb581a9606e7efd7790f36c9f00d378a0e60ec00478929
4
+ data.tar.gz: 177f93c0f57ef26ea409f053ff0ead57a31929a2a776fc1cfcfa283bafada909
5
5
  SHA512:
6
- metadata.gz: f8817c39c254feb9cefe90305193954e689d949014bc348b4d2a053e4b850244781cd571f376e10a5b5f70d3b8db2b1bb6a4ede2eac5758293bb021baaabdc26
7
- data.tar.gz: df2f9499f1cf610bce130acad4d498453bcc6ecb0da2b204eac0ba471132267ec39c4b9449e44ed2a19c05462b871c081aefe332e808d18cb244f41bdad27b25
6
+ metadata.gz: dd7a540d701aced403ae169892d8c819ebd885e6032bf899d4dba684177d204ca1cd96a0683eab9493c5776a915755ea2ed1855cf9483ced1c6617689f99795e
7
+ data.tar.gz: 1f136512474cec58ae55f16cd08fc52c58342ef151e0a9200fca10ae9e9681cbff7fa4f0119a5eae7133b2a30ca775b31e98b737c86fbf9f2a36ad08381d4834
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.0.11
2
+
3
+ * Switch back to default Faraday encoder and change list-records call to POST
4
+
1
5
  # 1.0.10
2
6
 
3
7
  * No longer compatible with Faraday < 1
@@ -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
- QueryString.escape(*args)
32
+ def escape(*args)
33
+ ERB::Util.url_encode(*args)
37
34
  end
38
35
 
39
36
  def parse(body)
@@ -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.get(path, options)
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?
@@ -1,3 +1,3 @@
1
1
  module Airrecord
2
- VERSION = "1.0.10"
2
+ VERSION = "1.0.12"
3
3
  end
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.10
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: 2022-04-24 00:00:00.000000000 Z
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.3.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