README.md in netsuite-0.7.9 vs README.md in netsuite-0.8.0

- old
+ new

@@ -1,42 +1,45 @@ [![Circle CI](https://circleci.com/gh/NetSweet/netsuite/tree/master.svg?style=svg)](https://circleci.com/gh/NetSweet/netsuite/tree/master) [![Slack Status](https://opensuite-slackin.herokuapp.com/badge.svg)](http://opensuite-slackin.herokuapp.com) [![Gem Version](https://badge.fury.io/rb/netsuite.svg)](http://badge.fury.io/rb/netsuite) [![Dependency Status](https://gemnasium.com/roidrage/lograge.svg)](https://gemnasium.com/netsweet/netsuite) -# NetSuite Ruby SuiteTalk Gem +# NetSuite Ruby SuiteTalk API Gem -* This gem will act as a wrapper around the NetSuite SuiteTalk WebServices API. Wow, that is a mouthful. -* The gem does not cover the entire API, only the subset that we have found useful to cover so far. -* Extending the wrapper is pretty simple, check out recent commits for an example of how to add support for additional records. -* NetSuite development is overall a pretty poor experience. We have a list of [NetSuite Development Resources](https://github.com/NetSweet/netsuite/wiki/NetSuite-Development-Resources) that might make things a bit less painful. +* This gem will act as a wrapper around the NetSuite SuiteTalk WebServices API. +* The gem does not cover the entire API, only the subset contributors have used so far. +* NetSuite is a huge complex system. There's a lot to learn and sparse resources available to learn from. Here's a list of [NetSuite Development Resources](https://github.com/NetSweet/netsuite/wiki/NetSuite-Development-Resources) that might make things a bit less painful. # Help & Support Join the [slack channel](http://opensuite-slackin.herokuapp.com) for help with any NetSuite issues. -## Installation +Please do not post usage questions as issues in GitHub. -Add this line to your application's Gemfile: - -``` -gem 'netsuite' -``` - -This gem is built for ruby 1.9.x+, checkout the [1-8-stable](https://github.com/NetSweet/netsuite/tree/1-8-stable) branch for ruby 1.8.x support. - ## Testing + Before contributing a patch make sure all existing tests pass. ``` git clone git://github.com/NetSweet/netsuite.git cd netsuite bundle bundle exec rspec ``` + ## Usage +### Installation + +Add this line to your application's Gemfile: + +``` +gem 'netsuite' +``` + +This gem is built for ruby 1.9.x+, checkout the [1-8-stable](https://github.com/NetSweet/netsuite/tree/1-8-stable) branch for ruby 1.8.x support. + ### Configuration Not sure how to find your account id? Search for "web service preferences" in the NetSuite global search. ```ruby @@ -68,25 +71,23 @@ account '12345' role 1111 end ``` -There is a [convenience method](https://github.com/NetSweet/netsuite/blob/56fe7fae92908a2e3d6812ecc56516f773cacd45/lib/netsuite.rb#L180) to configure NetSuite based on ENV variables. +OAuth credentials are also supported. [Learn more about how to set up token based authentication here](http://mikebian.co/using-netsuites-token-based-authentication-with-suitetalk/). -OAuth credentials are also supported: - ```ruby NetSuite.configure do reset! account ENV['NETSUITE_ACCOUNT'] consumer_key ENV['NETSUITE_CONSUMER_KEY'] consumer_secret ENV['NETSUITE_CONSUMER_SECRET'] token_id ENV['NETSUITE_TOKEN_ID'] token_secret ENV['NETSUITE_TOKEN_SECRET'] - + # oauth does not work with API versions less than 2015_2 api_version '2015_2' end ``` @@ -98,12 +99,13 @@ # get a customer customer = NetSuite::Records::Customer.get(:internal_id => 4) customer.is_person # or -NetSuite::Records::Customer.get(4).is_person +NetSuite::Records::Customer.get(4) + # get a list of customers customers = NetSuite::Records::Customer.get_list(:list => [4, 5, 6]) # randomly assign a task customer_support_reps = [12345, 12346] @@ -118,14 +120,19 @@ task.add # this will only work on OS X, open a browser to the record that was just created `open https://system.sandbox.netsuite.com/app/crm/calendar/task.nl?id=#{invoice.internal_id}` -task.update :message => 'New Message' +# update a field on a record +task.update(message: 'New Message') +# delete a record task.delete +# refresh/reload a record (helpful after adding the record for the first time) +task.reload + # using get_select_value with a standard record NetSuite::Records::BaseRefList.get_select_value( recordType: 'serviceSaleItem', field: 'taxSchedule' ) @@ -249,30 +256,26 @@ ] } ] }).results -# advanced search from scratch -NetSuite::Records::Transaction.search({ +NetSuite::Records::SalesOrder.search({ criteria: { basic: [ + # NOTE do not search for more than one transaction type at a time! { field: 'type', operator: 'anyOf', - type: 'SearchEnumMultiSelectField', - value: [ "_invoice", "_salesOrder" ] + value: [ "_invoice"] }, { field: 'tranDate', operator: 'within', # this is needed for date range search requests, for date requests with a single param type is not needed type: 'SearchDateField', value: [ - # the following format is equivilent to ISO 8601 - # Date.parse("1/1/2012").strftime("%Y-%m-%dT%H:%M:%S%z"), - # Date.parse("30/07/2013").strftime("%Y-%m-%dT%H:%M:%S%z") - + # NetSuite requires iso8601 time format # need to require the time library for this to work Time.parse("01/01/2012").iso8601, Time.parse("30/07/2013").iso8601, # or you can use a string. Note that the format below is different from the format of the above code @@ -335,10 +338,13 @@ ] ] }, preferences: { - page_size: 10 + page_size: 10, + + # only returning body fields increases performance! + body_fields_only: true } }).results NetSuite::Records::ItemFulfillment.search({ criteria: {