zoho_invoice 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -107,9 +107,15 @@ module ZohoInvoice
107
107
 
108
108
  protected
109
109
 
110
- def self.camel_case(str)
110
+ def self.camel_case(str)
111
111
  return str if str !~ /_/ && str =~ /[A-Z]+.*/
112
- str.split('_').map{|e| e.capitalize}.join
112
+ str.split('_').map do |e|
113
+ if e == "id"
114
+ e.upcase
115
+ else
116
+ e.capitalize
117
+ end
118
+ end.join
113
119
  end
114
120
 
115
121
  def camel_case(str)
@@ -1,3 +1,3 @@
1
1
  module ZohoInvoice
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
@@ -77,6 +77,16 @@ describe ZohoInvoice::Base do
77
77
  expect(xml.xpath('//TestIt')).to be_empty
78
78
  end
79
79
 
80
+ it "should create id attributes correctly" do
81
+ @test_obj.something_id = '7890'
82
+ xml = Nokogiri::XML(@test_obj.to_xml)
83
+ expect(xml.xpath('//SomethingID').first.text).to eq('7890')
84
+
85
+ @test_obj.something_id = nil
86
+ xml = Nokogiri::XML(@test_obj.to_xml)
87
+ expect(xml.xpath('//SomethingID')).to be_empty
88
+ end
89
+
80
90
  it "should create the associations correctly" do
81
91
  class Thing < Struct.new(:stuff)
82
92
  def to_xml(*args)
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.3.3
4
+ version: 0.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-02 00:00:00.000000000 Z
12
+ date: 2013-05-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler