zoho_invoice 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -65,7 +65,7 @@ module ZohoInvoice
65
65
  self.reflections.each { |r| self.send("#{r}=", []) }
66
66
  (self.reflections & options.keys).each do |reflection|
67
67
  options[reflection].each do |reflection_obj|
68
- klass = Kernel.const_get(camel_case(reflection.to_s[0..-2]))
68
+ klass = ZohoInvoice.const_get(camel_case(reflection.to_s[0..-2]))
69
69
  if reflection_obj.is_a?(Hash)
70
70
  self.send("#{reflection}") << klass.new(@client, reflection_obj)
71
71
  elsif reflection_obj.is_a?(klass)
@@ -149,7 +149,7 @@ module ZohoInvoice
149
149
 
150
150
  def build_attributes
151
151
  Nokogiri::XML::Builder.new do |xml|
152
- xml.send("#{self.class}") {
152
+ xml.send("#{self.class.to_s.split('::').last}") {
153
153
  self.attributes.each do |attr|
154
154
  vals = self.send(attr)
155
155
  if !vals.nil? && !vals.is_a?(Array)
@@ -1,3 +1,3 @@
1
1
  module ZohoInvoice
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -38,7 +38,7 @@ describe ZohoInvoice::Base do
38
38
 
39
39
  describe "generating an xml representation" do
40
40
  before do
41
- class Something < ZohoInvoice::Base
41
+ class ZohoInvoice::Something < ZohoInvoice::Base
42
42
  define_object_attrs :test_it,
43
43
  :blah,
44
44
  :something_id
@@ -47,7 +47,7 @@ describe ZohoInvoice::Base do
47
47
  :more_things
48
48
  end
49
49
 
50
- @test_obj = Something.new(@client)
50
+ @test_obj = ZohoInvoice::Something.new(@client)
51
51
  end
52
52
 
53
53
  it "should specific an xml doctype" do
@@ -206,10 +206,10 @@ describe ZohoInvoice::Base do
206
206
  end
207
207
 
208
208
  describe "nested associations" do
209
- class Tuna < ZohoInvoice::Base
209
+ class ZohoInvoice::Tuna < ZohoInvoice::Base
210
210
  define_object_attrs :blah
211
211
  end
212
- class TestIt < ZohoInvoice::Base
212
+ class ZohoInvoice::TestIt < ZohoInvoice::Base
213
213
  has_many :tunas
214
214
  end
215
215
 
@@ -218,14 +218,14 @@ describe ZohoInvoice::Base do
218
218
  end
219
219
 
220
220
  it "can be created at initialization" do
221
- test = TestIt.new(@client, :tunas => [{:blah => 1234}, Tuna.new(@client, :blah => 5678)])
221
+ test = ZohoInvoice::TestIt.new(@client, :tunas => [{:blah => 1234}, ZohoInvoice::Tuna.new(@client, :blah => 5678)])
222
222
  expect(test.tunas.length).to eq(2)
223
223
  expect(test.tunas.first.blah).to eq(1234)
224
224
  expect(test.tunas.last.blah).to eq(5678)
225
225
  end
226
226
 
227
227
  it "outputted when coverted to xml", :focus => true do
228
- test = TestIt.new(@client, :tunas => [{:blah => 1234}])
228
+ test = ZohoInvoice::TestIt.new(@client, :tunas => [{:blah => 1234}])
229
229
  doc = Nokogiri::XML(test.to_xml)
230
230
  expect(doc.xpath('//Tunas').length).to be >= 1
231
231
  expect(doc.xpath('//Tuna').length).to eq(1)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zoho_invoice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: