quickbase_record 0.0.1 → 0.0.2

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
- OGE4NWIyZGU4ZTNmZGFmMGRjNzdiMzA5ZDZlMzc1NTdmMTJhNzYxNg==
4
+ YzM0NTFiNWIyM2QyZmIxYTU0YTI4MTg1MDNhZGY4YTBmNWYwOGMwNQ==
5
5
  data.tar.gz: !binary |-
6
- ZGExMTQ3ZWNiMzllNDk3NzEyODhkN2FlOWY3Mjk4YTc4MGU2NzU3Yg==
6
+ ZjUxZWU5NzU1MzAwNTZjNDRhZDI0ZjZjOWI4YjJiNTk2NzZlYTUwMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzkyNTJiNWM2NmY3OTNhNTQ1NTJiNjY4NjBmNjExMjZkMzQwOTc2MTFhZmIx
10
- NTkxZmU2NDc2NjY1MjIwNWI3Y2YwZWM3ZjZhMjYyZDc1MTM4N2I1MmI5N2Nl
11
- YzBmOTc3MzMwMGQ1OGJlN2VhOTFiOTZhZTJkZjk0MWUyYTA3OGY=
9
+ ZmUwZTY5MDYzZmNjZjA2YjZiOGIzOGZhMmFmOTBkZTUzNTZiNzA0YjgxOWNk
10
+ M2QxNzY0Y2MzMzVkMjdlYjdjZWU5MGJjMjhlMDI2MzA2NTljZTRkZjgwNWFk
11
+ YzhjMmRkOWQzNjIzZDRjMGU5NTdjNjhhYjIzYWMzYjQ5NDNhMzQ=
12
12
  data.tar.gz: !binary |-
13
- N2ZhNjUzNTIwNDRiMjgyNmYwOTBmMDkyY2Y0OTFmYjM4NWI5MTY0YzZhNjEw
14
- NThmZmIxZjc0MjAxNDQ4NWU2MGRjYmZkZDc0Njk2MmVkYjM1NThjZTVlNTkw
15
- YWJmZTdiNTk5ZmIzM2ViMzkzM2FlNjNmOWU5MzEwNjE3YmYwMjM=
13
+ MGZiMTk2NTRlNWMzNGJjYzEyNzc1ZWU3YzFkZDA1ZDFhZmU0ZDlkMjcxY2Mw
14
+ Mjc2YTNhZDBiYmM1NTdkNDc4ZmRkZjBiNDY4YmY4MWZmYjZiZDkwM2M1NjYw
15
+ YmJhYzZjNGQ2MWU2ZmQzNDJlZDIzMzgwOGUwOGI0MWZmYjY0MjE=
data/README.md CHANGED
@@ -132,6 +132,13 @@ Database callbacks (i.e. `before_save :create_token!`) are not fully functional
132
132
  Posts.query("{author.XEX.'Cullen Jett'}")
133
133
  ```
134
134
 
135
+ * **.qid(id)**
136
+ - Accepts a QID (QuickBase report ID)
137
+ - Returns an array of objects
138
+ ```
139
+ Posts.qid(1)
140
+ ```
141
+
135
142
  * **#save**
136
143
  - 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
137
144
  - Returns the object (if #save created a record in QuickBase the the returned object will now have an ID)
@@ -2,12 +2,6 @@ module QuickbaseRecord
2
2
  module Client
3
3
  include ActiveSupport::Concern
4
4
 
5
- module ClassMethods
6
- def qb_client
7
- self.new.qb_client
8
- end
9
- end
10
-
11
5
  def qb_client
12
6
  realm = QuickbaseRecord.configuration.realm
13
7
  username = QuickbaseRecord.configuration.username
@@ -15,6 +9,5 @@ module QuickbaseRecord
15
9
 
16
10
  @qb_client ||= AdvantageQuickbase::API.new(realm, username, password)
17
11
  end
18
-
19
12
  end
20
13
  end
@@ -55,6 +55,18 @@ module QuickbaseRecord
55
55
  return array_of_new_objects
56
56
  end
57
57
 
58
+ def qid(id)
59
+ query_options = { qid: id, clist: clist }
60
+ query_response = qb_client.do_query(dbid, query_options)
61
+
62
+ array_of_new_objects = query_response.map do |response|
63
+ converted_response = convert_quickbase_response(response)
64
+ new(converted_response)
65
+ end
66
+
67
+ return array_of_new_objects
68
+ end
69
+
58
70
  def build_query(query_hash)
59
71
  return convert_query_string(query_hash) if query_hash.is_a? String
60
72
 
@@ -1,3 +1,3 @@
1
1
  module QuickbaseRecord
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -3,7 +3,7 @@ require './lib/quickbase_record'
3
3
  class StudentFake
4
4
  include QuickbaseRecord::Model
5
5
 
6
- StudentFake.define_fields ({
6
+ define_fields ({
7
7
  :dbid => 'bjzrx8ckw',
8
8
  :id => 3,
9
9
  :name => 6,
@@ -10,5 +10,4 @@ class TeacherFake
10
10
  :subject => 7,
11
11
  :salary => 8
12
12
  })
13
-
14
13
  end
data/spec/queries_spec.rb CHANGED
@@ -54,6 +54,18 @@ RSpec.describe QuickbaseRecord::Queries do
54
54
  end
55
55
  end
56
56
 
57
+ describe '.qid' do
58
+ it "returns an array of objects" do
59
+ teachers = TeacherFake.qid(1)
60
+ expect(teachers).to be_a Array
61
+ end
62
+
63
+ it "returns an object of the Teacher class" do
64
+ teachers = TeacherFake.qid(1)
65
+ expect(teachers.first).to be_a TeacherFake
66
+ end
67
+ end
68
+
57
69
  describe '#save' do
58
70
  it "creates a new record for an object without an ID and sets it's new ID" do
59
71
  cullen = TeacherFake.new(name: 'Cullen Jett', salary: '1,000,000.00')
@@ -1,5 +1,7 @@
1
1
  QuickbaseRecord.configure do |config|
2
2
  config.realm = "ais"
3
- config.username = ENV["QB_USERNAME"]
4
- config.password = ENV["QB_PASSWORD"]
3
+ # config.username = ENV["QB_USERNAME"]
4
+ config.username = "cullenjett"
5
+ # config.password = ENV["QB_PASSWORD"]
6
+ config.password = "condor88"
5
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quickbase_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cullen Jett