README.md in netsuite-0.8.2 vs README.md in netsuite-0.8.3

- old
+ new

@@ -1,46 +1,65 @@ -[![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) +<!-- START doctoc generated TOC please keep comment here to allow auto update --> +<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [NetSuite SuiteTalk API Ruby Gem](#netsuite-suitetalk-api-ruby-gem) +- [Help & Support](#help--support) +- [Testing](#testing) +- [Installation](#installation) + - [Configuration](#configuration) + - [Token based Authentication](#token-based-authentication) +- [Usage](#usage) + - [CRUD Operations](#crud-operations) + - [Custom Records & Fields](#custom-records--fields) + - [Searching](#searching) + - [Non-standard Operations](#non-standard-operations) +- [About SuiteSync](#about-suitesync) + +<!-- END doctoc generated TOC please keep comment here to allow auto update --> + +[![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 API Gem +# NetSuite SuiteTalk API Ruby Gem * 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. +* NetSuite is a 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. +Join the [slack channel](http://opensuite-slackin.herokuapp.com) for help with any NetSuite issues. Please do not post usage questions as issues in GitHub. -Please do not post usage questions as issues in GitHub. +Messages in the Slack ground are [archived here](https://suitechat.slackarchive.io). Search the archives to see if your question has been answered before. -## Testing +There is some additional helpful resources for NetSuite development [listed here](https://dashboard.suitesync.io/docs/resources#netsuite). +# 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 -### 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 +## Configuration Not sure how to find your account id? Search for "web service preferences" in the NetSuite global search. ```ruby NetSuite.configure do @@ -51,14 +70,18 @@ # optionally specify full wsdl URL (to switch to sandbox, for example) wsdl "https://webservices.sandbox.netsuite.com/wsdl/v#{api_version}_0/netsuite.wsdl" # if your datacenter is being switched, you'll have to manually set your wsdl location - wsdl "https://webservices.na2.netsuite.com/wsdl/v#{api_version}_0/netsuite.wsdl" + wsdl "https://webservices.na2.netsuite.com/wsdl/v#{api_version}_0/netsuite.wsdl" + # or specify the wsdl_domain if you want to specify the datacenter and let the configuration + # construct the full wsdl location - e.g. "https://#{wsdl_domain}/wsdl/v#{api_version}_0/netsuite.wsdl" + wsdl_domain "webservices.na2.netsuite.com" + # or specify the sandbox flag if you don't want to deal with specifying a full URL - sandbox true + sandbox true # often the netsuite servers will hang which would cause a timeout exception to be raised # if you don't mind waiting (e.g. processing NS via DJ), increasing the timeout should fix the issue read_timeout 100000 @@ -68,11 +91,11 @@ # login information email 'email@domain.com' password 'password' account '12345' role 1111 - + # optional, ensures that read-only fields don't cause API errors soap_header 'platformMsgs:preferences' => { 'platformMsgs:ignoreReadOnlyFields' => true, } end @@ -86,10 +109,12 @@ 'platformMsgs:applicationId' => 'your-netsuite-app-id' } } ``` +### Token based Authentication + 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/). ```ruby NetSuite.configure do reset! @@ -104,13 +129,13 @@ # oauth does not work with API versions less than 2015_2 api_version '2016_2' end ``` -### Examples +# Usage -#### CRUD Operations +## CRUD Operations ```ruby # get a customer customer = NetSuite::Records::Customer.get(:internal_id => 4) customer.is_person @@ -165,11 +190,11 @@ recordType: 'invoice' ) options.base_refs.map(&:name) ``` -#### Custom Records & Fields +## Custom Records & Fields ```ruby # updating a custom field list on a record # you need to push ALL the values of ALL of the custom fields that you want set on the record @@ -216,11 +241,11 @@ '@xsi:type' => 'customRecord' } ) ``` -#### Searching +## Searching ```ruby # basic search search = NetSuite::Records::Customer.search({ basic: [ @@ -377,10 +402,30 @@ # only returning body fields increases performance! body_fields_only: true } }).results +# Search for SalesOrder records with a "Pending Approval" status using the TransactionStatus enum value. +# https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2016_2/schema/enum/transactionstatus.html + +NetSuite::Records::SalesOrder.search( + criteria: { + basic: [ + { + field: 'type', + operator: 'anyOf', + value: ['_salesOrder'], + }, + { + field: 'status', + operator: 'anyOf', + value: ['_salesOrderPendingApproval'], + }, + ], + }, +) + NetSuite::Records::ItemFulfillment.search({ criteria: { basic: [ { field: 'type', @@ -500,11 +545,11 @@ deposit.sales_order = RecordRef.new(internal_id: 7279) deposit.payment = 20 deposit.add ``` -#### Non-standard Operations +## Non-standard Operations ```ruby # making a call that hasn't been implemented yet NetSuite::Configuration.connection.call :get_customization_id, message: { 'platformMsgs:customizationType' => { '@getCustomizationType' => 'customRecordType'}, @@ -520,5 +565,9 @@ '@recordType' => 'state' } }) 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] } } ``` + +# About SuiteSync + +[SuiteSync, the Stripe-NetSuite integration](http://suitesync.io) uses this gem and funds the majority of it's development and maintenance. \ No newline at end of file