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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87dee5e465c260a70cc59492b12fb5a8a9f74dce
4
- data.tar.gz: dec6305d44d0eac91f95ba7f5def8ddb8a179292
3
+ metadata.gz: e51cec7f5db8072eb5c0b218ed4d521641f56b14
4
+ data.tar.gz: 7d2603cea09ae2a110ae121e6d593508d5363ea3
5
5
  SHA512:
6
- metadata.gz: 182382127660a2e3d081d4b12e80defbeca9db11042a29d4cb626f99ce8bebf016d3b89d16ec1392d4375035d77b5a2ca5450d2c623e6fb7bf3ab4f8b06a5cef
7
- data.tar.gz: 3fbc5b636c7fda5f4d8f72b29305844d7777969adeea0b446cd72c6cbfcad98fb404b70e4029ebeb74a1fcd22f2bd1ae4be1a5cde69be9593f82b9a76bd3113e
6
+ metadata.gz: 27613622cc49cbdc5c799d8ded00bbdd171f5a424d12213a16e957c24ee8dd36a8c5cc941a2ccbc61614751498b2540c6da466655295c1798b949db89c7c68f6
7
+ data.tar.gz: 4bba2a963de990cd2a72b718238b29b18584068d9e185ac972638bd4a9733449eb8a46b581679acbda2850950c2bf72a9d2665153ce4eadd35889c163b6b51a4
@@ -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
  #
@@ -1,3 +1,3 @@
1
1
  module Filemaker
2
- VERSION = '0.0.9'
2
+ VERSION = '0.0.10'
3
3
  end
@@ -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.9
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-10-07 00:00:00.000000000 Z
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.1
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.