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 +8 -8
- data/README.md +7 -0
- data/lib/quickbase_record/client.rb +0 -7
- data/lib/quickbase_record/queries.rb +12 -0
- data/lib/quickbase_record/version.rb +1 -1
- data/spec/fakes/student_fake.rb +1 -1
- data/spec/fakes/teacher_fake.rb +0 -1
- data/spec/queries_spec.rb +12 -0
- data/spec/quickbase_record_config.rb +4 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzM0NTFiNWIyM2QyZmIxYTU0YTI4MTg1MDNhZGY4YTBmNWYwOGMwNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjUxZWU5NzU1MzAwNTZjNDRhZDI0ZjZjOWI4YjJiNTk2NzZlYTUwMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmUwZTY5MDYzZmNjZjA2YjZiOGIzOGZhMmFmOTBkZTUzNTZiNzA0YjgxOWNk
|
10
|
+
M2QxNzY0Y2MzMzVkMjdlYjdjZWU5MGJjMjhlMDI2MzA2NTljZTRkZjgwNWFk
|
11
|
+
YzhjMmRkOWQzNjIzZDRjMGU5NTdjNjhhYjIzYWMzYjQ5NDNhMzQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
|
data/spec/fakes/student_fake.rb
CHANGED
data/spec/fakes/teacher_fake.rb
CHANGED
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.
|
3
|
+
# config.username = ENV["QB_USERNAME"]
|
4
|
+
config.username = "cullenjett"
|
5
|
+
# config.password = ENV["QB_PASSWORD"]
|
6
|
+
config.password = "condor88"
|
5
7
|
end
|