quickbase_record 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTI2YTdiYmM1M2ExYmMxYTg2MDIyMjFhOWJhZjE2M2E2NWYwYmNkOQ==
4
+ MGJhY2MwOGI2YTVhMjc0ZTBlNDdkYmIzMDI2NDdjOWU3Y2NjMGZmZA==
5
5
  data.tar.gz: !binary |-
6
- YWNiMDVmYzlhOTgyOTJmZTg2MTgxZDE1MDkyNTBiOWI0OTJiYTJjZQ==
6
+ ODcxNmE2MzU2ZDBhNDlkYmZkMzllYWQ3MDY3MjIzZTA3MDI5Njg4Mg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- M2VhMzE1NjE2MmUxY2MzYTAzZmM3MmJlZDM5ZjQwOWM3NTA4MTUyNTkxN2Vl
10
- MzNmNGMwZDY3NjE3YTQ1NTEyY2ZlZGMxMGRhM2NmZTQ5YTc2OGE5YjJhYTMz
11
- M2Q0YTIyZGFmN2VjMzEyNjg5OWQxOTY3MjA5ZGMxYTQ4NDJiMzM=
9
+ MmEzY2M5ZjNhM2RiNzkwY2ZhZGVjZjgxMTI4MWM4OThkM2RhZGJmZjhhNDZh
10
+ MjA1OWE3YTE3YmVjMzkxMGFmODMwMWQwYzFjNjUwODExYjFmOTZjMGNlMWE3
11
+ YTM0ZGQ4ZGI2NjQ4ZTc1MzcyYmVhNThiMWM2YWIzYTQxZjU2NmQ=
12
12
  data.tar.gz: !binary |-
13
- NDFjYWRlZTcyZTgxODBjMTc4MGExYzkyMDRmYWFmNWNmZmE4Yzc4MTdhZmRj
14
- MGQ5YmZmNjFjNGJmMWJkMTc3ZDZmYTczMmZhZjAzOTQ5ZjcwZjY4MGZhNzhl
15
- NmMxYzZjNTUxY2M1YWFkZDFkZTRkN2Q2NmY5NWNkZjFhZTljODQ=
13
+ MGFlMjNhMjU5Yzk2OTExY2YzOGJiZTBhODI2YzJmYzFmZTc3ZDM0Yzk3MjEx
14
+ OGYzM2ZlMjY1ZmQ3OTUwMzA5NjA5Y2I0NGFjNjIwNjYzMjJhZWQ5NmRhMWQy
15
+ ODQ0ZWE1ODk1MjcyODhmNDVkNjc2ODBhM2ZkNGQwMGM4NGMxYmI=
data/README.md CHANGED
@@ -140,8 +140,13 @@ Database callbacks (i.e. `before_save :create_token!`) are not fully functional
140
140
  - Also accepts a string in the standard QuickBase query format
141
141
  * Works with field names or FIDs
142
142
  ```
143
- Post.query("{'3'.EX.'1'}")
144
- Post.query("{author.XEX.'Cullen Jett'}")
143
+ Post.where("{'3'.EX.'1'}")
144
+ Post.where("{author.XEX.'Cullen Jett'}")
145
+ ```
146
+
147
+ - To query using the QuickBase query options such as 'clist', 'slist', or 'options', include :query_options as a hash of option_property: value
148
+ ```
149
+ Post.where(author: ['Cullen Jett', 'Socrates'], query_options: {clist: 'id.author', slist: 'author'})
145
150
  ```
146
151
 
147
152
  * **.qid(id)**
@@ -154,7 +159,6 @@ Database callbacks (i.e. `before_save :create_token!`) are not fully functional
154
159
  * **#save**
155
160
  - Creates a new record in QuickBase for objects that don't have an ID *or* edits the corresponding QuickBase record if the object already has an ID
156
161
  - Returns the object (if #save created a record in QuickBase the the returned object will now have an ID)
157
- - Uses API_ImportFromCSV under the hood.
158
162
  ```
159
163
  @post = Post.new(content: 'Amazing post content', author: 'Cullen Jett')
160
164
  @post.save # => <Post: @id: 1, @content: 'Amazing post content', @author: 'Cullen Jett'
@@ -173,6 +177,7 @@ Database callbacks (i.e. `before_save :create_token!`) are not fully functional
173
177
 
174
178
  * **#update_attributes(attributes_hash)**
175
179
  - **IMPORTANT: Updates *and* saves the object with the new attributes**
180
+ - Only sends the passed in attributes as arguments to API_AddRecord or API_EditRecord (depending on whether the object has an ID or not)
176
181
  - Returns the object
177
182
  ```
178
183
  @post = Post.where(author: 'Cullen Jett').first
@@ -18,6 +18,7 @@ module QuickbaseRecord
18
18
 
19
19
  def find(id, query_options = {})
20
20
  query_options = build_query_options(query_options[:query_options])
21
+ clist = query_options.delete(:clist) if query_options[:clist]
21
22
  query = { query: build_query(id: id), clist: clist }.merge(query_options)
22
23
  query_response = qb_client.do_query(dbid, query).first
23
24
 
@@ -34,6 +35,8 @@ module QuickbaseRecord
34
35
  options = {}
35
36
  end
36
37
 
38
+ clist = options.delete(:clist) if options[:clist]
39
+
37
40
  query = { query: build_query(query_hash), clist: clist }.merge(options)
38
41
  query_response = qb_client.do_query(dbid, query)
39
42
 
@@ -1,3 +1,3 @@
1
1
  module QuickbaseRecord
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
data/spec/queries_spec.rb CHANGED
@@ -53,6 +53,12 @@ RSpec.describe QuickbaseRecord::Queries do
53
53
  teachers = TeacherFake.where(subject: ['Gym', 'Biology'], query_options: {slist: 'subject', options: 'sortorder-D'})
54
54
  expect(teachers.first.subject).to eq('Gym')
55
55
  end
56
+
57
+ it "accepts modified clists" do
58
+ teachers = TeacherFake.where(id: {XEX: ''}, query_options: {clist: 'id'})
59
+ expect(teachers.first.id).to be_present
60
+ expect(teachers.first.subject).not_to be_present
61
+ end
56
62
  end
57
63
 
58
64
  describe '.create' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quickbase_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cullen Jett
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-13 00:00:00.000000000 Z
11
+ date: 2015-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler