airrecord 0.2.2 → 0.2.3

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
  SHA1:
3
- metadata.gz: 933d954eeb135bf48c19d7e8c6ac50905dc652cb
4
- data.tar.gz: 155a3756f64c6c092b5db044c95f0b67df7ac1e3
3
+ metadata.gz: dc85eb8f47b96d2d03f3c2d8ede44021184acce8
4
+ data.tar.gz: 3177b982ce62cbe58dbade3fd5e5e24dbe43bf9d
5
5
  SHA512:
6
- metadata.gz: b853693f32acc9a8206b8cf4ff153cb9d1c41f238ba8a176a09664af6c3b6685c1b00999e2e0b0e13c0a39a002da4288badffd1591b502bcd5e6cb71b0cf5ebf
7
- data.tar.gz: e39e3073c0460c698f9fe9c8ca72ff5fd3d384f9d58a342192ff0ead42a95f835d611286d77bd129443301a36d877b00794716b3b2c8dc6a4a39d8868ac5eb94
6
+ metadata.gz: 25d59a038cbd3d619443274a9ddf415767d39f98c46a2f695bad07f60a2d4e4a941325f8957c0f4e938a5d8215c0f2f90578209ce35e24c18268ecd14c6673bd
7
+ data.tar.gz: cc387e3388f477a9dd538b3f6970486dbff04feed46644603ff17840225d6474b597a38c32fba69b9be779d0ba1dab2873f0817f907e1261fbb51cea6a6f8d21
@@ -1,3 +1,8 @@
1
+ # 0.2.3
2
+
3
+ * Allow single associations (#12)
4
+ * Allow passing `maxRecord` and `pageSize` (#17)
5
+
1
6
  # 0.2.2
2
7
 
3
8
  * Require URI to avoid dependency errors
data/README.md CHANGED
@@ -23,7 +23,7 @@ class Tea < Airrecord::Table
23
23
  has_many :brews, class: 'Brew', column: "Brews"
24
24
 
25
25
  def self.chinese
26
- all(filter: '{Country} == "China"')
26
+ all(filter: '{Country} = "China"')
27
27
  end
28
28
 
29
29
  def self.cheapest_and_best
@@ -43,7 +43,7 @@ module Airrecord
43
43
  end
44
44
  end
45
45
 
46
- def records(filter: nil, sort: nil, view: nil, offset: nil, paginate: true, fields: nil)
46
+ def records(filter: nil, sort: nil, view: nil, offset: nil, paginate: true, fields: nil, max_records: nil, page_size: nil)
47
47
  options = {}
48
48
  options[:filterByFormula] = filter if filter
49
49
 
@@ -56,6 +56,8 @@ module Airrecord
56
56
  options[:view] = view if view
57
57
  options[:offset] = offset if offset
58
58
  options[:fields] = fields if fields
59
+ options[:maxRecords] = max_records if max_records
60
+ options[:pageSize] = page_size if page_size
59
61
 
60
62
  path = "/v0/#{base_key}/#{client.escape(table_name)}"
61
63
  response = client.connection.get(path, options)
@@ -75,6 +77,8 @@ module Airrecord
75
77
  paginate: paginate,
76
78
  fields: fields,
77
79
  offset: parsed_response["offset"],
80
+ max_records: max_records,
81
+ page_size: page_size,
78
82
  ))
79
83
  end
80
84
 
@@ -187,16 +191,17 @@ module Airrecord
187
191
  def serializable_fields(fields = self.fields)
188
192
  Hash[fields.map { |(key, value)|
189
193
  if association(key)
194
+ value = [ value ] unless value.is_a?(Enumerable)
190
195
  assocs = value.map { |assoc|
191
196
  assoc.respond_to?(:id) ? assoc.id : assoc
192
- }
197
+ }
193
198
  [key, assocs]
194
199
  else
195
200
  [key, value]
196
201
  end
197
- }]
202
+ }]
198
203
  end
199
-
204
+
200
205
  def ==(other)
201
206
  self.class == other.class &&
202
207
  serializable_fields == other.serializable_fields
@@ -1,3 +1,3 @@
1
1
  module Airrecord
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
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: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Eskildsen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-26 00:00:00.000000000 Z
11
+ date: 2017-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  version: '0'
136
136
  requirements: []
137
137
  rubyforge_project:
138
- rubygems_version: 2.6.11
138
+ rubygems_version: 2.6.14
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: Airtable client