netsuite 0.0.17 → 0.0.18
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.
- data/lib/netsuite.rb +4 -0
- data/lib/netsuite/actions/add.rb +11 -11
- data/lib/netsuite/configuration.rb +9 -1
- data/lib/netsuite/namespaces/setup_custom.rb +11 -0
- data/lib/netsuite/records/custom_field_list.rb +1 -1
- data/lib/netsuite/records/custom_record.rb +29 -2
- data/lib/netsuite/records/custom_record_ref.rb +38 -0
- data/lib/netsuite/records/custom_record_type.rb +28 -0
- data/lib/netsuite/records/invoice.rb +5 -1
- data/lib/netsuite/records/invoice_item_list.rb +16 -0
- data/lib/netsuite/records/job.rb +22 -0
- data/lib/netsuite/records/record_ref.rb +18 -8
- data/lib/netsuite/version.rb +1 -1
- data/spec/netsuite/configuration_spec.rb +8 -1
- data/spec/netsuite/records/custom_field_list_spec.rb +21 -3
- data/spec/netsuite/records/custom_record_ref_spec.rb +8 -0
- data/spec/netsuite/records/custom_record_spec.rb +36 -4
- data/spec/netsuite/records/custom_record_type_spec.rb +60 -0
- data/spec/netsuite/records/job_spec.rb +45 -0
- metadata +14 -4
data/lib/netsuite.rb
CHANGED
@@ -11,6 +11,7 @@ require 'netsuite/namespaces/platform_common'
|
|
11
11
|
require 'netsuite/namespaces/list_acct'
|
12
12
|
require 'netsuite/namespaces/list_rel'
|
13
13
|
require 'netsuite/namespaces/tran_sales'
|
14
|
+
require 'netsuite/namespaces/setup_custom'
|
14
15
|
|
15
16
|
# SUPPORT
|
16
17
|
require 'netsuite/support/attributes'
|
@@ -40,6 +41,9 @@ require 'netsuite/records/invoice_item'
|
|
40
41
|
require 'netsuite/records/invoice_item_list'
|
41
42
|
require 'netsuite/records/classification'
|
42
43
|
require 'netsuite/records/custom_record'
|
44
|
+
require 'netsuite/records/custom_record_type'
|
45
|
+
require 'netsuite/records/custom_record_ref'
|
46
|
+
require 'netsuite/records/job'
|
43
47
|
|
44
48
|
module NetSuite
|
45
49
|
|
data/lib/netsuite/actions/add.rb
CHANGED
@@ -17,6 +17,7 @@ module NetSuite
|
|
17
17
|
soap.namespaces['xmlns:tranSales'] = 'urn:sales_2011_2.transactions.webservices.netsuite.com'
|
18
18
|
soap.namespaces['xmlns:platformCommon'] = 'urn:common_2011_2.platform.webservices.netsuite.com'
|
19
19
|
soap.namespaces['xmlns:listAcct'] = 'urn:accounting_2011_2.lists.webservices.netsuite.com'
|
20
|
+
soap.namespaces['xmlns:setupCustom'] = 'urn:customization_2011_2.setup.webservices.netsuite.com'
|
20
21
|
soap.header = auth_header
|
21
22
|
soap.body = request_body
|
22
23
|
end
|
@@ -31,21 +32,20 @@ module NetSuite
|
|
31
32
|
# </platformMsgs:add>
|
32
33
|
# </soap:Body>
|
33
34
|
def request_body
|
34
|
-
|
35
|
+
body = {
|
35
36
|
'platformMsgs:record' => @obj.to_record,
|
36
37
|
:attributes! => {
|
37
|
-
'platformMsgs:record' => {
|
38
|
-
'xsi:type' => @obj.record_type
|
39
|
-
}
|
38
|
+
'platformMsgs:record' => {}
|
40
39
|
}
|
41
40
|
}
|
42
|
-
if @obj.respond_to?(:
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
41
|
+
body[:attributes!]['platformMsgs:record']['externalId'] = @obj.external_id if @obj.respond_to?(:external_id) && @obj.external_id
|
42
|
+
body[:attributes!]['platformMsgs:record']['internalId'] = @obj.internal_id if @obj.respond_to?(:internal_id) && @obj.internal_id
|
43
|
+
body[:attributes!]['platformMsgs:record']['xsi:type'] = @obj.kind_of?(NetSuite::Records::CustomRecord) ? @obj.record_type : soap_type
|
44
|
+
body
|
45
|
+
end
|
46
|
+
|
47
|
+
def soap_type
|
48
|
+
@obj.class.to_s.split('::').last.lower_camelcase
|
49
49
|
end
|
50
50
|
|
51
51
|
def success?
|
@@ -31,11 +31,19 @@ module NetSuite
|
|
31
31
|
'platformMsgs:passport' => {
|
32
32
|
'platformCore:email' => email,
|
33
33
|
'platformCore:password' => password,
|
34
|
-
'platformCore:account' => account.to_s
|
34
|
+
'platformCore:account' => account.to_s,
|
35
|
+
'platformCore:role' => role.to_record,
|
36
|
+
:attributes! => {
|
37
|
+
'platformCore:role' => role.attributes!
|
38
|
+
}
|
35
39
|
}
|
36
40
|
}
|
37
41
|
end
|
38
42
|
|
43
|
+
def role
|
44
|
+
attributes[:role] ||= NetSuite::Records::RecordRef.new(:internal_id => '3', :type => 'role')
|
45
|
+
end
|
46
|
+
|
39
47
|
def email=(email)
|
40
48
|
attributes[:email] = email
|
41
49
|
end
|
@@ -8,7 +8,7 @@ module NetSuite
|
|
8
8
|
when Hash
|
9
9
|
custom_fields << CustomField.new(attributes[:custom_field])
|
10
10
|
when Array
|
11
|
-
attributes[:custom_field].each { |custom_field| custom_fields << CustomField.new(
|
11
|
+
attributes[:custom_field].each { |custom_field| custom_fields << CustomField.new(custom_field) }
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -2,18 +2,36 @@ module NetSuite
|
|
2
2
|
module Records
|
3
3
|
class CustomRecord
|
4
4
|
include Support::Fields
|
5
|
+
include Support::RecordRefs
|
6
|
+
include Support::Records
|
7
|
+
include Namespaces::SetupCustom
|
5
8
|
|
6
9
|
fields :allow_attachments, :allow_inline_editing, :allow_numbering_override, :allow_quick_search, :created,
|
7
|
-
:custom_record_id, :description, :disclaimer, :enabl_email_merge, :enable_numbering,
|
8
|
-
:is_available_offline, :is_inactive, :is_numbering_updateable, :is_ordered, :last_modified, :name,
|
10
|
+
:custom_field_list, :custom_record_id, :description, :disclaimer, :enabl_email_merge, :enable_numbering,
|
11
|
+
:include_name, :is_available_offline, :is_inactive, :is_numbering_updateable, :is_ordered, :last_modified, :name,
|
9
12
|
:numbering_current_number, :numbering_init, :numbering_min_digits, :numbering_prefix, :numbering_suffix,
|
10
13
|
:record_name, :script_id, :show_creation_date, :show_creation_date_on_list, :show_id, :show_last_modified_on_list,
|
11
14
|
:show_last_modified, :show_notes, :show_owner, :show_owner_allow_change, :show_owner_on_list, :use_permissions
|
12
15
|
|
16
|
+
record_refs :custom_form, :owner, :rec_type
|
17
|
+
|
18
|
+
attr_reader :internal_id
|
19
|
+
attr_accessor :external_id
|
20
|
+
|
13
21
|
def initialize(attributes = {})
|
22
|
+
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
23
|
+
@external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
|
14
24
|
initialize_from_attributes_hash(attributes)
|
15
25
|
end
|
16
26
|
|
27
|
+
def custom_field_list
|
28
|
+
attributes[:custom_field_list] ||= CustomFieldList.new
|
29
|
+
end
|
30
|
+
|
31
|
+
def custom_field_list=(attrs)
|
32
|
+
attributes[:custom_field_list] = attrs.kind_of?(CustomFieldList) ? attrs : CustomFieldList.new(attrs)
|
33
|
+
end
|
34
|
+
|
17
35
|
def self.get(options = {})
|
18
36
|
options.merge!(:type_id => type_id) unless options[:type_id]
|
19
37
|
response = Actions::Get.call(self, options.merge!(:custom => true))
|
@@ -24,6 +42,11 @@ module NetSuite
|
|
24
42
|
end
|
25
43
|
end
|
26
44
|
|
45
|
+
def add
|
46
|
+
response = Actions::Add.call(self)
|
47
|
+
response.success?
|
48
|
+
end
|
49
|
+
|
27
50
|
def self.type_id(id = nil)
|
28
51
|
if id
|
29
52
|
@type_id = id
|
@@ -32,6 +55,10 @@ module NetSuite
|
|
32
55
|
end
|
33
56
|
end
|
34
57
|
|
58
|
+
def record_type
|
59
|
+
"#{record_namespace}:CustomRecord"
|
60
|
+
end
|
61
|
+
|
35
62
|
end
|
36
63
|
end
|
37
64
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class CustomRecordRef
|
4
|
+
include Support::Fields
|
5
|
+
include Support::Records
|
6
|
+
include Namespaces::PlatformCore
|
7
|
+
|
8
|
+
attr_reader :internal_id
|
9
|
+
attr_accessor :external_id, :type_id
|
10
|
+
|
11
|
+
def initialize(attributes_or_record = {})
|
12
|
+
case attributes_or_record
|
13
|
+
when Hash
|
14
|
+
attributes = attributes_or_record
|
15
|
+
attributes.delete(:"@xmlns:platform_core")
|
16
|
+
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
17
|
+
@external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
|
18
|
+
@type_id = attributes.delete(:type_id) || attributes.delete(:@type_id)
|
19
|
+
initialize_from_attributes_hash(attributes)
|
20
|
+
else
|
21
|
+
record = attributes_or_record
|
22
|
+
@internal_id = record.internal_id if record.respond_to?(:internal_id)
|
23
|
+
@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
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def method_missing(m, *args, &block)
|
29
|
+
if attributes.keys.map(&:to_sym).include?(m.to_sym)
|
30
|
+
attributes[m.to_sym]
|
31
|
+
else
|
32
|
+
super
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class CustomRecordType
|
4
|
+
include Support::Fields
|
5
|
+
|
6
|
+
fields :allow_attachments, :allow_inline_editing, :allow_numbering_override, :allow_quick_search, :description, :disclaimer, :enable_mail_merge, :enable_numbering, :include_name, :is_available_offline, :is_inactive, :is_numbering_updateable, :is_ordered, :numbering_current_number, :numbering_init, :numbering_min_digits, :numbering_prefix, :numbering_suffix, :record_name, :script_id, :show_creation_date, :show_creation_date_on_list, :show_id, :show_last_modified, :show_last_modified_on_list, :show_notes, :show_owner, :show_owner_allow_change, :show_owner_on_list, :use_permissions
|
7
|
+
|
8
|
+
attr_reader :internal_id
|
9
|
+
attr_accessor :external_id
|
10
|
+
|
11
|
+
def initialize(attributes = {})
|
12
|
+
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
13
|
+
@external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
|
14
|
+
initialize_from_attributes_hash(attributes)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.get(options = {})
|
18
|
+
response = Actions::Get.call(self, options)
|
19
|
+
if response.success?
|
20
|
+
new(response.body)
|
21
|
+
else
|
22
|
+
raise RecordNotFound, "#{self} with OPTIONS=#{options.inspect} could not be found"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -15,7 +15,7 @@ module NetSuite
|
|
15
15
|
:exp_cost_tax_rate_2, :fax, :fob, :gift_cert_applied, :gift_cert_redemption_list, :handling_cost, :handling_tax_1_rate,
|
16
16
|
:handling_tax_2_rate, :handling_tax_code, :is_taxable, :item_cost_disc_amount, :item_cost_disc_print,
|
17
17
|
:item_cost_disc_rate, :item_cost_disc_tax_1_amt, :item_cost_disc_taxable, :item_cost_discount, :item_cost_list,
|
18
|
-
:item_cost_tax_code, :item_cost_tax_rate_1, :item_cost_tax_rate_2, :job, :last_modified_date,
|
18
|
+
:item_cost_tax_code, :item_cost_tax_rate_1, :item_cost_tax_rate_2, :item_list, :job, :last_modified_date,
|
19
19
|
:lead_source, :linked_tracking_numbers, :location, :memo, :message, :message_sel, :on_credit_hold, :opportunity,
|
20
20
|
:other_ref_name, :partner, :partners_list, :promo_code, :rev_rec_end_date,
|
21
21
|
:rev_rec_on_rev_commitment, :rev_rec_schedule, :rev_rec_start_date, :revenue_status, :sales_effective_date,
|
@@ -60,6 +60,10 @@ module NetSuite
|
|
60
60
|
attributes[:item_list] ||= InvoiceItemList.new
|
61
61
|
end
|
62
62
|
|
63
|
+
def item_list=(attrs)
|
64
|
+
attributes[:item_list] = InvoiceItemList.new(attrs)
|
65
|
+
end
|
66
|
+
|
63
67
|
def custom_field_list
|
64
68
|
attributes[:custom_field_list] ||= CustomFieldList.new
|
65
69
|
end
|
@@ -1,8 +1,24 @@
|
|
1
1
|
module NetSuite
|
2
2
|
module Records
|
3
3
|
class InvoiceItemList
|
4
|
+
include Support::Fields
|
4
5
|
include Namespaces::TranSales
|
5
6
|
|
7
|
+
fields :item
|
8
|
+
|
9
|
+
def initialize(attributes = {})
|
10
|
+
initialize_from_attributes_hash(attributes)
|
11
|
+
end
|
12
|
+
|
13
|
+
def item=(items)
|
14
|
+
case items
|
15
|
+
when Hash
|
16
|
+
self.items << InvoiceItem.new(items)
|
17
|
+
when Array
|
18
|
+
items.each { |item| self.items << InvoiceItem.new(item) }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
6
22
|
def items
|
7
23
|
@items ||= []
|
8
24
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class Job
|
4
|
+
include Support::Fields
|
5
|
+
|
6
|
+
fields :account_number, :allocate_payroll_expenses, :allow_all_resources_for_tasks, :allow_expenses, :allow_time,
|
7
|
+
:alt_name, :alt_phone, :bill_pay, :calculated_end_date, :calculated_end_date_baseline, :comments, :company_name,
|
8
|
+
:date_created, :default_address, :email, :end_date, :entity_id, :estimated_cost, :estimated_gross_profit,
|
9
|
+
:estimated_gross_profit_percent, :estimated_labor_cost, :estimated_labor_cost_baseline, :estimated_labor_revenue,
|
10
|
+
:estimated_revenue, :estimated_time, :fax, :fx_rate, :include_crm_tasks_in_totals, :is_exempt_time, :is_inactive,
|
11
|
+
:is_productive_time, :is_utilized_time, :job_price, :last_baseline_date, :last_modified_date, :limit_time_to_assignees,
|
12
|
+
:materialize_time, :opening_balance, :opening_balance_account, :opening_balance_date, :percent_complete,
|
13
|
+
:percent_time_complete, :phone, :phonetic_name, :projected_end_date, :projected_end_date_baseline, :start_date,
|
14
|
+
:start_date_baseline
|
15
|
+
|
16
|
+
def initialize(attributes = {})
|
17
|
+
initialize_from_attributes_hash(attributes)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -11,15 +11,17 @@ module NetSuite
|
|
11
11
|
def initialize(attributes_or_record = {})
|
12
12
|
case attributes_or_record
|
13
13
|
when Hash
|
14
|
-
attributes_or_record
|
15
|
-
|
16
|
-
@
|
17
|
-
@
|
18
|
-
@
|
14
|
+
attributes = attributes_or_record
|
15
|
+
attributes.delete(:"@xmlns:platform_core")
|
16
|
+
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
17
|
+
@external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
|
18
|
+
@type = attributes.delete(:type) || attributes.delete(:@type)
|
19
|
+
@attributes = attributes
|
19
20
|
else
|
20
|
-
|
21
|
-
@
|
22
|
-
@
|
21
|
+
record = attributes_or_record
|
22
|
+
@internal_id = record.internal_id if record.respond_to?(:internal_id)
|
23
|
+
@external_id = record.external_id if record.respond_to?(:external_id)
|
24
|
+
@type = record.class.to_s.split('::').last.lower_camelcase
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
@@ -31,6 +33,14 @@ module NetSuite
|
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
36
|
+
def attributes!
|
37
|
+
hash = {}
|
38
|
+
hash[:internalId] = @internal_id if @internal_id
|
39
|
+
hash[:externalId] = @external_id if @external_id
|
40
|
+
hash[:type] = @type if @type
|
41
|
+
hash
|
42
|
+
end
|
43
|
+
|
34
44
|
end
|
35
45
|
end
|
36
46
|
end
|
data/lib/netsuite/version.rb
CHANGED
@@ -52,7 +52,14 @@ describe NetSuite::Configuration do
|
|
52
52
|
'platformMsgs:passport' => {
|
53
53
|
'platformCore:email' => 'user@example.com',
|
54
54
|
'platformCore:password' => 'myPassword',
|
55
|
-
'platformCore:account' => '1234'
|
55
|
+
'platformCore:account' => '1234',
|
56
|
+
'platformCore:role' => {},
|
57
|
+
:attributes! => {
|
58
|
+
'platformCore:role' => {
|
59
|
+
:internalId => '3',
|
60
|
+
:type => 'role'
|
61
|
+
}
|
62
|
+
}
|
56
63
|
}
|
57
64
|
})
|
58
65
|
end
|
@@ -8,10 +8,28 @@ describe NetSuite::Records::CustomFieldList do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
describe '#to_record' do
|
11
|
+
before do
|
12
|
+
list.custom_fields << NetSuite::Records::CustomField.new(
|
13
|
+
:internal_id => '3',
|
14
|
+
:type => 'BooleanCustomFieldRef',
|
15
|
+
:value => false
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
11
19
|
it 'can represent itself as a SOAP record' do
|
12
|
-
record =
|
13
|
-
|
14
|
-
|
20
|
+
record = [
|
21
|
+
{
|
22
|
+
'platformCore:customField' => {
|
23
|
+
'platformCore:value' => false
|
24
|
+
},
|
25
|
+
:attributes! => {
|
26
|
+
'platformCore:customField' => {
|
27
|
+
'internalId' => '3',
|
28
|
+
'xsi:type' => 'BooleanCustomFieldRef'
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
]
|
15
33
|
list.to_record.should eql(record)
|
16
34
|
end
|
17
35
|
end
|
@@ -2,10 +2,6 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe NetSuite::Records::CustomRecord do
|
4
4
|
let(:record) { NetSuite::Records::CustomRecord.new }
|
5
|
-
#<element name="customForm" type="platformCore:RecordRef" minOccurs="0"/>
|
6
|
-
#<element name="owner" type="platformCore:RecordRef" minOccurs="0"/>
|
7
|
-
#<element name="recType" type="platformCore:RecordRef" minOccurs="0"/>
|
8
|
-
#<element name="customFieldList" type="platformCore:CustomFieldList" minOccurs="0"/>
|
9
5
|
|
10
6
|
it 'has all the right fields' do
|
11
7
|
[
|
@@ -20,6 +16,18 @@ describe NetSuite::Records::CustomRecord do
|
|
20
16
|
end
|
21
17
|
end
|
22
18
|
|
19
|
+
it 'has all the right record_refs' do
|
20
|
+
[
|
21
|
+
:custom_form, :owner
|
22
|
+
].each do |record_ref|
|
23
|
+
record.should have_record_ref(record_ref)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'has a custom_field_list' do
|
28
|
+
record.custom_field_list.should be_kind_of(NetSuite::Records::CustomFieldList)
|
29
|
+
end
|
30
|
+
|
23
31
|
describe '.get' do
|
24
32
|
context 'when the response is successful' do
|
25
33
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :allow_quick_search => true }) }
|
@@ -49,4 +57,28 @@ describe NetSuite::Records::CustomRecord do
|
|
49
57
|
end
|
50
58
|
end
|
51
59
|
|
60
|
+
describe '#add' do
|
61
|
+
context 'when the response is successful' do
|
62
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
63
|
+
|
64
|
+
it 'returns true' do
|
65
|
+
NetSuite::Actions::Add.should_receive(:call).
|
66
|
+
with(record).
|
67
|
+
and_return(response)
|
68
|
+
record.add
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'when the response is unsuccessful' do
|
73
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
74
|
+
|
75
|
+
it 'returns false' do
|
76
|
+
NetSuite::Actions::Add.should_receive(:call).
|
77
|
+
with(record).
|
78
|
+
and_return(response)
|
79
|
+
record.add.should be_false
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
52
84
|
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::CustomRecordType do
|
4
|
+
let(:record_type) { NetSuite::Records::CustomRecordType.new }
|
5
|
+
|
6
|
+
# <element name="owner" type="platformCore:RecordRef" minOccurs="0"/>
|
7
|
+
|
8
|
+
# <element name="fieldList" type="setupCustom:CustomRecordTypeFieldList" minOccurs="0"/>
|
9
|
+
# <element name="tabsList" type="setupCustom:CustomRecordTypeTabsList" minOccurs="0"/>
|
10
|
+
# <element name="sublistsList" type="setupCustom:CustomRecordTypeSublistsList" minOccurs="0"/>
|
11
|
+
# <element name="formsList" type="setupCustom:CustomRecordTypeFormsList" minOccurs="0"/>
|
12
|
+
# <element name="onlineFormsList" type="setupCustom:CustomRecordTypeOnlineFormsList" minOccurs="0"/>
|
13
|
+
# <element name="permissionsList" type="setupCustom:CustomRecordTypePermissionsList" minOccurs="0"/>
|
14
|
+
# <element name="linksList" type="setupCustom:CustomRecordTypeLinksList" minOccurs="0"/>
|
15
|
+
# <element name="managersList" type="setupCustom:CustomRecordTypeManagersList" minOccurs="0"/>
|
16
|
+
# <element name="childrenList" type="setupCustom:CustomRecordTypeChildrenList" minOccurs="0"/>
|
17
|
+
# <element name="parentsList" type="setupCustom:CustomRecordTypeParentsList" minOccurs="0"/>
|
18
|
+
# <element name="translationsList" type="setupCustom:CustomRecordTypeTranslationsList" minOccurs="0"/>
|
19
|
+
it 'has all the right fields' do
|
20
|
+
[
|
21
|
+
:allow_attachments, :allow_inline_editing, :allow_numbering_override, :allow_quick_search, :description, :disclaimer,
|
22
|
+
:enable_mail_merge, :enable_numbering, :include_name, :is_available_offline, :is_inactive, :is_numbering_updateable,
|
23
|
+
:is_ordered, :numbering_current_number, :numbering_init, :numbering_min_digits, :numbering_prefix, :numbering_suffix,
|
24
|
+
:record_name, :script_id, :show_creation_date, :show_creation_date_on_list, :show_id, :show_last_modified,
|
25
|
+
:show_last_modified_on_list, :show_notes, :show_owner, :show_owner_allow_change, :show_owner_on_list, :use_permissions
|
26
|
+
].each do |field|
|
27
|
+
record_type.should have_field(field)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '.get' do
|
32
|
+
context 'when the response is successful' do
|
33
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :allow_attachments => true }) }
|
34
|
+
|
35
|
+
it 'returns a Customer instance populated with the data from the response object' do
|
36
|
+
NetSuite::Actions::Get.should_receive(:call).
|
37
|
+
with(NetSuite::Records::CustomRecordType, :external_id => 1).
|
38
|
+
and_return(response)
|
39
|
+
record_type = NetSuite::Records::CustomRecordType.get(:external_id => 1)
|
40
|
+
record_type.should be_kind_of(NetSuite::Records::CustomRecordType)
|
41
|
+
record_type.allow_attachments.should be_true
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'when the response is unsuccessful' do
|
46
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
47
|
+
|
48
|
+
it 'raises a RecordNotFound exception' do
|
49
|
+
NetSuite::Actions::Get.should_receive(:call).
|
50
|
+
with(NetSuite::Records::CustomRecordType, :external_id => 1).
|
51
|
+
and_return(response)
|
52
|
+
lambda {
|
53
|
+
NetSuite::Records::CustomRecordType.get(:external_id => 1)
|
54
|
+
}.should raise_error(NetSuite::RecordNotFound,
|
55
|
+
/NetSuite::Records::CustomRecordType with OPTIONS=(.*) could not be found/)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::Job do
|
4
|
+
let(:job) { NetSuite::Records::Job.new }
|
5
|
+
|
6
|
+
#<element name="customForm" type="platformCore:RecordRef" minOccurs="0"/>
|
7
|
+
#<element name="entityStatus" type="platformCore:RecordRef" minOccurs="0"/>
|
8
|
+
#<element name="parent" type="platformCore:RecordRef" minOccurs="0"/>
|
9
|
+
#<element name="category" type="platformCore:RecordRef" minOccurs="0"/>
|
10
|
+
#<element name="workplace" type="platformCore:RecordRef" minOccurs="0"/>
|
11
|
+
#<element name="language" type="platformCore:RecordRef" minOccurs="0"/>
|
12
|
+
#<element name="currency" type="platformCore:RecordRef" minOccurs="0"/>
|
13
|
+
#<element name="jobType" type="platformCore:RecordRef" minOccurs="0"/>
|
14
|
+
#<element name="estimatedTimeOverride" type="platformCore:Duration" minOccurs="0"/>
|
15
|
+
#<element name="emailPreference" type="listRelTyp:EmailPreference" minOccurs="0"/>
|
16
|
+
#<element name="subsidiary" type="platformCore:RecordRef" minOccurs="0"/>
|
17
|
+
#<element name="jobBillingType" type="listRelTyp:JobBillingType" minOccurs="0"/>
|
18
|
+
#<element name="billingSchedule" type="platformCore:RecordRef" minOccurs="0"/>
|
19
|
+
#<element name="jobItem" type="platformCore:RecordRef" minOccurs="0"/>
|
20
|
+
#<element name="actualTime" type="platformCore:Duration" minOccurs="0"/>
|
21
|
+
#<element name="timeRemaining" type="platformCore:Duration" minOccurs="0"/>
|
22
|
+
#<element name="estimateRevRecTemplate" type="platformCore:RecordRef" minOccurs="0"/>
|
23
|
+
#<element name="globalSubscriptionStatus" type="platformCommonTyp:GlobalSubscriptionStatus" minOccurs="0"/>
|
24
|
+
#<element name="jobResourcesList" type="listRel:JobResourcesList" minOccurs="0"/>
|
25
|
+
#<element name="addressbookList" type="listRel:JobAddressbookList" minOccurs="0"/>
|
26
|
+
#<element name="milestonesList" type="listRel:JobMilestonesList" minOccurs="0"/>
|
27
|
+
#<element name="creditCardsList" type="listRel:JobCreditCardsList" minOccurs="0"/>
|
28
|
+
#<element name="customFieldList" type="platformCore:CustomFieldList" minOccurs="0"/>
|
29
|
+
|
30
|
+
it 'has all the right fields' do
|
31
|
+
[
|
32
|
+
:account_number, :allocate_payroll_expenses, :allow_all_resources_for_tasks, :allow_expenses, :allow_time, :alt_name,
|
33
|
+
:alt_phone, :bill_pay, :calculated_end_date, :calculated_end_date_baseline, :comments, :company_name, :date_created,
|
34
|
+
:default_address, :email, :end_date, :entity_id, :estimated_cost, :estimated_gross_profit, :estimated_gross_profit_percent,
|
35
|
+
:estimated_labor_cost, :estimated_labor_cost_baseline, :estimated_labor_revenue, :estimated_revenue, :estimated_time, :fax,
|
36
|
+
:fx_rate, :include_crm_tasks_in_totals, :is_exempt_time, :is_inactive, :is_productive_time, :is_utilized_time, :job_price,
|
37
|
+
:last_baseline_date, :last_modified_date, :limit_time_to_assignees, :materialize_time, :opening_balance,
|
38
|
+
:opening_balance_account, :opening_balance_date, :percent_complete, :percent_time_complete, :phone, :phonetic_name,
|
39
|
+
:projected_end_date, :projected_end_date_baseline, :start_date, :start_date_baseline
|
40
|
+
].each do |field|
|
41
|
+
job.should have_field(field)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
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: 59
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 18
|
10
|
+
version: 0.0.18
|
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-18 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: savon
|
@@ -110,18 +110,22 @@ files:
|
|
110
110
|
- lib/netsuite/namespaces/list_rel.rb
|
111
111
|
- lib/netsuite/namespaces/platform_common.rb
|
112
112
|
- lib/netsuite/namespaces/platform_core.rb
|
113
|
+
- lib/netsuite/namespaces/setup_custom.rb
|
113
114
|
- lib/netsuite/namespaces/tran_sales.rb
|
114
115
|
- lib/netsuite/records/bill_address.rb
|
115
116
|
- lib/netsuite/records/classification.rb
|
116
117
|
- lib/netsuite/records/custom_field.rb
|
117
118
|
- lib/netsuite/records/custom_field_list.rb
|
118
119
|
- lib/netsuite/records/custom_record.rb
|
120
|
+
- lib/netsuite/records/custom_record_ref.rb
|
121
|
+
- lib/netsuite/records/custom_record_type.rb
|
119
122
|
- lib/netsuite/records/customer.rb
|
120
123
|
- lib/netsuite/records/customer_addressbook.rb
|
121
124
|
- lib/netsuite/records/customer_addressbook_list.rb
|
122
125
|
- lib/netsuite/records/invoice.rb
|
123
126
|
- lib/netsuite/records/invoice_item.rb
|
124
127
|
- lib/netsuite/records/invoice_item_list.rb
|
128
|
+
- lib/netsuite/records/job.rb
|
125
129
|
- lib/netsuite/records/non_inventory_sale_item.rb
|
126
130
|
- lib/netsuite/records/record_ref.rb
|
127
131
|
- lib/netsuite/records/ship_address.rb
|
@@ -142,13 +146,16 @@ files:
|
|
142
146
|
- spec/netsuite/records/classification_spec.rb
|
143
147
|
- spec/netsuite/records/custom_field_list_spec.rb
|
144
148
|
- spec/netsuite/records/custom_field_spec.rb
|
149
|
+
- spec/netsuite/records/custom_record_ref_spec.rb
|
145
150
|
- spec/netsuite/records/custom_record_spec.rb
|
151
|
+
- spec/netsuite/records/custom_record_type_spec.rb
|
146
152
|
- spec/netsuite/records/customer_addressbook_list_spec.rb
|
147
153
|
- spec/netsuite/records/customer_addressbook_spec.rb
|
148
154
|
- spec/netsuite/records/customer_spec.rb
|
149
155
|
- spec/netsuite/records/invoice_item_list_spec.rb
|
150
156
|
- spec/netsuite/records/invoice_item_spec.rb
|
151
157
|
- spec/netsuite/records/invoice_spec.rb
|
158
|
+
- spec/netsuite/records/job_spec.rb
|
152
159
|
- spec/netsuite/records/non_inventory_sale_item_spec.rb
|
153
160
|
- spec/netsuite/records/record_ref_spec.rb
|
154
161
|
- spec/netsuite/records/ship_address_spec.rb
|
@@ -216,13 +223,16 @@ test_files:
|
|
216
223
|
- spec/netsuite/records/classification_spec.rb
|
217
224
|
- spec/netsuite/records/custom_field_list_spec.rb
|
218
225
|
- spec/netsuite/records/custom_field_spec.rb
|
226
|
+
- spec/netsuite/records/custom_record_ref_spec.rb
|
219
227
|
- spec/netsuite/records/custom_record_spec.rb
|
228
|
+
- spec/netsuite/records/custom_record_type_spec.rb
|
220
229
|
- spec/netsuite/records/customer_addressbook_list_spec.rb
|
221
230
|
- spec/netsuite/records/customer_addressbook_spec.rb
|
222
231
|
- spec/netsuite/records/customer_spec.rb
|
223
232
|
- spec/netsuite/records/invoice_item_list_spec.rb
|
224
233
|
- spec/netsuite/records/invoice_item_spec.rb
|
225
234
|
- spec/netsuite/records/invoice_spec.rb
|
235
|
+
- spec/netsuite/records/job_spec.rb
|
226
236
|
- spec/netsuite/records/non_inventory_sale_item_spec.rb
|
227
237
|
- spec/netsuite/records/record_ref_spec.rb
|
228
238
|
- spec/netsuite/records/ship_address_spec.rb
|