netsuite 0.8.5 → 0.8.6

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.
Files changed (39) hide show
  1. checksums.yaml +5 -5
  2. data/.ruby-version +1 -1
  3. data/Gemfile +3 -2
  4. data/README.md +8 -2
  5. data/circle.yml +33 -14
  6. data/lib/netsuite.rb +5 -0
  7. data/lib/netsuite/configuration.rb +8 -4
  8. data/lib/netsuite/records/classification.rb +4 -1
  9. data/lib/netsuite/records/custom_record.rb +1 -1
  10. data/lib/netsuite/records/customer.rb +2 -1
  11. data/lib/netsuite/records/customer_credit_cards.rb +36 -0
  12. data/lib/netsuite/records/customer_credit_cards_list.rb +10 -0
  13. data/lib/netsuite/records/customer_payment.rb +1 -0
  14. data/lib/netsuite/records/employee.rb +1 -1
  15. data/lib/netsuite/records/estimate.rb +42 -0
  16. data/lib/netsuite/records/estimate_item.rb +40 -0
  17. data/lib/netsuite/records/estimate_item_list.rb +11 -0
  18. data/lib/netsuite/records/invoice.rb +1 -1
  19. data/lib/netsuite/records/item_fulfillment.rb +1 -1
  20. data/lib/netsuite/records/non_inventory_resale_item.rb +1 -0
  21. data/lib/netsuite/records/partner.rb +1 -1
  22. data/lib/netsuite/records/service_resale_item.rb +1 -1
  23. data/lib/netsuite/utilities.rb +1 -1
  24. data/lib/netsuite/version.rb +1 -1
  25. data/netsuite.gemspec +3 -2
  26. data/spec/netsuite/configuration_spec.rb +61 -6
  27. data/spec/netsuite/records/classification_spec.rb +10 -1
  28. data/spec/netsuite/records/custom_field_list_spec.rb +6 -4
  29. data/spec/netsuite/records/custom_record_spec.rb +1 -1
  30. data/spec/netsuite/records/customer_credit_cards_list_spec.rb +23 -0
  31. data/spec/netsuite/records/customer_spec.rb +22 -1
  32. data/spec/netsuite/records/employee_spec.rb +2 -2
  33. data/spec/netsuite/records/estimate_item_list_spec.rb +26 -0
  34. data/spec/netsuite/records/estimate_item_spec.rb +40 -0
  35. data/spec/netsuite/records/estimate_spec.rb +216 -0
  36. data/spec/netsuite/records/non_inventory_resale_item_spec.rb +165 -0
  37. data/spec/netsuite/records/partner_spec.rb +141 -0
  38. data/spec/netsuite/records/service_resale_item_spec.rb +134 -0
  39. metadata +31 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 89b1dc6dad276f5db8f657634a3d125643ca198b
4
- data.tar.gz: 586f0a9f83e7b1919a637a34f2d8fce536b8f2b4
2
+ SHA256:
3
+ metadata.gz: 3c52f30c1f82b68e1ac2e078d81eed79f6c34ec0cc5937dd4251a53cb9a5a5c0
4
+ data.tar.gz: 4208277a164ec0b92520cef24b19367538788ecce870cd37f683ddb9fb85143e
5
5
  SHA512:
6
- metadata.gz: 76be28871d569715347328833f9521f8178879f17b93bb940fc10b9c960ef70652110ee85c4a277d02c6c21128f52c7cd762913331edcdacdc1463c853b81c7a
7
- data.tar.gz: a9b49255201b452651df24646fc4d96e96b6d90b1b723a4170eb7f3fc276ea2f9281c609c440702be11e732f1a6e9145cfa67fdcb8537fca3c8f48d94d4057bb
6
+ metadata.gz: bd8c7a34e1ecced72b398715f17978677bc87021e0bc9581449299f918b51993770d956eb3553775c1631ef16c8e488e6ffe682d9575665d81434106635f7e53
7
+ data.tar.gz: f40134f2aaf8824e9b51f9dba00a8a4d9b3b1e935df0d0d07f100018becf8180f6b603f63e52331e65877bbeb135de491fed75a9c5af0928e7409eedbc2f62b4
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.6.6
data/Gemfile CHANGED
@@ -2,6 +2,7 @@ source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
4
  gem 'simplecov', :require => false
