netsuite 0.0.35 → 0.0.36
Sign up to get free protection for your applications and to get access to all the features.
@@ -16,12 +16,14 @@ module NetSuite
|
|
16
16
|
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
17
17
|
@external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
|
18
18
|
@type_id = attributes.delete(:type_id) || attributes.delete(:@type_id)
|
19
|
+
@type_id = @type_id.to_s if @type_id
|
19
20
|
initialize_from_attributes_hash(attributes)
|
20
21
|
else
|
21
22
|
record = attributes_or_record
|
22
23
|
@internal_id = record.internal_id if record.respond_to?(:internal_id)
|
23
24
|
@external_id = record.external_id if record.respond_to?(:external_id)
|
24
|
-
@type_id = record.class.type_id if record.respond_to?(:type_id) && record.class.type_id
|
25
|
+
@type_id = record.class.type_id if record.class.respond_to?(:type_id) && record.class.type_id
|
26
|
+
@type_id = @type_id.to_s if @type_id
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
@@ -11,21 +11,7 @@ module NetSuite
|
|
11
11
|
else
|
12
12
|
"#{record_namespace}:#{k.to_s.lower_camelcase}"
|
13
13
|
end
|
14
|
-
|
15
|
-
hash[:attributes!] ||= {}
|
16
|
-
hash[:attributes!][kname] ||= {}
|
17
|
-
hash[:attributes!][kname]['internalId'] = v.internal_id
|
18
|
-
end
|
19
|
-
if v.respond_to?(:external_id) && v.external_id
|
20
|
-
hash[:attributes!] ||= {}
|
21
|
-
hash[:attributes!][kname] ||= {}
|
22
|
-
hash[:attributes!][kname]['externalId'] = v.external_id
|
23
|
-
end
|
24
|
-
if v.kind_of?(NetSuite::Records::RecordRef) && v.type
|
25
|
-
hash[:attributes!] ||= {}
|
26
|
-
hash[:attributes!][kname] ||= {}
|
27
|
-
hash[:attributes!][kname]['type'] = v.type.lower_camelcase
|
28
|
-
end
|
14
|
+
to_attributes!(hash, kname, v)
|
29
15
|
if Array === v
|
30
16
|
v = v.map { |i| i.respond_to?(:to_record) ? i.to_record : i }
|
31
17
|
else
|
@@ -36,6 +22,29 @@ module NetSuite
|
|
36
22
|
end
|
37
23
|
end
|
38
24
|
|
25
|
+
def to_attributes!(hash, kname, v)
|
26
|
+
if v.respond_to?(:internal_id) && v.internal_id
|
27
|
+
hash[:attributes!] ||= {}
|
28
|
+
hash[:attributes!][kname] ||= {}
|
29
|
+
hash[:attributes!][kname]['internalId'] = v.internal_id
|
30
|
+
end
|
31
|
+
if v.respond_to?(:external_id) && v.external_id
|
32
|
+
hash[:attributes!] ||= {}
|
33
|
+
hash[:attributes!][kname] ||= {}
|
34
|
+
hash[:attributes!][kname]['externalId'] = v.external_id
|
35
|
+
end
|
36
|
+
if v.kind_of?(NetSuite::Records::RecordRef) && v.type
|
37
|
+
hash[:attributes!] ||= {}
|
38
|
+
hash[:attributes!][kname] ||= {}
|
39
|
+
hash[:attributes!][kname]['type'] = v.type.lower_camelcase
|
40
|
+
end
|
41
|
+
if v.kind_of?(NetSuite::Records::CustomRecordRef) && v.type_id
|
42
|
+
hash[:attributes!] ||= {}
|
43
|
+
hash[:attributes!][kname] ||= {}
|
44
|
+
hash[:attributes!][kname]['typeId'] = v.type_id.lower_camelcase
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
39
48
|
def record_type
|
40
49
|
"#{record_namespace}:#{self.class.to_s.split('::').last}"
|
41
50
|
end
|
data/lib/netsuite/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netsuite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 87
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 36
|
10
|
+
version: 0.0.36
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Moran
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-01-
|
18
|
+
date: 2012-01-26 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: savon
|
@@ -269,7 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
269
269
|
requirements: []
|
270
270
|
|
271
271
|
rubyforge_project:
|
272
|
-
rubygems_version: 1.8.
|
272
|
+
rubygems_version: 1.8.10
|
273
273
|
signing_key:
|
274
274
|
specification_version: 3
|
275
275
|
summary: NetSuite SuiteTalk API Wrapper
|