Module: Filemaker::Api::QueryCommands
- Defined in:
- lib/filemaker/api.rb,
lib/filemaker/api/query_commands/dup.rb,
lib/filemaker/api/query_commands/new.rb,
lib/filemaker/api/query_commands/edit.rb,
lib/filemaker/api/query_commands/find.rb,
lib/filemaker/api/query_commands/view.rb,
lib/filemaker/api/query_commands/delete.rb,
lib/filemaker/api/query_commands/findall.rb,
lib/filemaker/api/query_commands/findany.rb,
lib/filemaker/api/query_commands/findquery.rb
Defined Under Namespace
Classes: CompoundFind
Instance Method Summary collapse
-
#delete(id, options = {}) ⇒ Object
Delete record.
-
#dup(id, options = {}) ⇒ Object
Duplicate record.
-
#edit(id, values, options = {}) ⇒ Object
Edit record.
-
#find(id_or_hash, options = {}) ⇒ Object
Find record(s).
-
#findall(options = {}) ⇒ Object
Find all records.
-
#findany(options = {}) ⇒ Object
Find a random record.
-
#findquery(query_hash, options = {}) ⇒ Object
Raw -findquery if you want to construct your own.
-
#new(values, options = {}) ⇒ Object
Add new record.
-
#query(array_hash, options = {}) ⇒ Object
Find records using compound find query command.
-
#view ⇒ Object
Retrieves <metadata> section of XML.
Instance Method Details
#delete(id, options = {}) ⇒ Object
Delete record.
-recid -script -script.param
10 11 12 13 |
# File 'lib/filemaker/api/query_commands/delete.rb', line 10 def delete(id, = {}) (, :script) perform_request('-delete', { '-recid' => id }, ) end |
#dup(id, options = {}) ⇒ Object
Duplicate record.
-recid -script -script.param -relatedsets.filter -relatedsets.max
12 13 14 15 16 17 18 19 |
# File 'lib/filemaker/api/query_commands/dup.rb', line 12 def dup(id, = {}) (, :script, :relatedsets_filter, :relatedsets_max) perform_request('-dup', { '-recid' => id }, ) end |
#edit(id, values, options = {}) ⇒ Object
Edit record.
-recid -modid -script -script.param -relatedsets.filter -relatedsets.max -delete.related
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/filemaker/api/query_commands/edit.rb', line 14 def edit(id, values, = {}) (, :modid, :script, :relatedsets_filter, :relatedsets_max, :delete_related) perform_request('-edit', { '-recid' => id }.merge(values), ) end |
#find(id_or_hash, options = {}) ⇒ Object
Find record(s).
-max -skip -sortfield. -sortorder. -fieldname -fieldname.op -lop -recid -lay.response -script -script.param -script.prefind -script.prefind.param -script.presort -script.presort.param -relatedsets.filter -relatedsets.max
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/filemaker/api/query_commands/find.rb', line 24 def find(id_or_hash, = {}) (, :max, :skip, :sortfield, :sortorder, :lop, :lay_response, :script, :script_prefind, :script_presort, :relatedsets_filter, :relatedsets_max) if id_or_hash.is_a? Hash perform_request('-find', id_or_hash, ) else perform_request('-find', { '-recid' => id_or_hash }, ) end end |
#findall(options = {}) ⇒ Object
Find all records. Sorting may be slow for huge records.
Acceptable params are: -max -skip -sortfield. -sortorder. -script -script.param -script.prefind -script.prefind.param -script.presort -script.presort.param -relatedsets.filter
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/filemaker/api/query_commands/findall.rb', line 20 def findall( = {}) (, :max, :skip, :sortfield, :sortorder, :script, :script_prefind, :relatedsets_filter) perform_request('-findall', {}, ) end |
#findany(options = {}) ⇒ Object
Find a random record.
If data cannot be coerced, it will crash! Acceptable params are: -script -script.param -script.prefind -script.prefind.param -relatedsets.filter -relatedsets.max
15 16 17 18 19 20 21 22 23 |
# File 'lib/filemaker/api/query_commands/findany.rb', line 15 def findany( = {}) (, :script, :script_prefind, :relatedsets_filter, :relatedsets_max) perform_request('-findany', {}, ) end |
#findquery(query_hash, options = {}) ⇒ Object
Raw -findquery if you want to construct your own.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/filemaker/api/query_commands/findquery.rb', line 20 def findquery(query_hash, = {}) (, :max, :skip, :sortfield, :sortorder, :lay_response, :script, :script_prefind, :script_presort, :relatedsets_filter, :relatedsets_max) perform_request('-findquery', query_hash, ) end |
#new(values, options = {}) ⇒ Object
Add new record.
-script -script.param -relatedsets.filter -relatedsets.max
11 12 13 14 15 16 17 18 |
# File 'lib/filemaker/api/query_commands/new.rb', line 11 def new(values, = {}) (, :script, :relatedsets_filter, :relatedsets_max) perform_request('-new', values, ) end |
#query(array_hash, options = {}) ⇒ Object
Find records using compound find query command.
query(status: ‘open’, title: ‘web’) => (q0,q1) query(status: %w(open closed)) => (q0);(q1)
9 10 11 12 13 14 15 16 17 |
# File 'lib/filemaker/api/query_commands/findquery.rb', line 9 def query(array_hash, = {}) compound_find = CompoundFind.new(array_hash) query_hash = compound_find.key_values.merge( '-query' => compound_find.key_maps_string ) findquery(query_hash, ) end |
#view ⇒ Object
Retrieves <metadata> section of XML.
6 7 8 |
# File 'lib/filemaker/api/query_commands/view.rb', line 6 def view perform_request('-view', {}, {}) end |