airtable2 0.2.1 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,270 +0,0 @@
1
- <!DOCTYPE html>
2
- <html >
3
- <head>
4
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
5
- <meta charset="utf-8" />
6
-
7
- <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" />
8
-
9
- <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" />
10
-
11
-
12
-
13
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
14
-
15
- <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
-
17
-
18
- <title>Method List</title>
19
- <base id="base_target" target="_parent" />
20
- </head>
21
- <body>
22
- <div id="content">
23
- <div class="fixed_header">
24
- <h1 id="full_list_header">Method List</h1>
25
- <div id="full_list_nav">
26
-
27
- <span><a target="_self" href="class_list.html">
28
- Classes
29
- </a></span>
30
-
31
- <span><a target="_self" href="method_list.html">
32
- Methods
33
- </a></span>
34
-
35
- <span><a target="_self" href="file_list.html">
36
- Files
37
- </a></span>
38
-
39
- </div>
40
-
41
- <div id="search">
42
- <label for="search-class">Search:</label>
43
- <input id="search-class" type="text" />
44
- </div>
45
- </div>
46
-
47
- <ul id="full_list" class="method">
48
-
49
-
50
- <li class="odd ">
51
- <div class="item">
52
- <span class='object_link'><a href="Airtable/Table.html#add_records-instance_method" title="Airtable::Table#add_records (method)">#add_records</a></span>
53
- <small>Airtable::Table</small>
54
- </div>
55
- </li>
56
-
57
-
58
- <li class="even ">
59
- <div class="item">
60
- <span class='object_link'><a href="Airtable/Client.html#base-instance_method" title="Airtable::Client#base (method)">#base</a></span>
61
- <small>Airtable::Client</small>
62
- </div>
63
- </li>
64
-
65
-
66
- <li class="odd ">
67
- <div class="item">
68
- <span class='object_link'><a href="Airtable/Base.html#base_url-instance_method" title="Airtable::Base#base_url (method)">#base_url</a></span>
69
- <small>Airtable::Base</small>
70
- </div>
71
- </li>
72
-
73
-
74
- <li class="even ">
75
- <div class="item">
76
- <span class='object_link'><a href="Airtable/Client.html#bases-instance_method" title="Airtable::Client#bases (method)">#bases</a></span>
77
- <small>Airtable::Client</small>
78
- </div>
79
- </li>
80
-
81
-
82
- <li class="odd ">
83
- <div class="item">
84
- <span class='object_link'><a href="Airtable/Resource.html#check_and_raise_error-instance_method" title="Airtable::Resource#check_and_raise_error (method)">#check_and_raise_error</a></span>
85
- <small>Airtable::Resource</small>
86
- </div>
87
- </li>
88
-
89
-
90
- <li class="even ">
91
- <div class="item">
92
- <span class='object_link'><a href="Airtable/Base.html#create_table-instance_method" title="Airtable::Base#create_table (method)">#create_table</a></span>
93
- <small>Airtable::Base</small>
94
- </div>
95
- </li>
96
-
97
-
98
- <li class="odd ">
99
- <div class="item">
100
- <span class='object_link'><a href="Airtable/Table.html#delete_records-instance_method" title="Airtable::Table#delete_records (method)">#delete_records</a></span>
101
- <small>Airtable::Table</small>
102
- </div>
103
- </li>
104
-
105
-
106
- <li class="even ">
107
- <div class="item">
108
- <span class='object_link'><a href="Airtable/Table.html#dump-instance_method" title="Airtable::Table#dump (method)">#dump</a></span>
109
- <small>Airtable::Table</small>
110
- </div>
111
- </li>
112
-
113
-
114
- <li class="odd ">
115
- <div class="item">
116
- <span class='object_link'><a href="Airtable/Record.html#fields-instance_method" title="Airtable::Record#fields (method)">#fields</a></span>
117
- <small>Airtable::Record</small>
118
- </div>
119
- </li>
120
-
121
-
122
- <li class="even ">
123
- <div class="item">
124
- <span class='object_link'><a href="Airtable/Resource.html#id-instance_method" title="Airtable::Resource#id (method)">#id</a></span>
125
- <small>Airtable::Resource</small>
126
- </div>
127
- </li>
128
-
129
-
130
- <li class="odd ">
131
- <div class="item">
132
- <span class='object_link'><a href="Airtable/Base.html#initialize-instance_method" title="Airtable::Base#initialize (method)">#initialize</a></span>
133
- <small>Airtable::Base</small>
134
- </div>
135
- </li>
136
-
137
-
138
- <li class="even ">
139
- <div class="item">
140
- <span class='object_link'><a href="Airtable/Table.html#initialize-instance_method" title="Airtable::Table#initialize (method)">#initialize</a></span>
141
- <small>Airtable::Table</small>
142
- </div>
143
- </li>
144
-
145
-
146
- <li class="odd ">
147
- <div class="item">
148
- <span class='object_link'><a href="Airtable/Resource.html#initialize-instance_method" title="Airtable::Resource#initialize (method)">#initialize</a></span>
149
- <small>Airtable::Resource</small>
150
- </div>
151
- </li>
152
-
153
-
154
- <li class="even ">
155
- <div class="item">
156
- <span class='object_link'><a href="Airtable/Client.html#initialize-instance_method" title="Airtable::Client#initialize (method)">#initialize</a></span>
157
- <small>Airtable::Client</small>
158
- </div>
159
- </li>
160
-
161
-
162
- <li class="odd ">
163
- <div class="item">
164
- <span class='object_link'><a href="Airtable/Record.html#initialize-instance_method" title="Airtable::Record#initialize (method)">#initialize</a></span>
165
- <small>Airtable::Record</small>
166
- </div>
167
- </li>
168
-
169
-
170
- <li class="even ">
171
- <div class="item">
172
- <span class='object_link'><a href="Airtable/Error.html#initialize-instance_method" title="Airtable::Error#initialize (method)">#initialize</a></span>
173
- <small>Airtable::Error</small>
174
- </div>
175
- </li>
176
-
177
-
178
- <li class="odd ">
179
- <div class="item">
180
- <span class='object_link'><a href="Airtable/Error.html#message-instance_method" title="Airtable::Error#message (method)">#message</a></span>
181
- <small>Airtable::Error</small>
182
- </div>
183
- </li>
184
-
185
-
186
- <li class="even ">
187
- <div class="item">
188
- <span class='object_link'><a href="Airtable/Table.html#name-instance_method" title="Airtable::Table#name (method)">#name</a></span>
189
- <small>Airtable::Table</small>
190
- </div>
191
- </li>
192
-
193
-
194
- <li class="odd ">
195
- <div class="item">
196
- <span class='object_link'><a href="Airtable/Table.html#record-instance_method" title="Airtable::Table#record (method)">#record</a></span>
197
- <small>Airtable::Table</small>
198
- </div>
199
- </li>
200
-
201
-
202
- <li class="even ">
203
- <div class="item">
204
- <span class='object_link'><a href="Airtable/Table.html#records-instance_method" title="Airtable::Table#records (method)">#records</a></span>
205
- <small>Airtable::Table</small>
206
- </div>
207
- </li>
208
-
209
-
210
- <li class="odd ">
211
- <div class="item">
212
- <span class='object_link'><a href="Airtable/Base.html#table-instance_method" title="Airtable::Base#table (method)">#table</a></span>
213
- <small>Airtable::Base</small>
214
- </div>
215
- </li>
216
-
217
-
218
- <li class="even ">
219
- <div class="item">
220
- <span class='object_link'><a href="Airtable/Table.html#table_url-instance_method" title="Airtable::Table#table_url (method)">#table_url</a></span>
221
- <small>Airtable::Table</small>
222
- </div>
223
- </li>
224
-
225
-
226
- <li class="odd ">
227
- <div class="item">
228
- <span class='object_link'><a href="Airtable/Base.html#tables-instance_method" title="Airtable::Base#tables (method)">#tables</a></span>
229
- <small>Airtable::Base</small>
230
- </div>
231
- </li>
232
-
233
-
234
- <li class="even ">
235
- <div class="item">
236
- <span class='object_link'><a href="Airtable/Resource.html#token-instance_method" title="Airtable::Resource#token (method)">#token</a></span>
237
- <small>Airtable::Resource</small>
238
- </div>
239
- </li>
240
-
241
-
242
- <li class="odd ">
243
- <div class="item">
244
- <span class='object_link'><a href="Airtable/Error.html#type-instance_method" title="Airtable::Error#type (method)">#type</a></span>
245
- <small>Airtable::Error</small>
246
- </div>
247
- </li>
248
-
249
-
250
- <li class="even ">
251
- <div class="item">
252
- <span class='object_link'><a href="Airtable/Table.html#update-instance_method" title="Airtable::Table#update (method)">#update</a></span>
253
- <small>Airtable::Table</small>
254
- </div>
255
- </li>
256
-
257
-
258
- <li class="odd ">
259
- <div class="item">
260
- <span class='object_link'><a href="Airtable/Client.html#whoami-instance_method" title="Airtable::Client#whoami (method)">#whoami</a></span>
261
- <small>Airtable::Client</small>
262
- </div>
263
- </li>
264
-
265
-
266
-
267
- </ul>
268
- </div>
269
- </body>
270
- </html>
@@ -1,110 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>
7
- Top Level Namespace
8
-
9
- &mdash; Documentation by YARD 0.9.37
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="css/style.css" type="text/css" />
14
-
15
- <link rel="stylesheet" href="css/common.css" type="text/css" />
16
-
17
- <script type="text/javascript">
18
- pathId = "";
19
- relpath = '';
20
- </script>
21
-
22
-
23
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
-
25
- <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
-
27
-
28
- </head>
29
- <body>
30
- <div class="nav_wrap">
31
- <iframe id="nav" src="class_list.html?1"></iframe>
32
- <div id="resizer"></div>
33
- </div>
34
-
35
- <div id="main" tabindex="-1">
36
- <div id="header">
37
- <div id="menu">
38
-
39
- <a href="_index.html">Index</a> &raquo;
40
-
41
-
42
- <span class="title">Top Level Namespace</span>
43
-
44
- </div>
45
-
46
- <div id="search">
47
-
48
- <a class="full_list_link" id="class_list_link"
49
- href="class_list.html">
50
-
51
- <svg width="24" height="24">
52
- <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
- <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
- <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
- </svg>
56
- </a>
57
-
58
- </div>
59
- <div class="clear"></div>
60
- </div>
61
-
62
- <div id="content"><h1>Top Level Namespace
63
-
64
-
65
-
66
- </h1>
67
- <div class="box_info">
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
- </div>
80
-
81
- <h2>Defined Under Namespace</h2>
82
- <p class="children">
83
-
84
-
85
- <strong class="modules">Modules:</strong> <span class='object_link'><a href="Airtable.html" title="Airtable (module)">Airtable</a></span>
86
-
87
-
88
-
89
-
90
- </p>
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
- </div>
101
-
102
- <div id="footer">
103
- Generated on Fri Oct 25 21:49:51 2024 by
104
- <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
- 0.9.37 (ruby-3.3.5).
106
- </div>
107
-
108
- </div>
109
- </body>
110
- </html>
@@ -1,82 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- describe Airtable do
6
- before do
7
- @client_key = '12345'
8
- @app_key = 'appXXV84Qu'
9
- @sheet_name = 'Test'
10
- end
11
-
12
- describe 'with Airtable' do
13
- it 'should allow client to be created' do
14
- @client = Airtable::Client.new(@client_key)
15
-
16
- assert_kind_of Airtable::Client, @client
17
- @table = @client.table(@app_key, @sheet_name)
18
-
19
- assert_kind_of Airtable::Table, @table
20
- end
21
-
22
- it 'should fetch record set' do
23
- stub_airtable_response!("https://api.airtable.com/v0/#{@app_key}/#{@sheet_name}",
24
- { 'records' => [], 'offset' => 'abcde' })
25
- @table = Airtable::Client.new(@client_key).table(@app_key, @sheet_name)
26
- @records = @table.records
27
-
28
- assert_equal 'abcde', @records.offset
29
- end
30
-
31
- it 'should select records based on a formula' do
32
- query_str = "OR(RECORD_ID() = 'recXYZ1', RECORD_ID() = 'recXYZ2', RECORD_ID() = 'recXYZ3', RECORD_ID() = 'recXYZ4')"
33
- escaped_query = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER.call(filterByFormula: query_str)
34
- request_url = "https://api.airtable.com/v0/#{@app_key}/#{@sheet_name}?#{escaped_query}"
35
- stub_airtable_response!(request_url, { 'records' => [] })
36
- @table = Airtable::Client.new(@client_key).table(@app_key, @sheet_name)
37
- @select_records = @table.select(formula: query_str)
38
-
39
- assert_empty @select_records.records
40
- end
41
-
42
- it 'should raise an ArgumentError if a formula is not a string' do
43
- stub_airtable_response!("https://api.airtable.com/v0/#{@app_key}/#{@sheet_name}",
44
- { 'records' => [], 'offset' => 'abcde' })
45
- @table = Airtable::Client.new(@client_key).table(@app_key, @sheet_name)
46
- _ { proc { @table.select(formula: { foo: 'bar' }) } }.must_raise ArgumentError
47
- end
48
-
49
- it 'should allow creating records' do
50
- stub_airtable_response!("https://api.airtable.com/v0/#{@app_key}/#{@sheet_name}",
51
- { 'fields' => { 'name' => 'Sarah Jaine', 'email' => 'sarah@jaine.com', 'foo' => 'bar' }, 'id' => '12345' }, :post)
52
- table = Airtable::Client.new(@client_key).table(@app_key, @sheet_name)
53
- record = Airtable::Record.new(name: 'Sarah Jaine', email: 'sarah@jaine.com')
54
- table.create(record)
55
-
56
- assert_equal '12345', record['id']
57
- assert_equal 'bar', record['foo']
58
- end
59
-
60
- it 'should allow updating records' do
61
- record_id = '12345'
62
- stub_airtable_response!("https://api.airtable.com/v0/#{@app_key}/#{@sheet_name}/#{record_id}",
63
- { 'fields' => { 'name' => 'Sarah Jaine', 'email' => 'sarah@jaine.com', 'foo' => 'bar' }, 'id' => record_id }, :put)
64
- table = Airtable::Client.new(@client_key).table(@app_key, @sheet_name)
65
- record = Airtable::Record.new(name: 'Sarah Jaine', email: 'sarah@jaine.com', id: record_id)
66
- table.update(record)
67
-
68
- assert_equal '12345', record['id']
69
- assert_equal 'bar', record['foo']
70
- end
71
-
72
- it 'should raise an error when the API returns an error' do
73
- stub_airtable_response!("https://api.airtable.com/v0/#{@app_key}/#{@sheet_name}",
74
- { 'error' => { 'type' => 'UNKNOWN_COLUMN_NAME', 'message' => 'Could not find fields foo' } }, :post, 422)
75
- table = Airtable::Client.new(@client_key).table(@app_key, @sheet_name)
76
- record = Airtable::Record.new(foo: 'bar')
77
- assert_raises Airtable::Error do
78
- table.create(record)
79
- end
80
- end
81
- end
82
- end
data/test/record_test.rb DELETED
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- describe Airtable do
6
- describe Airtable::Record do
7
- it 'should not return id in fields_for_update' do
8
- record = Airtable::Record.new(name: 'Sarah Jaine', email: 'sarah@jaine.com', id: 12_345)
9
- _(record.fields_for_update).wont_include(:id)
10
- end
11
-
12
- it 'returns new columns in fields_for_update' do
13
- record = Airtable::Record.new(name: 'Sarah Jaine', email: 'sarah@jaine.com', id: 12_345)
14
- record[:website] = 'http://sarahjaine.com'
15
- _(record.fields_for_update).must_include(:website)
16
- end
17
-
18
- it 'returns fields_for_update in original capitalization' do
19
- record = Airtable::Record.new('Name' => 'Sarah Jaine')
20
- _(record.fields_for_update).must_include('Name')
21
- end
22
- end
23
- end
data/test/test_helper.rb DELETED
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'airtable'
4
- require 'webmock/minitest'
5
- require 'minitest/pride'
6
- require 'minitest/autorun'
7
-
8
- def stub_airtable_response!(url, response, method = :get, status = 200)
9
- stub_request(method, url)
10
- .to_return(
11
- body: response.to_json,
12
- status: status,
13
- headers: { 'Content-Type' => 'application/json' }
14
- )
15
- end