airrecord 1.0.0 → 1.0.1
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/README.md +3 -1
- data/airrecord.gemspec +1 -0
- data/lib/airrecord/query_string.rb +0 -2
- data/lib/airrecord/table.rb +11 -10
- data/lib/airrecord/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 534c1f26e6248221487da3863fd700cb426b937cf26ece866a56c453f2bb70e9
|
4
|
+
data.tar.gz: dcfd2eaae567f63143fb2e2a4148faad1fd142bad54a16e3c9791b225c350b08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef4e7f2a364a4a489c6eed6f7750855e118afcab19f1511bda87217a252b7d1f0a8bce1669aaf3ced875c4ea76c0629052ea2fbfec2dcf3e10e0320e789ff9d0
|
7
|
+
data.tar.gz: 2845f143db4a202f050c5382a4b2596296ef725a40004ddc779e35e74d78ba025914c3294411043ddfcbd8351d045368c0dcfdc1bfc87c87dcefe7d6d76bc7ed
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,9 @@
|
|
3
3
|
Airrecord is an alternative Airtable Ruby libary to
|
4
4
|
[`airtable-ruby`](https://github.com/airtable/airtable-ruby). Airrecord attempts
|
5
5
|
to enforce a more [database-like API to
|
6
|
-
Airtable](http://sirupsen.com/minimum-viable-airtable/).
|
6
|
+
Airtable](http://sirupsen.com/minimum-viable-airtable/). However, there's also
|
7
|
+
an [ad-hoc API available](https://github.com/sirupsen/airrecord#ad-hoc-api) that
|
8
|
+
skips the class definitions!
|
7
9
|
|
8
10
|
You can add this line to your Gemfile to use Airrecord:
|
9
11
|
|
data/airrecord.gemspec
CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.bindir = "exe"
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
|
+
spec.required_ruby_version = '>= 2.2'
|
21
22
|
|
22
23
|
spec.add_dependency 'faraday', '~> 0.10'
|
23
24
|
spec.add_dependency "net-http-persistent", '~> 2.9'
|
data/lib/airrecord/table.rb
CHANGED
@@ -1,13 +1,18 @@
|
|
1
1
|
module Airrecord
|
2
2
|
class Table
|
3
3
|
class << self
|
4
|
-
attr_accessor :base_key, :table_name
|
4
|
+
attr_accessor :base_key, :table_name
|
5
|
+
attr_writer :api_key
|
5
6
|
|
6
7
|
def client
|
7
8
|
@@clients ||= {}
|
8
9
|
@@clients[api_key] ||= Client.new(api_key)
|
9
10
|
end
|
10
11
|
|
12
|
+
def api_key
|
13
|
+
defined?(@api_key) ? @api_key : Airrecord.api_key
|
14
|
+
end
|
15
|
+
|
11
16
|
def has_many(method_name, options)
|
12
17
|
define_method(method_name.to_sym) do
|
13
18
|
# Get association ids in reverse order, because Airtable’s UI and API
|
@@ -28,10 +33,6 @@ module Airrecord
|
|
28
33
|
|
29
34
|
alias has_one belongs_to
|
30
35
|
|
31
|
-
def api_key
|
32
|
-
@api_key || Airrecord.api_key
|
33
|
-
end
|
34
|
-
|
35
36
|
def find(id)
|
36
37
|
response = client.connection.get("/v0/#{base_key}/#{client.escape(table_name)}/#{id}")
|
37
38
|
parsed_response = client.parse(response.body)
|
@@ -208,11 +209,11 @@ module Airrecord
|
|
208
209
|
|
209
210
|
def validate_key(key)
|
210
211
|
return true unless key.is_a?(Symbol)
|
211
|
-
raise
|
212
|
-
Airrecord 1.0 dropped support for Symbols as field names.
|
213
|
-
Please use the
|
214
|
-
You might try: record['#{key.to_s.
|
215
|
-
|
212
|
+
raise(Error, [
|
213
|
+
"Airrecord 1.0 dropped support for Symbols as field names.",
|
214
|
+
"Please use the raw field name, a String, instead.",
|
215
|
+
"You might try: record['#{key.to_s.tr('_', ' ')}']"
|
216
|
+
].join("\n"))
|
216
217
|
end
|
217
218
|
end
|
218
219
|
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Eskildsen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -129,7 +129,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
129
|
requirements:
|
130
130
|
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: '
|
132
|
+
version: '2.2'
|
133
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
135
|
- - ">="
|