netsuite 0.4.8 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile +2 -1
- data/README.md +11 -1
- data/circle.yml +0 -0
- data/lib/netsuite.rb +8 -1
- data/lib/netsuite/actions/search.rb +14 -8
- data/lib/netsuite/records/cash_sale.rb +4 -0
- data/lib/netsuite/records/customer.rb +3 -1
- data/lib/netsuite/records/customer_partner.rb +24 -0
- data/lib/netsuite/records/customer_partners_list.rb +9 -0
- data/lib/netsuite/records/customer_payment.rb +10 -2
- data/lib/netsuite/records/customer_refund.rb +9 -1
- data/lib/netsuite/records/invoice.rb +2 -2
- data/lib/netsuite/records/opportunity.rb +46 -0
- data/lib/netsuite/records/opportunity_item.rb +41 -0
- data/lib/netsuite/records/opportunity_item_list.rb +9 -0
- data/lib/netsuite/records/partner.rb +2 -2
- data/lib/netsuite/records/payment_method.rb +1 -0
- data/lib/netsuite/records/payroll_item.rb +37 -0
- data/lib/netsuite/records/sales_order.rb +1 -1
- data/lib/netsuite/records/vendor_category.rb +26 -0
- data/lib/netsuite/version.rb +1 -1
- data/spec/netsuite/records/basic_record_spec.rb +16 -1
- data/spec/netsuite/records/customer_spec.rb +1 -1
- data/spec/netsuite/records/invoice_spec.rb +2 -2
- data/spec/spec_helper.rb +8 -0
- metadata +10 -4
- data/.travis.yml +0 -3
- data/lib/netsuite/records/transaction.rb +0 -18
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
M2VmMmY0OGFlY2M1NmM2NDI5NTk5NDk3OGM4YzI1YWM2ZmQzNDIzNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGJhM2M0ZGZhNzAyNmYzYTdmYTI5OTc0ZjkyZjk2NGUwYjQ5MzMyMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDZjNjE0N2JmNmNiZTI1Nzc4NjNlZmI1YmU0OTljMzIzM2VhYTIwMWQxODI5
|
10
|
+
NTJiM2JlYjJmMWVmYmJhMDdjOWZhNTdkNDc1ODJhYjAxMmYxNTIyMTI4NmY4
|
11
|
+
NGE0OThmYjhlYzNlODdlNjYwZDk1YzZlOWFlNTVjMjdjNzM1N2U=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODNhNDBhMGUwZDFiYmFiNWQzYzdlN2M3ZjRiNTQyZDRmMzRmN2UwZmQ2NmYx
|
14
|
+
MDg2M2U0YTJiNmZjNGJhMDkxZDFjMTkxMWU3Y2U1ODM3MGIxOWU1NGRmYWNj
|
15
|
+
YWQ3MDE0ZDI5NDJmMmJmNDRjMzdjNDA3NzNhMWM0NDk2Y2I2NmY=
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![
|
1
|
+
[![Circle CI](https://circleci.com/gh/NetSweet/netsuite/tree/master.svg?style=svg)](https://circleci.com/gh/NetSweet/netsuite/tree/master)
|
2
2
|
|
3
3
|
# NetSuite Ruby SuiteTalk Gem
|
4
4
|
|
@@ -413,3 +413,13 @@ states = NetSuite::Configuration.connection.call(:get_all, message: {
|
|
413
413
|
})
|
414
414
|
states.to_array.first[:get_all_response][:get_all_result][:record_list][:record].map { |r| { country: r[:country], abbr: r[:shortname], name: r[:full_name] } }
|
415
415
|
```
|
416
|
+
|
417
|
+
#### 2015_2 ApplicationId Support
|
418
|
+
|
419
|
+
```ruby
|
420
|
+
NetSuite::Configuration.soap_header = {
|
421
|
+
'platformMsgs:ApplicationInfo' => {
|
422
|
+
'platformMsgs:applicationId' => 'your-netsuite-app-id'
|
423
|
+
}
|
424
|
+
}
|
425
|
+
```
|
data/circle.yml
ADDED
File without changes
|
data/lib/netsuite.rb
CHANGED
@@ -99,6 +99,7 @@ module NetSuite
|
|
99
99
|
autoload :CustomerCurrency, 'netsuite/records/customer_currency'
|
100
100
|
autoload :CustomerCurrencyList, 'netsuite/records/customer_currency_list'
|
101
101
|
autoload :CustomerDeposit, 'netsuite/records/customer_deposit'
|
102
|
+
autoload :CustomerPartnersList, 'netsuite/records/customer_partners_list'
|
102
103
|
autoload :CustomerPayment, 'netsuite/records/customer_payment'
|
103
104
|
autoload :CustomerPaymentApply, 'netsuite/records/customer_payment_apply'
|
104
105
|
autoload :CustomerPaymentApplyList, 'netsuite/records/customer_payment_apply_list'
|
@@ -107,6 +108,7 @@ module NetSuite
|
|
107
108
|
autoload :CustomerRefundApplyList, 'netsuite/records/customer_refund_apply_list'
|
108
109
|
autoload :CustomerRefundDeposit, 'netsuite/records/customer_refund_deposit'
|
109
110
|
autoload :CustomerRefundDepositList, 'netsuite/records/customer_refund_deposit_list'
|
111
|
+
autoload :CustomerPartner, 'netsuite/records/customer_partner'
|
110
112
|
autoload :ContactList, 'netsuite/records/contact_list'
|
111
113
|
autoload :Contact, 'netsuite/records/contact'
|
112
114
|
autoload :ContactAccessRoles, 'netsuite/records/contact_access_roles'
|
@@ -151,8 +153,12 @@ module NetSuite
|
|
151
153
|
autoload :MatrixOptionList, 'netsuite/records/matrix_option_list'
|
152
154
|
autoload :MemberList, 'netsuite/records/member_list'
|
153
155
|
autoload :NonInventorySaleItem, 'netsuite/records/non_inventory_sale_item'
|
156
|
+
autoload :Opportunity, 'netsuite/records/opportunity'
|
157
|
+
autoload :OpportunityItem, 'netsuite/records/opportunity_item'
|
158
|
+
autoload :OpportunityItemList, 'netsuite/records/opportunity_item_list'
|
154
159
|
autoload :Partner, 'netsuite/records/partner'
|
155
160
|
autoload :PaymentMethod, 'netsuite/records/payment_method'
|
161
|
+
autoload :PayrollItem, 'netsuite/records/payroll_item'
|
156
162
|
autoload :PhoneCall, 'netsuite/records/phone_call'
|
157
163
|
autoload :PricingMatrix, 'netsuite/records/pricing_matrix'
|
158
164
|
autoload :PromotionCode, 'netsuite/records/promotion_code'
|
@@ -165,7 +171,7 @@ module NetSuite
|
|
165
171
|
autoload :SalesOrderItem, 'netsuite/records/sales_order_item'
|
166
172
|
autoload :SalesOrderItemList, 'netsuite/records/sales_order_item_list'
|
167
173
|
autoload :SalesTaxItem, 'netsuite/records/sales_tax_item'
|
168
|
-
autoload :ServiceResaleItem,
|
174
|
+
autoload :ServiceResaleItem, 'netsuite/records/service_resale_item'
|
169
175
|
autoload :ServiceSaleItem, 'netsuite/records/service_sale_item'
|
170
176
|
autoload :ShipAddress, 'netsuite/records/ship_address'
|
171
177
|
autoload :SiteCategory, 'netsuite/records/site_category'
|
@@ -185,6 +191,7 @@ module NetSuite
|
|
185
191
|
autoload :VendorBillExpenseList, 'netsuite/records/vendor_bill_expense_list'
|
186
192
|
autoload :VendorBillItem, 'netsuite/records/vendor_bill_item'
|
187
193
|
autoload :VendorBillItemList, 'netsuite/records/vendor_bill_item_list'
|
194
|
+
autoload :VendorCategory, 'netsuite/records/vendor_category'
|
188
195
|
autoload :VendorPayment, 'netsuite/records/vendor_payment'
|
189
196
|
autoload :VendorPaymentApply, 'netsuite/records/vendor_payment_apply'
|
190
197
|
autoload :VendorPaymentApplyList, 'netsuite/records/vendor_payment_apply_list'
|
@@ -22,12 +22,14 @@ module NetSuite
|
|
22
22
|
# https://system.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteCloudCustomizationScriptingWebServices/SuiteTalkWebServices/SettingSearchPreferences.html
|
23
23
|
# https://webservices.netsuite.com/xsd/platform/v2012_2_0/messages.xsd
|
24
24
|
|
25
|
-
preferences = NetSuite::Configuration.auth_header(credentials)
|
26
|
-
|
27
|
-
|
28
|
-
h
|
29
|
-
|
30
|
-
|
25
|
+
preferences = NetSuite::Configuration.auth_header(credentials)
|
26
|
+
.update(NetSuite::Configuration.soap_header)
|
27
|
+
.merge(
|
28
|
+
(@options.delete(:preferences) || {}).inject({'platformMsgs:SearchPreferences' => {}}) do |h, (k, v)|
|
29
|
+
h['platformMsgs:SearchPreferences'][k.to_s.lower_camelcase] = v
|
30
|
+
h
|
31
|
+
end
|
32
|
+
)
|
31
33
|
|
32
34
|
NetSuite::Configuration
|
33
35
|
.connection({ soap_header: preferences }, credentials)
|
@@ -61,8 +63,12 @@ module NetSuite
|
|
61
63
|
criteria = @options[:criteria] || @options
|
62
64
|
|
63
65
|
# TODO find cleaner solution for pulling the namespace of the record, which is a instance method
|
64
|
-
|
65
|
-
|
66
|
+
namespace = if @klass.respond_to?(:search_class_namespace)
|
67
|
+
@klass.search_class_namespace
|
68
|
+
else
|
69
|
+
@klass.new.record_namespace
|
70
|
+
end
|
71
|
+
|
66
72
|
# extract the class name
|
67
73
|
|
68
74
|
criteria_structure = {}
|
@@ -19,7 +19,7 @@ module NetSuite
|
|
19
19
|
:estimated_budget, :fax, :fax_transactions, :first_name, :first_visit, :give_access, :global_subscription_status,
|
20
20
|
:group_pricing_list, :home_phone, :image, :is_budget_approved, :is_inactive, :is_person, :item_pricing_list, :keywords,
|
21
21
|
:language, :last_modified_date, :last_name, :last_page_visited, :last_visit, :middle_name, :mobile_phone,
|
22
|
-
:opening_balance, :opening_balance_account, :opening_balance_date,
|
22
|
+
:opening_balance, :opening_balance_account, :opening_balance_date,
|
23
23
|
:password, :password2, :phone, :phonetic_name, :pref_cc_processor, :print_on_check_as,
|
24
24
|
:print_transactions, :referrer, :reminder_days, :representing_subsidiary, :require_pwd_change, :resale_number,
|
25
25
|
:sales_group, :sales_readiness, :sales_team_list, :salutation, :send_email, :ship_complete, :shipping_item,
|
@@ -31,6 +31,8 @@ module NetSuite
|
|
31
31
|
field :custom_field_list, CustomFieldList
|
32
32
|
field :contact_roles_list, ContactAccessRolesList
|
33
33
|
field :currency_list, CustomerCurrencyList
|
34
|
+
field :partners_list, CustomerPartnersList
|
35
|
+
|
34
36
|
# TODO subscriptions_list
|
35
37
|
|
36
38
|
read_only_fields :balance, :consol_balance, :deposit_balance, :consol_deposit_balance, :overdue_balance,
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class CustomerPartner
|
4
|
+
include Support::Fields
|
5
|
+
include Support::RecordRefs
|
6
|
+
include Support::Records
|
7
|
+
include Namespaces::ListRel
|
8
|
+
|
9
|
+
fields :is_primary, :contribution
|
10
|
+
|
11
|
+
record_refs :partner
|
12
|
+
|
13
|
+
def initialize(attributes_or_record = {})
|
14
|
+
case attributes_or_record
|
15
|
+
when Hash
|
16
|
+
initialize_from_attributes_hash(attributes_or_record)
|
17
|
+
when self.class
|
18
|
+
initialize_from_record(attributes_or_record)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -7,13 +7,13 @@ module NetSuite
|
|
7
7
|
include Support::Actions
|
8
8
|
include Namespaces::TranCust
|
9
9
|
|
10
|
-
actions :get, :get_list, :initialize, :add, :delete, :update, :upsert
|
10
|
+
actions :get, :get_list, :initialize, :add, :delete, :update, :upsert, :search
|
11
11
|
|
12
12
|
fields :auth_code, :auto_apply, :cc_approved, :cc_avs_street_match, :cc_avs_zip_match,
|
13
13
|
:cc_expire_date, :cc_name, :cc_number, :cc_security_code, :cc_security_code_match, :cc_street, :cc_zip_code,
|
14
14
|
:charge_it, :check_num, :created_date, :currency_name, :debit_card_issue_no, :exchange_rate, :ignore_avs,
|
15
15
|
:last_modified_date, :memo, :payment, :pn_ref_num, :status, :three_d_status_code, :tran_date,
|
16
|
-
:undep_funds, :valid_from
|
16
|
+
:undep_funds, :valid_from, :tran_id
|
17
17
|
|
18
18
|
field :custom_field_list, CustomFieldList
|
19
19
|
field :apply_list, CustomerPaymentApplyList
|
@@ -40,6 +40,14 @@ module NetSuite
|
|
40
40
|
rec
|
41
41
|
end
|
42
42
|
|
43
|
+
def self.search_class_name
|
44
|
+
"Transaction"
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.search_class_namespace
|
48
|
+
'tranSales'
|
49
|
+
end
|
50
|
+
|
43
51
|
end
|
44
52
|
end
|
45
53
|
end
|
@@ -7,7 +7,7 @@ module NetSuite
|
|
7
7
|
include Support::Actions
|
8
8
|
include Namespaces::TranCust
|
9
9
|
|
10
|
-
actions :get, :get_list, :initialize, :add, :delete, :update, :upsert
|
10
|
+
actions :get, :get_list, :initialize, :add, :delete, :update, :upsert, :search
|
11
11
|
|
12
12
|
fields :address, :cc_approved, :cc_expire_date, :cc_name, :cc_number, :cc_street, :cc_zip_code, :charge_it,
|
13
13
|
:created_date, :currency_name, :debit_card_issue_no, :exchange_rate, :last_modified_date, :memo, :pn_ref_num, :status,
|
@@ -39,6 +39,14 @@ module NetSuite
|
|
39
39
|
rec
|
40
40
|
end
|
41
41
|
|
42
|
+
def self.search_class_name
|
43
|
+
"Transaction"
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.search_class_namespace
|
47
|
+
'tranSales'
|
48
|
+
end
|
49
|
+
|
42
50
|
end
|
43
51
|
end
|
44
52
|
end
|
@@ -30,7 +30,7 @@ module NetSuite
|
|
30
30
|
:tax_total, :time_disc_amount, :time_disc_print, :time_disc_rate, :time_disc_tax_1_amt, :time_disc_taxable,
|
31
31
|
:time_discount, :time_list, :time_tax_code, :time_tax_rate_1, :time_tax_rate_2, :to_be_emailed, :to_be_faxed,
|
32
32
|
:to_be_printed, :total_cost_estimate, :tracking_numbers, :tran_date, :tran_id, :tran_is_vsoe_bundle,
|
33
|
-
:transaction_bill_address, :transaction_ship_address, :vat_reg_num, :vsoe_auto_calc
|
33
|
+
:transaction_bill_address, :transaction_ship_address, :vat_reg_num, :vsoe_auto_calc, :tax_rate
|
34
34
|
|
35
35
|
field :transaction_bill_address, BillAddress
|
36
36
|
field :transaction_ship_address, ShipAddress
|
@@ -38,7 +38,7 @@ module NetSuite
|
|
38
38
|
field :custom_field_list, CustomFieldList
|
39
39
|
|
40
40
|
read_only_fields :sub_total, :discount_total, :total, :recognized_revenue, :amount_remaining, :amount_paid,
|
41
|
-
:alt_shipping_cost, :gift_cert_applied, :
|
41
|
+
:alt_shipping_cost, :gift_cert_applied, :handling_cost, :alt_handling_cost
|
42
42
|
|
43
43
|
record_refs :account, :bill_address_list, :custom_form, :department, :entity, :klass, :partner,
|
44
44
|
:posting_period, :ship_address_list, :terms, :location, :sales_rep, :tax_item, :created_from,
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class Opportunity
|
4
|
+
include Support::Fields
|
5
|
+
include Support::RecordRefs
|
6
|
+
include Support::Records
|
7
|
+
include Support::Actions
|
8
|
+
include Namespaces::TranSales
|
9
|
+
|
10
|
+
actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :search
|
11
|
+
|
12
|
+
fields :action_item, :alt_sales_range_high, :alt_sales_range_low,
|
13
|
+
:close_date, :contrib_pct, :created_date, :currency_name, :days_open,
|
14
|
+
:estimated_budget, :est_gross_profit, :est_gross_profit_percent,
|
15
|
+
:exchange_rate, :expected_close_date,
|
16
|
+
:is_budget_approved, :last_modified_date,
|
17
|
+
:memo, :probability, :proj_alt_sales_amt, :projected_total,
|
18
|
+
:range_high, :range_low,
|
19
|
+
:ship_is_residential, :source, :status, :sync_partner_teams, :sync_sales_teams,
|
20
|
+
:tax2_total, :tax_total, :title, :total_cost_estimate, :tran_date, :tran_id,
|
21
|
+
:vat_reg_num, :weighted_total
|
22
|
+
|
23
|
+
field :ship_address, ShipAddress
|
24
|
+
field :bill_address, BillAddress
|
25
|
+
field :item_list, OpportunityItemList
|
26
|
+
field :custom_field_list, CustomFieldList
|
27
|
+
|
28
|
+
read_only_fields :discount_total, :sub_total, :tax_total, :total
|
29
|
+
|
30
|
+
record_refs :account, :buying_reason, :currency, :klass, :department, :entity, :entity_status, :location,
|
31
|
+
:partner, :subsidiary, :sales_group, :sales_rep, :custom_form, :job, :forcast_type,
|
32
|
+
:lead_source, :sales_readiness, :win_loss_reason
|
33
|
+
|
34
|
+
attr_reader :internal_id
|
35
|
+
attr_accessor :external_id
|
36
|
+
attr_accessor :search_joins
|
37
|
+
|
38
|
+
def initialize(attributes = {})
|
39
|
+
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
40
|
+
@external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
|
41
|
+
initialize_from_attributes_hash(attributes)
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class OpportunityItem
|
4
|
+
include Support::Fields
|
5
|
+
include Support::RecordRefs
|
6
|
+
include Support::Records
|
7
|
+
include Namespaces::TranSales
|
8
|
+
|
9
|
+
fields :alt_sales_amt, :amount, :cost_estimate, :cost_estimate_type,
|
10
|
+
:description, :expected_ship_date, :from_job, :gross_amt, :is_estimate,
|
11
|
+
:is_taxable, :line, :quantity, :quantity_available, :quantity_on_hand,
|
12
|
+
:rate, :rev_rec_term_in_months,
|
13
|
+
:tax1_amt, :tax_rate1, :tax_rate2
|
14
|
+
|
15
|
+
field :custom_field_list, CustomFieldList
|
16
|
+
|
17
|
+
record_refs :department, :item, :job, :klass, :location, :price, :tax_code, :units
|
18
|
+
|
19
|
+
def initialize(attributes_or_record = {})
|
20
|
+
case attributes_or_record
|
21
|
+
when Hash
|
22
|
+
initialize_from_attributes_hash(attributes_or_record)
|
23
|
+
when self.class
|
24
|
+
initialize_from_record(attributes_or_record)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize_from_record(record)
|
29
|
+
self.attributes = record.send(:attributes)
|
30
|
+
end
|
31
|
+
|
32
|
+
def to_record
|
33
|
+
rec = super
|
34
|
+
if rec["#{record_namespace}:customFieldList"]
|
35
|
+
rec["#{record_namespace}:customFieldList!"] = rec.delete("#{record_namespace}:customFieldList")
|
36
|
+
end
|
37
|
+
rec
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -12,7 +12,7 @@ module NetSuite
|
|
12
12
|
|
13
13
|
fields :phone, :home_phone, :first_name, :last_name, :alt_name, :is_inactive, :email, :give_access,
|
14
14
|
:partner_code, :is_person, :company_name, :eligible_for_commission, :entity_id, :last_modified_date,
|
15
|
-
:date_created, :title, :mobile_phone, :comments, :middle_name
|
15
|
+
:date_created, :title, :mobile_phone, :comments, :middle_name, :send_email
|
16
16
|
|
17
17
|
record_refs :klass, :access_role, :department
|
18
18
|
|
@@ -20,4 +20,4 @@ module NetSuite
|
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
23
|
-
end
|
23
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class PayrollItem
|
4
|
+
include Support::Fields
|
5
|
+
include Support::RecordRefs
|
6
|
+
include Support::Records
|
7
|
+
include Support::Actions
|
8
|
+
include Namespaces::ListEmp
|
9
|
+
|
10
|
+
actions :add, :delete, :delete_list, :get, :get_list, :search, :update, :upsert, :upsert_list
|
11
|
+
|
12
|
+
fields :employee_paid, :inactive, :name
|
13
|
+
|
14
|
+
field :custom_field_list, CustomFieldList
|
15
|
+
|
16
|
+
record_refs :expense_account, :item_type, :liability_account, :subsidiary, :vendor
|
17
|
+
|
18
|
+
attr_reader :internal_id
|
19
|
+
attr_accessor :external_id
|
20
|
+
attr_accessor :search_joins
|
21
|
+
|
22
|
+
def initialize(attributes = {})
|
23
|
+
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
24
|
+
@external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
|
25
|
+
initialize_from_attributes_hash(attributes)
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_record
|
29
|
+
rec = super
|
30
|
+
if rec["#{record_namespace}:customFieldList"]
|
31
|
+
rec["#{record_namespace}:customFieldList!"] = rec.delete("#{record_namespace}:customFieldList")
|
32
|
+
end
|
33
|
+
rec
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -29,7 +29,7 @@ module NetSuite
|
|
29
29
|
|
30
30
|
record_refs :account, :bill_address_list, :created_from, :currency, :custom_form, :department, :discount_item, :entity, :gift_cert,
|
31
31
|
:handling_tax_code, :job, :klass, :lead_source, :location, :message_sel, :opportunity, :partner, :posting_period, :promo_code,
|
32
|
-
:sales_group, :sales_rep, :ship_method, :shipping_tax_code, :subsidiary, :terms, :tax_item, :payment_method
|
32
|
+
:sales_group, :sales_rep, :ship_method, :shipping_tax_code, :subsidiary, :terms, :tax_item, :payment_method, :bill_address_list
|
33
33
|
|
34
34
|
attr_reader :internal_id
|
35
35
|
attr_accessor :external_id
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class VendorCategory
|
4
|
+
# NOTE this record is undocumented, look at the WSDL for details
|
5
|
+
|
6
|
+
include Support::Fields
|
7
|
+
include Support::RecordRefs
|
8
|
+
include Support::Records
|
9
|
+
include Support::Actions
|
10
|
+
include Namespaces::ListAcct
|
11
|
+
|
12
|
+
actions :get, :get_list, :get_all, :add, :update, :delete, :search
|
13
|
+
|
14
|
+
fields :name, :is_tax_agency, :is_inactive
|
15
|
+
|
16
|
+
attr_reader :internal_id
|
17
|
+
attr_accessor :external_id
|
18
|
+
|
19
|
+
def initialize(attributes = {})
|
20
|
+
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
21
|
+
@external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
|
22
|
+
initialize_from_attributes_hash(attributes)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/netsuite/version.rb
CHANGED
@@ -7,7 +7,11 @@ describe 'basic records' do
|
|
7
7
|
NetSuite::Records::Location,
|
8
8
|
NetSuite::Records::JobStatus,
|
9
9
|
NetSuite::Records::TimeBill,
|
10
|
-
NetSuite::Records::Customer
|
10
|
+
NetSuite::Records::Customer,
|
11
|
+
NetSuite::Records::Invoice,
|
12
|
+
NetSuite::Records::PayrollItem,
|
13
|
+
NetSuite::Records::Opportunity,
|
14
|
+
NetSuite::Records::VendorCategory
|
11
15
|
]
|
12
16
|
}
|
13
17
|
|
@@ -28,7 +32,11 @@ describe 'basic records' do
|
|
28
32
|
|
29
33
|
standard_fields = (record_class.fields - record_class.record_refs).to_a
|
30
34
|
custom_object_fields = standard_fields.select { |f| !record_instance.send(f).nil? }
|
35
|
+
sublist_fields = custom_object_fields.select { |f| record_instance.send(f).kind_of?(NetSuite::Support::Sublist) }
|
36
|
+
|
37
|
+
custom_object_fields -= sublist_fields
|
31
38
|
standard_fields -= custom_object_fields
|
39
|
+
standard_fields -= sublist_fields
|
32
40
|
|
33
41
|
# ensure that all fields can be set
|
34
42
|
standard_fields.each { |f| expect(record_instance).to have_field(f) }
|
@@ -46,6 +54,13 @@ describe 'basic records' do
|
|
46
54
|
record_instance.send(:"#{sample_record_ref_field}=".to_sym, { internal_id: 1 })
|
47
55
|
end
|
48
56
|
|
57
|
+
if !sublist_fields.empty?
|
58
|
+
sublist_fields.each do |sublist_field|
|
59
|
+
# TODO make a sublist entry with some fields valid for that sublist item
|
60
|
+
record_instance.send(sublist_field) << {}
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
49
64
|
expect(record_instance.to_record).to be_a(Hash)
|
50
65
|
|
51
66
|
# TODO should test for correct value output
|
@@ -14,7 +14,7 @@ describe NetSuite::Records::Customer do
|
|
14
14
|
:estimated_budget, :fax, :fax_transactions, :first_name, :first_visit, :give_access, :global_subscription_status,
|
15
15
|
:group_pricing_list, :home_phone, :image, :is_budget_approved, :is_inactive, :is_person, :item_pricing_list, :keywords,
|
16
16
|
:language, :last_modified_date, :last_name, :last_page_visited, :last_visit, :middle_name, :mobile_phone,
|
17
|
-
:opening_balance, :opening_balance_account, :opening_balance_date, :overdue_balance,
|
17
|
+
:opening_balance, :opening_balance_account, :opening_balance_date, :overdue_balance,
|
18
18
|
:password, :password2, :phone, :phonetic_name, :pref_cc_processor,:print_on_check_as,
|
19
19
|
:print_transactions, :referrer, :reminder_days, :representing_subsidiary, :require_pwd_change, :resale_number,
|
20
20
|
:sales_group, :sales_readiness, :sales_team_list, :salutation, :send_email, :ship_complete, :shipping_item,
|
@@ -26,7 +26,7 @@ describe NetSuite::Records::Invoice do
|
|
26
26
|
:tax_total, :time_disc_amount, :time_disc_print, :time_disc_rate, :time_disc_tax_1_amt, :time_disc_taxable,
|
27
27
|
:time_discount, :time_list, :time_tax_code, :time_tax_rate_1, :time_tax_rate_2, :to_be_emailed, :to_be_faxed,
|
28
28
|
:to_be_printed, :total_cost_estimate, :tracking_numbers, :tran_date, :tran_id, :tran_is_vsoe_bundle,
|
29
|
-
:vat_reg_num, :vsoe_auto_calc
|
29
|
+
:vat_reg_num, :vsoe_auto_calc, :tax_rate
|
30
30
|
].each do |field|
|
31
31
|
expect(invoice).to have_field(field)
|
32
32
|
end
|
@@ -34,7 +34,7 @@ describe NetSuite::Records::Invoice do
|
|
34
34
|
|
35
35
|
it 'has all the right read_only_fields' do
|
36
36
|
[
|
37
|
-
:sub_total, :discount_total, :total, :alt_handling_cost, :alt_shipping_cost, :gift_cert_applied,
|
37
|
+
:sub_total, :discount_total, :total, :alt_handling_cost, :alt_shipping_cost, :gift_cert_applied,
|
38
38
|
:handling_cost, :recognized_revenue, :amount_remaining, :amount_paid
|
39
39
|
].each do |field|
|
40
40
|
expect(NetSuite::Records::Invoice).to have_read_only_field(field)
|
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..') ))
|
2
2
|
|
3
|
+
# https://circleci.com/docs/code-coverage
|
4
|
+
if ENV['CIRCLE_ARTIFACTS']
|
5
|
+
require 'simplecov'
|
6
|
+
dir = File.join("../../../..", ENV['CIRCLE_ARTIFACTS'], "coverage")
|
7
|
+
SimpleCov.coverage_dir(dir)
|
8
|
+
SimpleCov.start
|
9
|
+
end
|
10
|
+
|
3
11
|
require 'rspec'
|
4
12
|
require 'netsuite'
|
5
13
|
require 'pry'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netsuite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Moran
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-10-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|
@@ -49,11 +49,11 @@ extra_rdoc_files: []
|
|
49
49
|
files:
|
50
50
|
- .gitignore
|
51
51
|
- .rspec
|
52
|
-
- .travis.yml
|
53
52
|
- Gemfile
|
54
53
|
- LICENSE
|
55
54
|
- README.md
|
56
55
|
- Rakefile
|
56
|
+
- circle.yml
|
57
57
|
- lib/netsuite.rb
|
58
58
|
- lib/netsuite/actions/add.rb
|
59
59
|
- lib/netsuite/actions/delete.rb
|
@@ -133,6 +133,8 @@ files:
|
|
133
133
|
- lib/netsuite/records/customer_currency.rb
|
134
134
|
- lib/netsuite/records/customer_currency_list.rb
|
135
135
|
- lib/netsuite/records/customer_deposit.rb
|
136
|
+
- lib/netsuite/records/customer_partner.rb
|
137
|
+
- lib/netsuite/records/customer_partners_list.rb
|
136
138
|
- lib/netsuite/records/customer_payment.rb
|
137
139
|
- lib/netsuite/records/customer_payment_apply.rb
|
138
140
|
- lib/netsuite/records/customer_payment_apply_list.rb
|
@@ -180,8 +182,12 @@ files:
|
|
180
182
|
- lib/netsuite/records/matrix_option_list.rb
|
181
183
|
- lib/netsuite/records/member_list.rb
|
182
184
|
- lib/netsuite/records/non_inventory_sale_item.rb
|
185
|
+
- lib/netsuite/records/opportunity.rb
|
186
|
+
- lib/netsuite/records/opportunity_item.rb
|
187
|
+
- lib/netsuite/records/opportunity_item_list.rb
|
183
188
|
- lib/netsuite/records/partner.rb
|
184
189
|
- lib/netsuite/records/payment_method.rb
|
190
|
+
- lib/netsuite/records/payroll_item.rb
|
185
191
|
- lib/netsuite/records/phone_call.rb
|
186
192
|
- lib/netsuite/records/pricing_matrix.rb
|
187
193
|
- lib/netsuite/records/promotion_code.rb
|
@@ -204,7 +210,6 @@ files:
|
|
204
210
|
- lib/netsuite/records/tax_type.rb
|
205
211
|
- lib/netsuite/records/term.rb
|
206
212
|
- lib/netsuite/records/time_bill.rb
|
207
|
-
- lib/netsuite/records/transaction.rb
|
208
213
|
- lib/netsuite/records/units_type.rb
|
209
214
|
- lib/netsuite/records/units_type_uom.rb
|
210
215
|
- lib/netsuite/records/units_type_uom_list.rb
|
@@ -214,6 +219,7 @@ files:
|
|
214
219
|
- lib/netsuite/records/vendor_bill_expense_list.rb
|
215
220
|
- lib/netsuite/records/vendor_bill_item.rb
|
216
221
|
- lib/netsuite/records/vendor_bill_item_list.rb
|
222
|
+
- lib/netsuite/records/vendor_category.rb
|
217
223
|
- lib/netsuite/records/vendor_payment.rb
|
218
224
|
- lib/netsuite/records/vendor_payment_apply.rb
|
219
225
|
- lib/netsuite/records/vendor_payment_apply_list.rb
|
data/.travis.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# TODO specs
|
2
|
-
# TODO a transaction is actually the superclass of a SalesOrder, this is backwards
|
3
|
-
|
4
|
-
module NetSuite
|
5
|
-
module Records
|
6
|
-
class Transaction < SalesOrder
|
7
|
-
|
8
|
-
def to_record
|
9
|
-
rec = super
|
10
|
-
if rec["#{record_namespace}:customFieldList"]
|
11
|
-
rec["#{record_namespace}:customFieldList!"] = rec.delete("#{record_namespace}:customFieldList")
|
12
|
-
end
|
13
|
-
rec
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|