braque 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/braque/model.rb +10 -0
- data/lib/braque/version.rb +1 -1
- data/spec/braque/subclassed_model_spec.rb +40 -9
- 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: a98f34cb71d248a703cb08b321109252638cd0c5
|
4
|
+
data.tar.gz: c08a5b5527ffae9cb00e0722919397a78a937036
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4764cb4013926ed115f96ec4b076c3a2bcf461e59106e26fbfe1e5f5cfd3c0c21627ab12805ef2b32fe3dad8d43be286491219085919d7c09839eb349ddaa6fd
|
7
|
+
data.tar.gz: 2a96a53a0da8fe227c8d35b20273ac7b9f9f6580c24d91e8aa7627444c307453075f8812f03f3aa25b018f44dfba6668400194a81eb16c0a1410f459bed27858
|
data/lib/braque/model.rb
CHANGED
@@ -44,6 +44,16 @@ module Braque
|
|
44
44
|
|
45
45
|
def self.#{collection_method_name}
|
46
46
|
end
|
47
|
+
|
48
|
+
def self.inherited(subclass)
|
49
|
+
subclass.class_eval do
|
50
|
+
define_singleton_method subclass.instance_method_name do
|
51
|
+
end
|
52
|
+
|
53
|
+
define_singleton_method subclass.collection_method_name do
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
47
57
|
WRITER
|
48
58
|
end
|
49
59
|
|
data/lib/braque/version.rb
CHANGED
@@ -24,15 +24,46 @@ RSpec.describe Braque::Model, type: :model do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
27
|
+
context 'api configuration' do
|
28
|
+
it 'sets the correct api_root and api_token for the base class' do
|
29
|
+
expect(GeologicModel.api_root).to eq 'http://localhost:9292'
|
30
|
+
expect(GeologicModel.api_token).to eq 'replace-me'
|
31
|
+
end
|
32
|
+
it 'sets the correct api_root and api_token for a subclassed class' do
|
33
|
+
expect(ContinentalDrift.api_root).to eq 'http://localhost:9292'
|
34
|
+
expect(ContinentalDrift.api_token).to eq 'replace-me'
|
35
|
+
end
|
36
|
+
it 'sets the correct api_root and api_token for a subclassed class with variable overrides' do
|
37
|
+
expect(Convection.api_root).to eq 'http://localhost:9595'
|
38
|
+
expect(Convection.api_token).to eq 'ok-another-one-to-replace'
|
39
|
+
end
|
40
|
+
it 'sets the correct api_root and api_token for a new Braque::Model class' do
|
41
|
+
expect(SeafloorSpreading.api_root).to eq 'http://localhost:9393'
|
42
|
+
expect(SeafloorSpreading.api_token).to eq 'do-replace-me-as-well'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'dynamic class methods' do
|
47
|
+
it 'sets the correct dynamic class methods for the base class' do
|
48
|
+
[:geologic_model, :geologic_models].each do |sym|
|
49
|
+
expect(GeologicModel.methods).to include(sym)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
it 'sets the correct dynamic class methods for a subclassed class' do
|
53
|
+
[:continental_drift, :continental_drifts].each do |sym|
|
54
|
+
expect(ContinentalDrift.methods).to include(sym)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
it 'sets the correct dynamic class methods for a subclassed class with variable overrides' do
|
58
|
+
[:convection, :convections].each do |sym|
|
59
|
+
expect(Convection.methods).to include(sym)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
it 'sets the correct dynamic class methods for a new Braque::Model class' do
|
63
|
+
[:seafloor_spreading, :seafloor_spreadings].each do |sym|
|
64
|
+
expect(SeafloorSpreading.methods).to include(sym)
|
65
|
+
end
|
66
|
+
end
|
36
67
|
end
|
37
68
|
end
|
38
69
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: braque
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Fareed
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hyperclient
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
100
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.
|
101
|
+
rubygems_version: 2.2.2
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: Braque provides a simple interface for interacting with Hypermedia API services
|