airmodel 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +3 -95
- data/airmodel.gemspec +2 -2
- data/lib/airmodel.rb +5 -1
- data/lib/airmodel/model.rb +5 -0
- data/lib/airmodel/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 38fb24252a7aa3cf071c5eb05fedfe36242c47dfd2b83a577e9be5ba82e17112
|
4
|
+
data.tar.gz: 65faa96697028ae3fa8a9d5b49a9088e5906039d2a9c4d94e522ec6092adacc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcaeca5b660d6baec46239327c7ead2c1f393bf3c6ed4b05f19ba6d859c69bca2cebad22d5407a2b391667c1ffab84f92c685227dd3d4bcad0656f4bb5c75e26
|
7
|
+
data.tar.gz: d4e48159115c9984947b86dcc05ae4743b132a505828b769e229718dcc676a1bacebbef66398ac1579680ac237b277b5a81d0b0ad6bc8e6b56b7e70e04c9961f
|
data/README.md
CHANGED
@@ -1,96 +1,4 @@
|
|
1
|
-
Airmodel
|
2
|
-
|
3
|
-
|
4
|
-
Interact with your Airtable data using ActiveRecord-style models.
|
5
|
-
|
6
|
-
Installation
|
7
|
-
----------------
|
8
|
-
|
9
|
-
Add this line to your Gemfile:
|
10
|
-
|
11
|
-
gem install 'airmodel'
|
12
|
-
|
13
|
-
Configuration
|
14
|
-
----------------
|
15
|
-
1. Supply your Airtable API key, either by setting ENV['AIRTABLE_API_KEY']
|
16
|
-
before your app starts...
|
17
|
-
|
18
|
-
ENV['AIRTABLE_API_KEY'] = YOUR_API_KEY
|
19
|
-
|
20
|
-
... or by putting this line somewhere in your app's init block:
|
21
|
-
|
22
|
-
Airmodel.client(YOUR_API_KEY_HERE)
|
23
|
-
|
24
|
-
2. Tell Airmodel where your bases are, either by creating a YAML file at
|
25
|
-
*config/bases.yml*, or with this line somewhere in your init block:
|
26
|
-
|
27
|
-
Airmodel.bases(path_to_your_yaml_file)
|
28
|
-
|
29
|
-
Your YAML file should look something like this:
|
30
|
-
|
31
|
-
:songs:
|
32
|
-
:table_name: Songs
|
33
|
-
:base_id: appXYZ123ABC
|
34
|
-
:albums:
|
35
|
-
:table_name: Albums
|
36
|
-
:base_id: appZZTOPETC
|
37
|
-
|
38
|
-
|
39
|
-
Usage
|
40
|
-
----------------
|
41
|
-
|
42
|
-
Create a class for each key in your YAML file. You should name it after the
|
43
|
-
singularized version of your YAML key:
|
44
|
-
|
45
|
-
class Song < Airmodel::Model
|
46
|
-
end
|
47
|
-
|
48
|
-
class Album < Airmodel::Model
|
49
|
-
end
|
50
|
-
|
51
|
-
Now you can write code like
|
52
|
-
|
53
|
-
Song.all
|
54
|
-
|
55
|
-
Song.where("Artist Name" => "The Beatles", "Composer" => "Harrison")
|
56
|
-
|
57
|
-
Song.search(:q => "Let it Be", fields: ["Name", "Album"])
|
58
|
-
|
59
|
-
Song.first
|
60
|
-
|
61
|
-
Song.new("Name": "Best Song Ever").save
|
62
|
-
|
63
|
-
Song.find("recXYZ")
|
64
|
-
|
65
|
-
Song.find_by("Composer" => "Harrison")
|
66
|
-
|
67
|
-
|
68
|
-
Queries are chainable, e.g.
|
69
|
-
|
70
|
-
Song.where("rating" => 5).where('Artist' => "Fiona Apple").order("rating", "DESC").limit(5)
|
71
|
-
|
72
|
-
There's also a `Model.by_formula` query, which lets you pass explicit
|
73
|
-
[Airtable
|
74
|
-
Formulas](https://support.airtable.com/hc/en-us/articles/203255215-Formula-field-reference)
|
75
|
-
|
76
|
-
You can chain `.limit` and `.order` with a `.by_forumla` query.
|
77
|
-
|
78
|
-
Song.by_formula("NOT({Rating} < 3)").order("rating", "DESC").limit(5)
|
79
|
-
|
80
|
-
See `lib/airmodel/model.rb` for all model methods, and
|
81
|
-
`lib/airmodel/query.rb` for all Query methods.
|
82
|
-
|
83
|
-
|
84
|
-
Contributions
|
85
|
-
----------------
|
86
|
-
|
87
|
-
I'm currently testing against a live Airtable base, because stubbing API
|
88
|
-
calls has occasionally yielded false positives in my specs. To run the tests,
|
89
|
-
create an Airtable account, set `AIRTABLE_API_KEY=[your API key]` in your `.env` file, and
|
90
|
-
then visit [this link](https://airtable.com/invite/l?inviteId=invj96HyFOB6GF8Vq&inviteToken=2e98eff03a646162344bb997a06645e3)
|
91
|
-
to request access to the base.
|
92
|
-
|
93
|
-
Once that's all set, write a passing test for your feature and send a pull request.
|
94
|
-
|
95
|
-
Thanks!
|
1
|
+
Airmodel (no longer maintained)
|
2
|
+
===============================
|
96
3
|
|
4
|
+
Airmodel is no longer maintained. Please use [Airrecord](https://github.com/sirupsen/airrecord) instead.
|
data/airmodel.gemspec
CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.version = Airmodel::VERSION
|
8
8
|
spec.authors = ['chrisfrankdotfm']
|
9
9
|
spec.email = ['chris.frank@thefutureproject.org']
|
10
|
-
spec.description = '
|
11
|
-
spec.summary = '
|
10
|
+
spec.description = 'End-of-life, please use airrecord instead'
|
11
|
+
spec.summary = 'End-of-life, please use airrecord instead'
|
12
12
|
spec.homepage = 'https://github.com/chrisfrank/airmodel'
|
13
13
|
spec.license = 'MIT'
|
14
14
|
|
data/lib/airmodel.rb
CHANGED
@@ -9,7 +9,6 @@ require "airmodel/model"
|
|
9
9
|
|
10
10
|
# builds ActiveRecord-style models on top of Airtable
|
11
11
|
module Airmodel
|
12
|
-
|
13
12
|
def self.root
|
14
13
|
File.expand_path '../..', __FILE__
|
15
14
|
end
|
@@ -24,4 +23,9 @@ module Airmodel
|
|
24
23
|
@@bases
|
25
24
|
end
|
26
25
|
|
26
|
+
def self.warn
|
27
|
+
Kernel.warn "Airmodel is no longer maintained. Please migrate to Airrecord (https://rubygems.org/gems/airrecord)"
|
28
|
+
end
|
27
29
|
end
|
30
|
+
|
31
|
+
Airmodel.warn
|
data/lib/airmodel/model.rb
CHANGED
data/lib/airmodel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airmodel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chrisfrankdotfm
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '5'
|
139
|
-
description:
|
139
|
+
description: End-of-life, please use airrecord instead
|
140
140
|
email:
|
141
141
|
- chris.frank@thefutureproject.org
|
142
142
|
executables: []
|
@@ -180,8 +180,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
180
|
version: '0'
|
181
181
|
requirements: []
|
182
182
|
rubyforge_project:
|
183
|
-
rubygems_version: 2.
|
183
|
+
rubygems_version: 2.7.6
|
184
184
|
signing_key:
|
185
185
|
specification_version: 4
|
186
|
-
summary:
|
186
|
+
summary: End-of-life, please use airrecord instead
|
187
187
|
test_files: []
|