5
+ gem 'rspec_junit_formatter'
5
6
 
6
7
  gem 'pry-nav'
7
8
  gem 'pry-rescue'
@@ -11,5 +12,5 @@ gem 'tzinfo', '1.2.5'
11
12
  # gem 'tzinfo', '2.0.0'
12
13
 
13
14
  # required for CircleCI to build properly with ruby 1.9.3
14
- gem 'json', '~> 1.8.3'
15
- gem 'rack', '~> 1.6.4'
15
+ gem 'json', '~> 2.3.0'
16
+ gem 'rack', '~> 2.1.4'
data/README.md CHANGED
@@ -75,8 +75,8 @@ NetSuite.configure do
75
75
  password 'password'
76
76
  role 10
77
77
 
78
- # use `NetSuite::Utilities.netsuite_data_center_urls('TSTDRV1576318')` to retrieve the URL
79
- # you'll want to do this in a background proces and strip the protocol out of the return string
78
+ # use `NetSuite::Utilities.data_center_url('TSTDRV1576318')` to retrieve the URL
79
+ # you'll want to do this in a background process and strip the protocol out of the return string
80
80
  wsdl_domain 'tstdrv1576318.suitetalk.api.netsuite.com'
81
81
  end
82
82
  ```
@@ -106,8 +106,14 @@ NetSuite.configure do
106
106
  read_timeout 100_000
107
107
 
108
108
  # you can specify a file or file descriptor to send the log output to (defaults to STDOUT)
109
+ # If using within a Rails app, consider setting to `Rails.logger` to leverage existing
110
+ # application-level log configuration
109
111
  log File.join(Rails.root, 'log/netsuite.log')
110
112
 
113
+ # Defaults to :debug level logging for Savon API calls. Decrease the verbosity
114
+ # by setting log_level to `:info`, for example
115
+ # log_level :debug
116
+
111
117
  # password-based login information
112
118
  email 'email@domain.com'
113
119
  password 'password'
data/circle.yml CHANGED
@@ -1,17 +1,36 @@
1
- # https://leonid.shevtsov.me/post/multiple-rubies-on-circleci/
1
+ version: 2.1
2
2
 
3
- machine:
4
- environment:
5
- RUBY_VERSIONS: 2.0.0,2.1.10,2.2.9,2.3.7,2.4.4,2.5.1,2.6.1
3
+ orbs:
4
+ # orbs are basically bundles of pre-written build scripts that work for common cases
5
+ # https://github.com/CircleCI-Public/ruby-orb
6
+ ruby: circleci/ruby@1.1
6
7
 
7
- dependencies:
8
- override:
9
- - gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
10
- - rvm get head
11
- - rvm install $RUBY_VERSIONS
12
- - rvm $RUBY_VERSIONS --verbose do gem install bundler -v 1.17.3
13
- - rvm $RUBY_VERSIONS --verbose do bundle install
8
+ jobs:
9
+ # skipping build step because Gemfile.lock is not included in the source
10
+ # this makes the bundler caching step a noop
11
+ test:
12
+ parameters:
13
+ ruby-version:
14
+ type: string
15
+ docker:
16
+ - image: cimg/ruby:<< parameters.ruby-version >>
17
+ steps:
18
+ - checkout
19
+ - ruby/install-deps:
20
+ bundler-version: '1.17.2'
21
+ with-cache: false
22
+ - ruby/rspec-test
14
23
 
15
- test:
16
- override:
17
- - rvm $RUBY_VERSIONS --verbose do bundle exec rspec spec
24
+ # strangely, there seems to be very little documentation about exactly how martix builds work.
25
+ # By defining a param inside your job definition, Circle CI will automatically spawn a job for
26
+ # unique param value passed via `matrix`. Neat!
27
+ # https://circleci.com/blog/circleci-matrix-jobs/
28
+ workflows:
29
+ build_and_test:
30
+ jobs:
31
+ - test:
32
+ matrix:
33
+ parameters:
34
+ # https://github.com/CircleCI-Public/cimg-ruby
35
+ # only supports the last three ruby versions
36
+ ruby-version: ["2.5", "2.6", "2.7"]
@@ -112,6 +112,8 @@ module NetSuite
112
112
  autoload :CustomerAddressbook, 'netsuite/records/customer_addressbook'
113
113
  autoload :CustomerAddressbookList, 'netsuite/records/customer_addressbook_list'
114
114
  autoload :CustomerCategory, 'netsuite/records/customer_category'
115
+ autoload :CustomerCreditCards, 'netsuite/records/customer_credit_cards'
116
+ autoload :CustomerCreditCardsList, 'netsuite/records/customer_credit_cards_list'
115
117
  autoload :CustomerCurrency, 'netsuite/records/customer_currency'
116
118
  autoload :CustomerCurrencyList, 'netsuite/records/customer_currency_list'
117
119
  autoload :CustomerDeposit, 'netsuite/records/customer_deposit'
@@ -156,6 +158,9 @@ module NetSuite
156
158
  autoload :Duration, 'netsuite/records/duration'
157
159
  autoload :Employee, 'netsuite/records/employee'
158
160
  autoload :EntityCustomField, 'netsuite/records/entity_custom_field'
161
+ autoload :Estimate, 'netsuite/records/estimate'
162
+ autoload :EstimateItem, 'netsuite/records/estimate_item'
163
+ autoload :EstimateItemList, 'netsuite/records/estimate_item_list'
159
164
  autoload :File, 'netsuite/records/file'
160
165
  autoload :GiftCertificate, 'netsuite/records/gift_certificate'
161
166
  autoload :GiftCertificateItem, 'netsuite/records/gift_certificate_item'
@@ -350,7 +350,10 @@ module NetSuite
350
350
 
351
351
  def logger(value = nil)
352
352
  if value.nil?
353
- attributes[:logger] ||= ::Logger.new((log && !log.empty?) ? log : $stdout)
353
+ # if passed a IO object (like StringIO) `empty?` won't exist
354
+ valid_log = log && !(log.respond_to?(:empty?) && log.empty?)
355
+
356
+ attributes[:logger] ||= ::Logger.new(valid_log ? log : $stdout)
354
357
  else
355
358
  attributes[:logger] = value
356
359
  end
@@ -370,12 +373,13 @@ module NetSuite
370
373
  end
371
374
 
372
375
  def log_level(value = nil)
373
- self.log_level = value || :debug
374
- attributes[:log_level]
376
+ self.log_level = value if value
377
+
378
+ attributes[:log_level] || :debug
375
379
  end
376
380
 
377
381
  def log_level=(value)
378
- attributes[:log_level] ||= value
382
+ attributes[:log_level] = value
379
383
  end
380
384
  end
381
385
  end
@@ -9,9 +9,12 @@ module NetSuite
9
9
 
10
10
  actions :add, :get, :get_list, :delete, :upsert, :search
11
11
 
12
- fields :name, :include_children, :is_inactive, :class_translation_list, :custom_field_list, :parent
12
+ fields :name, :include_children, :is_inactive, :class_translation_list
13
13
 
14
14
  field :subsidiary_list, RecordRefList
15
+ field :custom_field_list, CustomFieldList
16
+
17
+ record_refs :parent
15
18
 
16
19
  attr_reader :internal_id
17
20
  attr_accessor :external_id
@@ -18,7 +18,7 @@ module NetSuite
18
18
 
19
19
  field :custom_field_list, CustomFieldList
20
20
 
21
- record_refs :custom_form, :owner, :rec_type
21
+ record_refs :custom_form, :owner, :rec_type, :parent
22
22
 
23
23
  attr_reader :internal_id
24
24
  attr_accessor :external_id
@@ -13,7 +13,7 @@ module NetSuite
13
13
 
14
14
  fields :account_number, :aging, :alt_email, :alt_name, :alt_phone, :bill_pay,
15
15
  :buying_reason, :buying_time_frame, :campaign_category, :click_stream, :comments, :company_name,
16
- :consol_aging, :consol_days_overdue, :contrib_pct, :credit_cards_list, :credit_hold_override,
16
+ :consol_aging, :consol_days_overdue, :contrib_pct, :credit_hold_override,
17
17
  :credit_limit, :date_created, :days_overdue, :default_address,
18
18
  :download_list, :email, :email_preference, :email_transactions, :end_date, :entity_id,
19
19
  :estimated_budget, :fax, :fax_transactions, :first_name, :first_visit, :give_access, :global_subscription_status,
@@ -28,6 +28,7 @@ module NetSuite
28
28
  :vat_reg_number, :visits, :web_lead
29
29
 
30
30
  field :addressbook_list, CustomerAddressbookList
31
+ field :credit_cards_list, CustomerCreditCardsList
31
32
  field :custom_field_list, CustomFieldList
32
33
  field :contact_roles_list, ContactAccessRolesList
33
34
  field :currency_list, CustomerCurrencyList
@@ -0,0 +1,36 @@
1
+ module NetSuite
2
+ module Records
3
+ class CustomerCreditCards
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+
8
+ # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2017_1/schema/other/customercreditcards.html?mode=package
9
+
10
+ fields :cc_default, :cc_expire_date, :cc_memo, :cc_name, :cc_number, :debitcard_issue_no, :state_from, :validfrom
11
+ record_refs :card_state, :payment_method
12
+
13
+ attr_reader :internal_id
14
+
15
+ def initialize(attributes_or_record = {})
16
+ case attributes_or_record
17
+ when self.class
18
+ initialize_from_record(attributes_or_record)
19
+ when Hash
20
+ initialize_from_attributes_hash(attributes_or_record)
21
+ end
22
+ end
23
+
24
+ def initialize_from_record(obj)
25
+ self.cc_default = obj.cc_default
26
+ self.cc_expire_date = obj.cc_expire_date
27
+ self.cc_memo = obj.cc_memo
28
+ self.cc_name = obj.cc_name
29
+ self.cc_number = obj.cc_number
30
+ self.debitcard_issue_no = obj.debitcard_issue_no
31
+ self.state_from = obj.state_from
32
+ self.validfrom = obj.validfrom
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,10 @@
1
+ module NetSuite
2
+ module Records
3
+ class CustomerCreditCardsList < Support::Sublist
4
+ include Namespaces::ListRel
5
+
6
+ sublist :credit_cards, CustomerCreditCards
7
+ alias :credit_card :credit_cards
8
+ end
9
+ end
10
+ end
@@ -25,6 +25,7 @@ module NetSuite
25
25
 
26
26
  attr_reader :internal_id
27
27
  attr_accessor :external_id
28
+ attr_accessor :search_joins
28
29
 
29
30
  def initialize(attributes = {})
30
31
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -19,7 +19,7 @@ module NetSuite
19
19
  :phonetic_name, :purchase_order_approval_limit, :purchase_order_approver, :purchase_order_limit, :release_date,
20
20
  :resident_status, :salutation, :social_security_number, :visa_exp_date, :visa_type
21
21
 
22
- record_refs :currency, :department, :location, :subsidiary, :employee_type, :employee_status, :supervisor
22
+ record_refs :currency, :department, :location, :sales_role, :subsidiary, :employee_type, :employee_status, :supervisor
23
23
 
24
24
  field :custom_field_list, CustomFieldList
25
25
  field :roles_list, RoleList
@@ -0,0 +1,42 @@
1
+ module NetSuite
2
+ module Records
3
+ class Estimate
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 :alt_handling_cost, :alt_sales_total, :alt_shipping_cost, :balance,
13
+ :bill_address, :billing_address, :billing_schedule, :bill_is_residential,
14
+ :created_date, :currency_name, :discount_rate, :email, :end_date,
15
+ :est_gross_profit, :exchange_rate, :handling_cost, :handling_tax1_rate, :is_taxable,
16
+ :last_modified_date, :memo, :message, :other_ref_num, :ship_date, :shipping_cost,
17
+ :shipping_tax1_rate, :source, :start_date, :status, :sync_partner_teams, :sync_sales_teams,
18
+ :to_be_emailed, :to_be_faxed, :to_be_printed, :total_cost_estimate, :tran_date, :tran_id,
19
+ :linked_tracking_numbers, :is_multi_ship_to
20
+
21
+ field :shipping_address, Address
22
+ field :billing_address, Address
23
+
24
+ field :item_list, EstimateItemList
25
+ field :custom_field_list, CustomFieldList
26
+
27
+ record_refs :bill_address_list, :created_from, :currency, :custom_form, :department, :discount_item, :entity,
28
+ :handling_tax_code, :job, :klass, :lead_source, :location, :message_sel, :opportunity, :partner,
29
+ :promo_code, :sales_group, :sales_rep, :ship_method, :shipping_tax_code, :subsidiary, :terms
30
+
31
+ attr_reader :internal_id
32
+ attr_accessor :external_id
33
+ attr_accessor :search_joins
34
+
35
+ def initialize(attributes = {})
36
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
37
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
38
+ initialize_from_attributes_hash(attributes)
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,40 @@
1
+ module NetSuite
2
+ module Records
3
+ class EstimateItem
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Namespaces::TranSales
8
+
9
+ fields :amount, :cost_estimate,
10
+ :cost_estimate_type, :defer_rev_rec, :description,
11
+ :is_taxable, :line, :quantity,
12
+ :rate, :tax_rate1
13
+
14
+ field :custom_field_list, CustomFieldList
15
+
16
+ record_refs :item, :job, :price, :tax_code, :units
17
+
18
+ def initialize(attributes_or_record = {})
19
+ case attributes_or_record
20
+ when Hash
21
+ initialize_from_attributes_hash(attributes_or_record)
22
+ when self.class
23
+ initialize_from_record(attributes_or_record)
24
+ end
25
+ end
26
+
27
+ def initialize_from_record(record)
28
+ self.attributes = record.send(:attributes)
29
+ end
30
+
31
+ def to_record
32
+ rec = super
33
+ if rec["#{record_namespace}:customFieldList"]
34
+ rec["#{record_namespace}:customFieldList!"] = rec.delete("#{record_namespace}:customFieldList")
35
+ end
36
+ rec
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,11 @@
1
+ module NetSuite
2
+ module Records
3
+ class EstimateItemList < Support::Sublist
4
+ include Namespaces::TranSales
5
+
6
+ sublist :item, EstimateItem
7
+
8
+ alias :items :item
9
+ end
10
+ end
11
+ end
@@ -39,7 +39,7 @@ module NetSuite
39
39
  field :shipping_address, Address
40
40
  field :billing_address, Address
41
41
 
42
- read_only_fields :sub_total, :discount_total, :total, :recognized_revenue, :amount_remaining, :amount_paid,
42
+ read_only_fields :sub_total, :discount_total, :total, :recognized_revenue, :amount_remaining, :amount_paid, :amount,
43
43
  :alt_shipping_cost, :gift_cert_applied, :handling_cost, :alt_handling_cost
44
44
 
45
45
  record_refs :account, :bill_address_list, :custom_form, :department, :entity, :klass, :partner,
@@ -11,7 +11,7 @@ module NetSuite
11
11
 
12
12
  fields :tran_date, :tran_id, :shipping_cost, :memo, :ship_company, :ship_attention, :ship_addr1,
13
13
  :ship_addr2, :ship_city, :ship_state, :ship_zip, :ship_phone, :ship_is_residential,
14
- :ship_status, :last_modified_date, :created_date
14
+ :ship_status, :last_modified_date, :created_date, :status
15
15
 
16
16
  read_only_fields :handling_cost
17
17
 
@@ -33,6 +33,7 @@ module NetSuite
33
33
  field :custom_field_list, CustomFieldList
34
34
  field :pricing_matrix, PricingMatrix
35
35
  field :subsidiary_list, RecordRefList
36
+ field :item_vendor_list, ItemVendorList
36
37
 
37
38
 
38
39
  attr_reader :internal_id
@@ -16,7 +16,7 @@ module NetSuite
16
16
  :partner_code, :is_person, :company_name, :eligible_for_commission, :entity_id, :last_modified_date,
17
17
  :date_created, :title, :mobile_phone, :comments, :middle_name, :send_email, :password, :password2
18
18
 
19
- record_refs :klass, :access_role, :department
19
+ record_refs :klass, :access_role, :department, :subsidiary
20
20
 
21
21
  attr_reader :internal_id
22
22
  attr_accessor :external_id
@@ -9,7 +9,7 @@ module NetSuite
9
9
 
10
10
  actions :get, :get_list, :add, :update, :delete, :upsert, :search
11
11
 
12
- fields :available_to_partners, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :create_job, :created_date,
12
+ fields :available_to_partners, :cost, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :create_job, :created_date,
13
13
  :display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap, :featured_description,
14
14
  :include_children, :is_donation_item, :is_fulfillable, :is_gco_compliant, :is_inactive, :is_online, :is_taxable,
15
15
  :item_id, :last_modified_date, :matrix_option_list, :matrix_type, :max_donation_amount, :meta_tag_html,
@@ -78,7 +78,7 @@ module NetSuite
78
78
  begin
79
79
  count += 1
80
80
  yield
81
- rescue Exception => e
81
+ rescue StandardError => e
82
82
  exceptions_to_retry = [
83
83
  Errno::ECONNRESET,
84
84
  Errno::ETIMEDOUT,
@@ -1,3 +1,3 @@
1
1
  module NetSuite
2
- VERSION = '0.8.5'
2
+ VERSION = '0.8.6'
3
3
  end
@@ -2,8 +2,9 @@
2
2
  require File.expand_path('../lib/netsuite/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
+ gem.licenses = ['MIT']
5
6
  gem.authors = ['Ryan Moran', 'Michael Bianco']
6
- gem.email = ['ryan.moran@gmail.com', 'mike@cliffsidemedia.com']
7
+ gem.email = ['ryan.moran@gmail.com', 'mike@mikebian.co']
7
8
  gem.description = %q{NetSuite SuiteTalk API Wrapper}
8
9
  gem.summary = %q{NetSuite SuiteTalk API (SOAP) Wrapper}
9
10
  gem.homepage = 'https://github.com/NetSweet/netsuite'
@@ -15,7 +16,7 @@ Gem::Specification.new do |gem|
15
16
  gem.require_paths = ['lib']
16
17
  gem.version = NetSuite::VERSION
17
18
 
18
- gem.add_dependency 'savon', '>= 2.3.0'
19
+ gem.add_dependency 'savon', '>= 2.3.0', '<= 2.11.1'
19
20
 
20
21
  gem.add_development_dependency 'rspec', '~> 3.8.0'
21
22
  end