filemaker 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/filemaker/model.rb +15 -0
- data/lib/filemaker/version.rb +1 -1
- data/spec/filemaker/model_spec.rb +11 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e51cec7f5db8072eb5c0b218ed4d521641f56b14
|
4
|
+
data.tar.gz: 7d2603cea09ae2a110ae121e6d593508d5363ea3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27613622cc49cbdc5c799d8ded00bbdd171f5a424d12213a16e957c24ee8dd36a8c5cc941a2ccbc61614751498b2540c6da466655295c1798b949db89c7c68f6
|
7
|
+
data.tar.gz: 4bba2a963de990cd2a72b718238b29b18584068d9e185ac972638bd4a9733449eb8a46b581679acbda2850950c2bf72a9d2665153ce4eadd35889c163b6b51a4
|
data/lib/filemaker/model.rb
CHANGED
@@ -33,6 +33,17 @@ module Filemaker
|
|
33
33
|
[self]
|
34
34
|
end
|
35
35
|
|
36
|
+
def model_key
|
37
|
+
@model_cache_key ||= "#{self.class.model_name.cache_key}"
|
38
|
+
end
|
39
|
+
|
40
|
+
def cache_key
|
41
|
+
return "#{model_key}/new" if new_record?
|
42
|
+
return "#{model_key}/#{id}-#{updated_at.to_datetime.utc.to_s(:number)}" \
|
43
|
+
if respond_to?(:updated_at) && send(:updated_at)
|
44
|
+
"#{model_key}/#{id}"
|
45
|
+
end
|
46
|
+
|
36
47
|
def id
|
37
48
|
self.class.identity ? identity_id : record_id
|
38
49
|
end
|
@@ -96,6 +107,10 @@ module Filemaker
|
|
96
107
|
self.per_page = value.to_i
|
97
108
|
end
|
98
109
|
|
110
|
+
def default_per_page
|
111
|
+
self.per_page
|
112
|
+
end
|
113
|
+
|
99
114
|
# Make use of -view to return an array of [name, data_type] for this
|
100
115
|
# model from FileMaker.
|
101
116
|
#
|
data/lib/filemaker/version.rb
CHANGED
@@ -62,6 +62,17 @@ describe Filemaker::Model do
|
|
62
62
|
expect(model.salary?).to be true
|
63
63
|
end
|
64
64
|
|
65
|
+
it 'has model key' do
|
66
|
+
expect(model.model_key).to eq 'my_models'
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'has cache key' do
|
70
|
+
expect(model.cache_key).to eq 'my_models/new'
|
71
|
+
model.candidate_id = 'CA123'
|
72
|
+
model.instance_variable_set('@new_record', false)
|
73
|
+
expect(model.cache_key).to eq 'my_models/CA123'
|
74
|
+
end
|
75
|
+
|
65
76
|
describe 'process_attributes' do
|
66
77
|
it 'accepts a hash of attributes' do
|
67
78
|
model = MyModel.new(name: 'Bob', email: 'bob@cern.org')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filemaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mech
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -242,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
242
|
version: '0'
|
243
243
|
requirements: []
|
244
244
|
rubyforge_project:
|
245
|
-
rubygems_version: 2.4.
|
245
|
+
rubygems_version: 2.4.2
|
246
246
|
signing_key:
|
247
247
|
specification_version: 4
|
248
248
|
summary: A Ruby wrapper to FileMaker XML API.
|