kalibro_gem 0.0.1.rc13 → 0.0.1.rc14
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.
- checksums.yaml +4 -4
- data/lib/kalibro_gem/entities/model.rb +15 -9
- data/lib/kalibro_gem/version.rb +1 -1
- data/spec/entities/model_spec.rb +28 -22
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f437b3f0cf0bb7631a536d9d15297d39b6f71b34
|
4
|
+
data.tar.gz: fe0fa34a3c8946b5870675308bda01b7a2bfd249
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83c4613a5cd8ae7dfec27ad8188c190cae962ec15906d930cd9072baef5a901dd3849e9bf3ac45bb48bcabff8d2bcd85986127d8be6a9982487971776487590a
|
7
|
+
data.tar.gz: d3cdf0333cd55f9a7ae985d53161c5f64329c9ccbd6abeb1c36175d5a38b153cfc127557ba6298567f9ba43054ba31e5d317b3775530f3288ca6cf62b8820d1a
|
@@ -115,14 +115,6 @@ module KalibroGem
|
|
115
115
|
response
|
116
116
|
end
|
117
117
|
|
118
|
-
def self.endpoint
|
119
|
-
class_name
|
120
|
-
end
|
121
|
-
|
122
|
-
def instance_class_name
|
123
|
-
self.class.name.gsub(/KalibroGem::Entities::/,"")
|
124
|
-
end
|
125
|
-
|
126
118
|
protected
|
127
119
|
|
128
120
|
def instance_variable_names
|
@@ -145,6 +137,10 @@ module KalibroGem
|
|
145
137
|
field.to_s[0] != '@' and field != :attributes! and (field.to_s =~ /xsi/).nil?
|
146
138
|
end
|
147
139
|
|
140
|
+
# TODO: Rename to entitie_name
|
141
|
+
def instance_class_name
|
142
|
+
self.class.class_name
|
143
|
+
end
|
148
144
|
|
149
145
|
include RequestMethods
|
150
146
|
extend RequestMethods::ClassMethods
|
@@ -153,9 +149,19 @@ module KalibroGem
|
|
153
149
|
@kalibro_errors << exception
|
154
150
|
end
|
155
151
|
|
152
|
+
def self.endpoint
|
153
|
+
class_name
|
154
|
+
end
|
156
155
|
|
156
|
+
# TODO: Rename to entitie_name
|
157
157
|
def self.class_name
|
158
|
-
|
158
|
+
# This loop is a generic way to make this work even when the children class has a different name
|
159
|
+
entitie_class = self
|
160
|
+
until entitie_class.name.include?("KalibroGem::Entities::") do
|
161
|
+
entitie_class = entitie_class.superclass
|
162
|
+
end
|
163
|
+
|
164
|
+
entitie_class.name.gsub(/KalibroGem::Entities::/,"")
|
159
165
|
end
|
160
166
|
|
161
167
|
include HashConverters
|
data/lib/kalibro_gem/version.rb
CHANGED
data/spec/entities/model_spec.rb
CHANGED
@@ -54,16 +54,34 @@ describe KalibroGem::Entities::Model do
|
|
54
54
|
let(:fixture) { File.read("spec/savon/fixtures/project/does_not_exists.xml") }
|
55
55
|
let(:client) { mock('client') }
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
57
|
+
context 'for the KalibroGem::Entitie class' do
|
58
|
+
it 'should successfully get the Kalibro version' do
|
59
|
+
client.expects(:call).
|
60
|
+
with(:project_exists, message: {project_id: 1}).
|
61
|
+
returns(mock_savon_response(fixture))
|
62
|
+
KalibroGem::Entities::Model.
|
63
|
+
expects(:client).
|
64
|
+
with(any_parameters).
|
65
|
+
returns(client)
|
66
|
+
KalibroGem::Entities::Model.
|
67
|
+
request(:project_exists, {project_id: 1})[:exists].should eq(false)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
context 'with a children class from outside' do
|
72
|
+
class Child < KalibroGem::Entities::Model; end
|
73
|
+
|
74
|
+
it 'should successfully get the Kalibro version' do
|
75
|
+
client.expects(:call).
|
76
|
+
with(:project_exists, message: {project_id: 1}).
|
77
|
+
returns(mock_savon_response(fixture))
|
78
|
+
Child.
|
79
|
+
expects(:client).
|
80
|
+
with(any_parameters).
|
81
|
+
returns(client)
|
82
|
+
Child.
|
83
|
+
request(:project_exists, {project_id: 1})[:exists].should eq(false)
|
84
|
+
end
|
67
85
|
end
|
68
86
|
end
|
69
87
|
|
@@ -272,16 +290,4 @@ describe KalibroGem::Entities::Model do
|
|
272
290
|
end
|
273
291
|
end
|
274
292
|
end
|
275
|
-
|
276
|
-
describe 'endpoint' do
|
277
|
-
it 'should return the class name' do
|
278
|
-
KalibroGem::Entities::Model.endpoint.should eq("Model")
|
279
|
-
end
|
280
|
-
end
|
281
|
-
|
282
|
-
describe 'instance_class_name' do
|
283
|
-
it 'should return the class name' do
|
284
|
-
subject.instance_class_name.should eq("Model")
|
285
|
-
end
|
286
|
-
end
|
287
293
|
end
|