osm 1.2.18.dev.14 → 1.2.18
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.
- data/.travis.yml +1 -0
- data/CHANGELOG.md +2 -1
- data/lib/osm/model.rb +1 -1
- data/spec/osm/api_spec.rb +7 -7
- data/spec/osm/model_spec.rb +10 -10
- data/version.rb +1 -1
- metadata +5 -5
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
## Version 1.2.18
|
2
2
|
|
3
|
-
*
|
3
|
+
* Add gem version into the cache key
|
4
4
|
* Osm::Section - removal of column_names, fields, intouch_fields, mobile_fields and sms_* attributes
|
5
5
|
* Osm::Member - lots of changes to reflect OSM's new structure for member's details (main ones listed below):
|
6
6
|
* Removal of type attribute (I never could work out what it represented)
|
@@ -38,6 +38,7 @@
|
|
38
38
|
* Addition of remaining_credits(api, section, options={}) method
|
39
39
|
* Addition of number_selected(api, section, members, options={}) method to tell how many numbers a message would be sent to
|
40
40
|
* Add :migration as an API target
|
41
|
+
>>>>>>> NewContactSystem
|
41
42
|
|
42
43
|
## Version 1.2.17
|
43
44
|
|
data/lib/osm/model.rb
CHANGED
@@ -112,7 +112,7 @@ module Osm
|
|
112
112
|
end
|
113
113
|
def self.cache_key(api, key)
|
114
114
|
key = key.join('-') if key.is_a?(Array)
|
115
|
-
"#{@@cache_prepend.empty? ? '' : "#{@@cache_prepend}-"}#{api.site}-#{key}"
|
115
|
+
"#{@@cache_prepend.empty? ? '' : "#{@@cache_prepend}-"}#{Osm::VERSION}-#{api.site}-#{key}"
|
116
116
|
end
|
117
117
|
|
118
118
|
|
data/spec/osm/api_spec.rb
CHANGED
@@ -88,8 +88,8 @@ describe "API" do
|
|
88
88
|
|
89
89
|
it "Get from cache" do
|
90
90
|
permissions = {1 => {:a => [:read, :write]}, 2 => {:a => [:read]}}
|
91
|
-
OsmTest::Cache.should_receive('exist?').with(
|
92
|
-
OsmTest::Cache.should_receive('read').with(
|
91
|
+
OsmTest::Cache.should_receive('exist?').with("OSMAPI-#{Osm::VERSION}-osm-permissions-user_id") { true }
|
92
|
+
OsmTest::Cache.should_receive('read').with("OSMAPI-#{Osm::VERSION}-osm-permissions-user_id") { permissions }
|
93
93
|
@api.get_user_permissions.should == permissions
|
94
94
|
end
|
95
95
|
|
@@ -105,17 +105,17 @@ describe "API" do
|
|
105
105
|
}
|
106
106
|
url = 'https://www.onlinescoutmanager.co.uk/api.php?action=getUserRoles'
|
107
107
|
|
108
|
-
OsmTest::Cache.should_not_receive('exist?').with(
|
109
|
-
OsmTest::Cache.should_not_receive('read').with(
|
108
|
+
OsmTest::Cache.should_not_receive('exist?').with("OSMAPI-#{Osm::VERSION}-osm-permissions-user_id")
|
109
|
+
OsmTest::Cache.should_not_receive('read').with("OSMAPI-#{Osm::VERSION}-osm-permissions-user_id")
|
110
110
|
HTTParty.should_receive(:post).with(url, {:body=>body}) { OsmTest::DummyHttpResult.new(:response=>{:code=>'200', :body=>data.to_json}) }
|
111
111
|
@api.get_user_permissions(:no_cache => true).should == {1 => {:badge => [:read]}}
|
112
112
|
end
|
113
113
|
|
114
114
|
it "Set" do
|
115
115
|
permissions = {1 => {:a => [:read, :write]}, 2 => {:a => [:read]}}
|
116
|
-
OsmTest::Cache.should_receive('exist?').with(
|
117
|
-
OsmTest::Cache.should_receive('read').with(
|
118
|
-
OsmTest::Cache.should_receive('write').with(
|
116
|
+
OsmTest::Cache.should_receive('exist?').with("OSMAPI-#{Osm::VERSION}-osm-permissions-user_id") { true }
|
117
|
+
OsmTest::Cache.should_receive('read').with("OSMAPI-#{Osm::VERSION}-osm-permissions-user_id") { permissions }
|
118
|
+
OsmTest::Cache.should_receive('write').with("OSMAPI-#{Osm::VERSION}-osm-permissions-user_id", permissions.merge(3 => {:a => [:read]}), {:expires_in=>600}) { true }
|
119
119
|
@api.set_user_permissions(3, {:a => [:read]})
|
120
120
|
end
|
121
121
|
|
data/spec/osm/model_spec.rb
CHANGED
@@ -66,22 +66,22 @@ describe "Model" do
|
|
66
66
|
describe "Caching" do
|
67
67
|
|
68
68
|
it "Checks for existance" do
|
69
|
-
OsmTest::Cache.should_receive('exist?').with(
|
69
|
+
OsmTest::Cache.should_receive('exist?').with("OSMAPI-#{Osm::VERSION}-osm-key") { true }
|
70
70
|
ModelTester.cache('exist?', @api, 'key').should == true
|
71
71
|
end
|
72
72
|
|
73
73
|
it "Writes" do
|
74
|
-
OsmTest::Cache.should_receive('write').with(
|
74
|
+
OsmTest::Cache.should_receive('write').with("OSMAPI-#{Osm::VERSION}-osm-key", 'data', {:expires_in=>600}) { true }
|
75
75
|
ModelTester.cache('write', @api, 'key', 'data').should == true
|
76
76
|
end
|
77
77
|
|
78
78
|
it "Reads" do
|
79
|
-
OsmTest::Cache.should_receive('read').with(
|
79
|
+
OsmTest::Cache.should_receive('read').with("OSMAPI-#{Osm::VERSION}-osm-key") { 'data' }
|
80
80
|
ModelTester.cache('read', @api, 'key').should == 'data'
|
81
81
|
end
|
82
82
|
|
83
83
|
it "Deletes" do
|
84
|
-
OsmTest::Cache.should_receive('delete').with(
|
84
|
+
OsmTest::Cache.should_receive('delete').with("OSMAPI-#{Osm::VERSION}-osm-key") { true }
|
85
85
|
ModelTester.cache('delete', @api, 'key').should == true
|
86
86
|
end
|
87
87
|
|
@@ -94,7 +94,7 @@ describe "Model" do
|
|
94
94
|
end
|
95
95
|
|
96
96
|
it "Builds a key from an array" do
|
97
|
-
ModelTester.cache('key', @api, ['a', 'b']).should ==
|
97
|
+
ModelTester.cache('key', @api, ['a', 'b']).should == "OSMAPI-#{Osm::VERSION}-osm-a-b"
|
98
98
|
end
|
99
99
|
|
100
100
|
end
|
@@ -103,15 +103,15 @@ describe "Model" do
|
|
103
103
|
describe "Get items from ids" do
|
104
104
|
|
105
105
|
it "All items in cache" do
|
106
|
-
OsmTest::Cache.write(
|
107
|
-
OsmTest::Cache.write(
|
108
|
-
OsmTest::Cache.write(
|
106
|
+
OsmTest::Cache.write("OSMAPI-#{Osm::VERSION}-osm-items", [1, 2])
|
107
|
+
OsmTest::Cache.write("OSMAPI-#{Osm::VERSION}-osm-item-1", '1')
|
108
|
+
OsmTest::Cache.write("OSMAPI-#{Osm::VERSION}-osm-item-2", '2')
|
109
109
|
ModelTester.test_get_all(@api, 'items', 'item').should == ['1', '2']
|
110
110
|
end
|
111
111
|
|
112
112
|
it "An item not in cache" do
|
113
|
-
OsmTest::Cache.write(
|
114
|
-
OsmTest::Cache.write(
|
113
|
+
OsmTest::Cache.write("OSMAPI-#{Osm::VERSION}-osm-items", [1, 2])
|
114
|
+
OsmTest::Cache.write("OSMAPI-#{Osm::VERSION}-osm-item-1", '1')
|
115
115
|
ModelTester.stub(:get_all) { ['A', 'B'] }
|
116
116
|
ModelTester.test_get_all(@api, 'items', 'item').should == ['A', 'B']
|
117
117
|
end
|
data/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: osm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.18
|
5
|
-
prerelease:
|
4
|
+
version: 1.2.18
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Robert Gauld
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-07-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -308,9 +308,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
308
308
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
309
309
|
none: false
|
310
310
|
requirements:
|
311
|
-
- - ! '
|
311
|
+
- - ! '>='
|
312
312
|
- !ruby/object:Gem::Version
|
313
|
-
version:
|
313
|
+
version: '0'
|
314
314
|
requirements: []
|
315
315
|
rubyforge_project: osm
|
316
316
|
rubygems_version: 1.8.23.2
|