Giter Site home page Giter Site logo

netsuite's People

Contributors

andrewdicken-stripe avatar cgunther avatar charger avatar davidlaprade avatar dependabot[bot] avatar dleve123 avatar drewish avatar fabiensebban avatar greggroth avatar hdeshev avatar huoxito avatar iloveitaly avatar jasdeepgosal avatar jcroteau avatar jdfrens avatar jeperkins4 avatar jeremysmithco avatar jhirbour avatar joelind avatar kiran-stripe avatar kjc-stripe avatar kristyfrey avatar richardwou avatar rudyyazdi avatar ryanmoran avatar sherriously avatar ssherbondy avatar stevenou avatar tatecarr avatar wkrsz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

netsuite's Issues

hi.....

netsuite setCustomFieldList insert example 2013_2

per-request credentials for search

I don't think per-request credentials are working for search (in 0.2.5)

search.rb is calling:

    NetSuite::Configuration
      .connection(soap_header: preferences)
      .call (@options.has_key?(:search_id)? :search_more_with_id : :search), :message => request_body
  end

but the connection needs the credentials passed separately I think, not in the soap header.
When calling search(options, credentials), I get an exception "'#email is a required configuration value. Please set it by calling NetSuite::Configuration.email", even though email is passed in the credentials hash. (This type of call worked with get_list as an action, but not search).

traceback is:

17:08:00 web.1 | /home/jdart/.rvm/gems/ruby-2.0.0-p451/bundler/gems/netsuite-864493d20c72/lib/netsuite/configuration.rb:117:in email' 17:08:00 web.1 | /home/jdart/.rvm/gems/ruby-2.0.0-p451/bundler/gems/netsuite-864493d20c72/lib/netsuite/configuration.rb:71:inauth_header'
17:08:00 web.1 | /home/jdart/.rvm/gems/ruby-2.0.0-p451/bundler/gems/netsuite-864493d20c72/lib/netsuite/configuration.rb:18:in connection' 17:08:00 web.1 | /home/jdart/.rvm/gems/ruby-2.0.0-p451/bundler/gems/netsuite-864493d20c72/lib/netsuite/actions/search.rb:32:inrequest'
17:08:00 web.1 | /home/jdart/.rvm/gems/ruby-2.0.0-p451/bundler/gems/netsuite-864493d20c72/lib/netsuite/support/requests.rb:19:in call' 17:08:00 web.1 | /home/jdart/.rvm/gems/ruby-2.0.0-p451/bundler/gems/netsuite-864493d20c72/lib/netsuite/support/requests.rb:13:incall'
17:08:00 web.1 | /home/jdart/.rvm/gems/ruby-2.0.0-p451/bundler/gems/netsuite-864493d20c72/lib/netsuite/actions/search.rb:232:in `search'

Future Improvements

TODO list for future improvements… feel free to submit a PR for any of these!

  • travis CI setup
  • ability to set default_page_size in the config block would be helpful. Suggested in #33
  • why doesn't initialize_from_attributes_hash set @internal_id and @external_id? Most records do this – can we add it to initialize_from_attributes_hash?
  • time utilities should pull down and cache the server time for proper time zone calculation
  • allow array of NS record references to be passed to the *List objects. Right now they only accept hashes and force conversion into the type of list object they represent. Can't assign a list of NS records manually
  • specs for file object
  • specs for login call
  • spec coverage for the NetSuite::Records::Task
  • stop including wsdl in the source
  • DRY up the list pattern
  • better cashsale implementation
  • 2014.2 breaks address book on customer. Need to figure out a API strategy
  • improved custom_field_list implementation via reflection like Hash access

Ability to get custom lists

We've created several "custom lists" in Netsuite. I'm not sure if there's currently support for fetching these from Netsuite in this gem. I've added records types to this gem before, but I have no IDEA how to go about it for these "custom lists". If you can provide some guidance as to how I'd implement in the Gem I can hack away at it.

I have some (super rough) working PHP code that does this using the Netsuite Tookkit: http://www.netsuite.com/portal/developers/resources/suitetalk-sample-applications.shtml . Not sure if that's helpful.

  public function get_custom_list($_list_internal_id){
    $recordRef = new RecordRef();
    $recordRef->internalId = $_list_internal_id;

    $searchField = new SearchMultiSelectField();
    $searchField->operator = "anyOf";
    $searchField->searchValue = $recordRef;

    $search = new CustomListSearchBasic();
    $search->internalId = $searchField;

    $request = new SearchRequest();
    $request->searchRecord = $search;

    $searchResponse = $this->service->search($request);
    if (!$searchResponse->searchResult->status->isSuccess ) {
      throw new Exception("get_custom_list: query for custom list id: $_list_internal_id returned isSuccess false");
    }
    if(sizeof($searchResponse->searchResult->recordList->record[0]->customValueList->customValue) ==0){
      throw new Exception("get_custom_list: query for custom list id: $_list_internal_id returned no results");
    }

    $output_array = array();
    foreach($searchResponse->searchResult->recordList->record[0]->customValueList->customValue AS $row){
      $output_array[] = array(
                              'ns_internal_id' => $row->valueId,
                              'value' => $row->value,
                              'abbreviation' => $row->abbreviation,
                              'isInactive' => $row->isInactive,
                            );
    }
    return $output_array;
  }

CC: @labber

Way to mark a Custom Field as Read Only

There ought to be a way to tag a custom field as read only. If you "get" a record with a read only custom field and then "update" it, the result is an error. That is because your update is technically trying to set the read-only custom field to the same value it got.

A workaround for now is to remove read only fields manually each time you get a record before updating said record.

bumpig the savon version

Hello,
Do we have any plans to bump the savon version to the latest versions? It seems savon have lot of fixes recently.

Issue with CustomRecord saved search

Hello,
Here is the code I am using to pull a custom search.

results = NetSuite::Records::CustomRecord.search({
saved: <search_internal_id>, # your saved search internalId
basic: [{
field: 'recType',
operator: 'is',
value: ::NetSuite::Records::CustomRecordRef.new(internal_id: <internal_id>)
}]
}).results

I see the successful output from Netsuite as xml is correctly getting printed with success flag. But I see following error:
gems/ruby-2.1.3/gems/netsuite-0.3.3/lib/netsuite/support/search_result.rb:64:in block in initialize': undefined methodsearch_joins=' for #NetSuite::Records::CustomRecord:0x007fdddb1ab510 (NoMethodError)
from .rvm/gems/ruby-2.1.3/gems/netsuite-0.3.3/lib/netsuite/support/search_result.rb:40:in each' from .rvm/gems/ruby-2.1.3/gems/netsuite-0.3.3/lib/netsuite/support/search_result.rb:40:ininitialize'
from .rvm/gems/ruby-2.1.3/gems/netsuite-0.3.3/lib/netsuite/actions/search.rb:241:in new' from .rvm/gems/ruby-2.1.3/gems/netsuite-0.3.3/lib/netsuite/actions/search.rb:241:insearch'
from test.rb:88:in `

'

Validate users

Hi,

Thanks for this great library. I'm wondering the following: I have set up one webservice user through which I would like to make all requests. In the company there exist > 150 users. I would like to be able to validate a user by making a call to the NetSuite webservice.

Suppose a new user logs in, in my application, then it should call the NetSuite backend (through my webservice login) and check if it's a valid user. If it's the case the user can be created in my application automatically. If it already exists then the user is logged in.

Does this functionality exist? I found this link: http://blog.prolecto.com/2015/01/24/netsuite-easy-alternative-to-single-sign-on-authentication/ and the "Authentication Restlet API" seems to be what I need. I'm wondering if something like this is possible in NetSweet/netsuite?

Thanks in advance for shedding some light on this.

specs failing in master, commit 3a9a7e0899

Failing test in master:
NetSuite::Records::CustomFieldList#to_record can represent itself as a SOAP record

$ ruby -v
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin10.8.0]
$ rspec spec/
.......**....******..............**....****.F............................................******...........******....**..........****..************..**.****.**....**..**********....**********.....................................*..**.****...***......**.**..**.**..**.......**..**......**..**.**......*......................................*..............................**.****...*........**.**........................*..................*..

Pending:
  NetSuite::Support::Actions 
    # No reason given
    # ./spec/netsuite/support/actions_spec.rb:4
  NetSuite::Records::CustomRecordRef 
    # No reason given
    # ./spec/netsuite/records/custom_record_ref_spec.rb:7
  NetSuite::Records::CreditMemoItem#custom_field_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_item_spec.rb:37
  NetSuite::Records::CreditMemoItem#custom_field_list can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_item_spec.rb:38
  NetSuite::Records::CreditMemoItem#inventory_detail can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_item_spec.rb:32
  NetSuite::Records::CreditMemoItem#inventory_detail can be set from an InventoryDetail object
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_item_spec.rb:33
  NetSuite::Records::CreditMemoItem#options can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_item_spec.rb:27
  NetSuite::Records::CreditMemoItem#options can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_item_spec.rb:28
  NetSuite::Records::Account#custom_field_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/account_spec.rb:34
  NetSuite::Records::Account#custom_field_list can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/account_spec.rb:35
  NetSuite::Records::Account#translations_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/account_spec.rb:29
  NetSuite::Records::Account#translations_list can be set from an AccountTranslationList object
    # Not yet implemented
    # ./spec/netsuite/records/account_spec.rb:30
  NetSuite::Records::Account#subsidiary_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/account_spec.rb:24
  NetSuite::Records::Account#subsidiary_list can be set from a RecordRefList object
    # Not yet implemented
    # ./spec/netsuite/records/account_spec.rb:25
  NetSuite::Records::Location#subsidiary_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/location_spec.rb:29
  NetSuite::Records::Location#subsidiary_list can be set from a RecordRefList object
    # Not yet implemented
    # ./spec/netsuite/records/location_spec.rb:30
  NetSuite::Records::Location#custom_field_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/location_spec.rb:34
  NetSuite::Records::Location#custom_field_list can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/location_spec.rb:35
  NetSuite::Records::Location#class_translation_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/location_spec.rb:24
  NetSuite::Records::Location#class_translation_list can be set from a ClassTranslationList object
    # Not yet implemented
    # ./spec/netsuite/records/location_spec.rb:25
  NetSuite::Records::SalesOrderItem#custom_field_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_item_spec.rb:37
  NetSuite::Records::SalesOrderItem#custom_field_list can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_item_spec.rb:38
  NetSuite::Records::SalesOrderItem#inventory_detail can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_item_spec.rb:32
  NetSuite::Records::SalesOrderItem#inventory_detail can be set from an InventoryDetail object
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_item_spec.rb:33
  NetSuite::Records::SalesOrderItem#options can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_item_spec.rb:27
  NetSuite::Records::SalesOrderItem#options can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_item_spec.rb:28
  NetSuite::Records::PaymentMethod#merchant_accounts_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/payment_method_spec.rb:24
  NetSuite::Records::PaymentMethod#merchant_accounts_list can be set from a RecordRefList object
    # Not yet implemented
    # ./spec/netsuite/records/payment_method_spec.rb:25
  NetSuite::Records::InventoryItem#pricing_matrix can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:43
  NetSuite::Records::InventoryItem#pricing_matrix can be set from a PricingMatrix object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:44
  NetSuite::Records::InventoryItem#presentation_item_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:93
  NetSuite::Records::InventoryItem#presentation_item_list can be set from a PresentationItemList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:94
  NetSuite::Records::InventoryItem#custom_field_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:98
  NetSuite::Records::InventoryItem#custom_field_list can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:99
  NetSuite::Records::InventoryItem#bin_number_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:78
  NetSuite::Records::InventoryItem#bin_number_list can be set from an InventoryItemBinNumberList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:79
  NetSuite::Records::InventoryItem#locations_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:83
  NetSuite::Records::InventoryItem#locations_list can be set from an InventoryItemLocationsList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:84
  NetSuite::Records::InventoryItem#item_options_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:58
  NetSuite::Records::InventoryItem#item_options_list can be set from a ItemOptionsList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:59
  NetSuite::Records::InventoryItem#matrix_option_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:88
  NetSuite::Records::InventoryItem#matrix_option_list can be set from a MatrixOptionList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:89
  NetSuite::Records::InventoryItem#item_vendor_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:63
  NetSuite::Records::InventoryItem#item_vendor_list can be set from an ItemVendorList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:64
  NetSuite::Records::InventoryItem#subsidiary_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:53
  NetSuite::Records::InventoryItem#subsidiary_list can be set from a RecordRefList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:54
  NetSuite::Records::InventoryItem#translations_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:73
  NetSuite::Records::InventoryItem#translations_list can be set from a TranslationList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:74
  NetSuite::Records::InventoryItem#site_category_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:68
  NetSuite::Records::InventoryItem#site_category_list can be set from a SiteCategoryList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:69
  NetSuite::Records::InventoryItem#product_feed_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:48
  NetSuite::Records::InventoryItem#product_feed_list can be set from a ProductFeedList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:49
  NetSuite::Records::CustomRecordType#forms_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:42
  NetSuite::Records::CustomRecordType#forms_list can be set from a CustomRecordTypeFormsList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:43
  NetSuite::Records::CustomRecordType#managers_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:62
  NetSuite::Records::CustomRecordType#managers_list can be set from a CustomRecordTypeManagersList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:63
  NetSuite::Records::CustomRecordType#tabs_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:32
  NetSuite::Records::CustomRecordType#tabs_list can be set from a CustomRecordTypeTabsList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:33
  NetSuite::Records::CustomRecordType#online_forms_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:47
  NetSuite::Records::CustomRecordType#online_forms_list can be set from a CustomRecordTypeOnlineFormsList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:48
  NetSuite::Records::CustomRecordType#translations_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:77
  NetSuite::Records::CustomRecordType#translations_list can be set from a CustomRecordTypeTranslationsList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:78
  NetSuite::Records::CustomRecordType#field_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:27
  NetSuite::Records::CustomRecordType#field_list can be set from a CustomRecordTypeFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:28
  NetSuite::Records::CustomRecordType#links_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:57
  NetSuite::Records::CustomRecordType#links_list can be set from a CustomRecordTypeLinksList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:58
  NetSuite::Records::CustomRecordType#children_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:67
  NetSuite::Records::CustomRecordType#children_list can be set from a CustomRecordTypeChildrenList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:68
  NetSuite::Records::CustomRecordType#permissions_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:52
  NetSuite::Records::CustomRecordType#permissions_list can be set from a CustomRecordTypePermissionsList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:53
  NetSuite::Records::CustomRecordType#parents_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:72
  NetSuite::Records::CustomRecordType#parents_list can be set from a CustomRecordTypeParentsList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:73
  NetSuite::Records::CustomRecordType#sublists_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:37
  NetSuite::Records::CustomRecordType#sublists_list can be set from a CustomRecordTypeSublistsList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:38
  NetSuite::Records::CustomerRefund.initialize when the response is unsuccessful 
    # No reason given
    # ./spec/netsuite/records/customer_refund_spec.rb:119
  NetSuite::Records::SalesOrder#transaction_bill_address can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:62
  NetSuite::Records::SalesOrder#transaction_bill_address can be set from a BillAddress object
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:63
  NetSuite::Records::SalesOrder#custom_field_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:82
  NetSuite::Records::SalesOrder#custom_field_list can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:83
  NetSuite::Records::SalesOrder#revenue_status can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:67
  NetSuite::Records::SalesOrder#revenue_status can be set from a RevenueStatus object
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:68
  NetSuite::Records::SalesOrder.initialize when the response is unsuccessful 
    # No reason given
    # ./spec/netsuite/records/sales_order_spec.rb:121
  NetSuite::Records::SalesOrder#order_status can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:38
  NetSuite::Records::SalesOrder#order_status can be set from a SalesOrderOrderStatus object
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:39
  NetSuite::Records::SalesOrder#partners_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:77
  NetSuite::Records::SalesOrder#partners_list can be set from a SalesOrderPartnersList object
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:78
  NetSuite::Records::SalesOrder#sales_team_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:72
  NetSuite::Records::SalesOrder#sales_team_list can be set from a SalesOrderSalesTeamList object
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:73
  NetSuite::Records::Job#job_resources_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:82
  NetSuite::Records::Job#job_resources_list can be set from a JobResourcesList object
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:83
  NetSuite::Records::Job#custom_field_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:102
  NetSuite::Records::Job#custom_field_list can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:103
  NetSuite::Records::Job#addressbook_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:87
  NetSuite::Records::Job#addressbook_list can be set from a JobAddressbookList object
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:88
  NetSuite::Records::Job#credit_cards_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:97
  NetSuite::Records::Job#credit_cards_list can be set from a JobCreditCardsList object
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:98
  NetSuite::Records::Job#milestones_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:92
  NetSuite::Records::Job#milestones_list can be set from a JobMilestonesList object
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:93
  NetSuite::Records::CustomerPayment#credit_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/customer_payment_spec.rb:53
  NetSuite::Records::CustomerPayment#credit_list can be set from a CustomerPaymentCreditList object
    # Not yet implemented
    # ./spec/netsuite/records/customer_payment_spec.rb:54
  NetSuite::Records::CustomerPayment#apply_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/customer_payment_spec.rb:48
  NetSuite::Records::CustomerPayment#apply_list can be set from a CustomerPaymentApplyList object
    # Not yet implemented
    # ./spec/netsuite/records/customer_payment_spec.rb:49
  NetSuite::Records::CustomerPayment#deposit_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/customer_payment_spec.rb:58
  NetSuite::Records::CustomerPayment#deposit_list can be set from a CustomerPaymentDepositList object
    # Not yet implemented
    # ./spec/netsuite/records/customer_payment_spec.rb:59
  NetSuite::Records::CustomerPayment.initialize when the response is unsuccessful 
    # No reason given
    # ./spec/netsuite/records/customer_payment_spec.rb:97
  NetSuite::Support::Attributes 
    # No reason given
    # ./spec/netsuite/support/attributes_spec.rb:4
  NetSuite::Records::CreditMemo#transaction_bill_address can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:72
  NetSuite::Records::CreditMemo#transaction_bill_address can be set from a BillAddress object
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:73
  NetSuite::Records::CreditMemo#custom_field_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:92
  NetSuite::Records::CreditMemo#custom_field_list can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:93
  NetSuite::Records::CreditMemo#revenue_status can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:77
  NetSuite::Records::CreditMemo#revenue_status can be set from a RevenueStatus object
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:78
  NetSuite::Records::CreditMemo.initialize when the response is unsuccessful 
    # No reason given
    # ./spec/netsuite/records/credit_memo_spec.rb:131
  NetSuite::Records::CreditMemo#partners_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:87
  NetSuite::Records::CreditMemo#partners_list can be set from a CreditMemoPartnersList object
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:88
  NetSuite::Records::CreditMemo#sales_team_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:82
  NetSuite::Records::CreditMemo#sales_team_list can be set from a CreditMemoSalesTeamList object
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:83
  NetSuite::Records::CustomField 
    # No reason given
    # ./spec/netsuite/records/custom_field_spec.rb:4
  NetSuite::Records::Invoice.initialize when the response is unsuccessful 
    # No reason given
    # ./spec/netsuite/records/invoice_spec.rb:169

Failures:

  1) NetSuite::Records::CustomFieldList#to_record can represent itself as a SOAP record
     Failure/Error: list.to_record.should eql(record)

       expected: [{"platformCore:customField"=>{"platformCore:value"=>false}, :attributes!=>{"platformCore:customField"=>{"internalId"=>"3", "xsi:type"=>"BooleanCustomFieldRef"}}}]
            got: {"platformCore:customField"=>[{"platformCore:value"=>false}], :attributes!=>{"platformCore:customField"=>{"internalId"=>["3"], "xsi:type"=>["BooleanCustomFieldRef"]}}}

       (compared using eql?)

       Diff:
       @@ -1,5 +1,3 @@
       -[{"platformCore:customField"=>{"platformCore:value"=>false},
       -  :attributes!=>
       -   {"platformCore:customField"=>
       -     {"internalId"=>"3", "xsi:type"=>"BooleanCustomFieldRef"}}}]
       +:attributes! => {"platformCore:customField"=>{"internalId"=>["3"], "xsi:type"=>["BooleanCustomFieldRef"]}},
       +"platformCore:customField" => [{"platformCore:value"=>false}]

     # ./spec/netsuite/records/custom_field_list_spec.rb:29:in `block (3 levels) in <top (required)>'

Finished in 2.14 seconds
439 examples, 1 failure, 119 pending

Failed examples:

rspec ./spec/netsuite/records/custom_field_list_spec.rb:19 # NetSuite::Records::CustomFieldList#to_record can represent itself as a SOAP record

Contact global subscription status

I believe that global_subscription_status should be defined as a normal field rather than a record ref field in Contact.

It is already normal field in Custom and Job.

failing tests under 1.9.3

hey guys,

i forked and updated the netsuite gem to run with ruby 1.9.3 and the latest version of the dependencies.
however i have a few failing tests:

Finished in 1.5 seconds
402 examples, 11 failures, 101 pending

Failed examples:

rspec ./spec/netsuite/records/custom_field_list_spec.rb:19 # NetSuite::Records::CustomFieldList#to_record can represent itself as a SOAP record
rspec ./spec/netsuite/actions/initialize_spec.rb:23 # NetSuite::Actions::Initialize makes a valid request to the NetSuite API
rspec ./spec/netsuite/actions/initialize_spec.rb:27 # NetSuite::Actions::Initialize returns a valid Response object
rspec ./spec/netsuite/actions/add_spec.rb:54 # NetSuite::Actions::Add Invoice makes a valid request to the NetSuite API
rspec ./spec/netsuite/actions/add_spec.rb:58 # NetSuite::Actions::Add Invoice returns a valid Response object
rspec ./spec/netsuite/actions/get_spec.rb:19 # NetSuite::Actions::Get Customer makes a valid request to the NetSuite API
rspec ./spec/netsuite/actions/get_spec.rb:23 # NetSuite::Actions::Get Customer returns a valid Response object
rspec ./spec/netsuite/actions/get_spec.rb:43 # NetSuite::Actions::Get Invoice makes a valid request to the NetSuite API
rspec ./spec/netsuite/actions/get_spec.rb:47 # NetSuite::Actions::Get Invoice returns a valid Response object
rspec ./spec/netsuite/actions/update_spec.rb:52 # NetSuite::Actions::Update Invoice makes a valid request to the NetSuite API
rspec ./spec/netsuite/actions/update_spec.rb:56 # NetSuite::Actions::Update Invoice returns a valid Response object

but i can't get your master working, since there are some conflicts with the httpi gem.

my question: are these tests actually failing on the master branch as well? if yes, how can we fix them?

i would like the have the tests fixed and want to open a PR if this is done and get my changes merged.

thanks guys!

Join and getting values of other records in a search

Hi,

I'm checking out this pull request to be able to use ProjectTask: #63 this works great (any idea when it will be merged?).

I'm doing this search:

NetSuite::Records::ProjectTask.search( criteria: {basic: [{field: 'assignee',operator: 'anyOf',value: [NetSuite::Records::CustomRecordRef.new(:internal_id => 57957)]}]})

this works fine. However it doesn't return the job name. When I look in the documentation of NetSuite is see under "Search Joins" Job so it must be joinable but it's not clear to me how to join. I tried adding

,  jobJoin: [])

to it, but it doesn't return any extra columns. In your examples of joining you set some conditions, is this obligated? I only want to join to be able to get the parent fields in one go as well.

Another question: it it possible to limit the number of columns returned by a search? Now for example I'm getting back the company ID, name etc while that's excess data...

Thanks in advance for any assistance.

transaction search for a specific internalId

I understand that this gets the invoice transactions between the two dates, but how would I get it to return the transactions for a specific internalId?

NetSuite::Records::Transaction.search({
            criteria: {
            basic: [
                {
                    field: 'type',
                    operator: 'anyOf',
                    type: 'SearchEnumMultiSelectField',
                    value: [ "_invoice" ]
                },
                {
                    field: 'tranDate',
                    operator: 'within',

                    type: 'SearchDateField',
                    value: [
                          Date.parse("12/1/2013").strftime("%Y-%m-%dT%H:%M:%S%z"),
                          Date.parse("2/6/2014").strftime("%Y-%m-%dT%H:%M:%S%z")
                        ]
                }
                ]
            }
        })

How to write a basic search

I have a basic field for items in NetSuite. The field is Item Name/Number. The Field ID is reported as itemid. I am searching for records with a B-1004 in the name. How can I do a search for just those records?

Upgrade rspec to 3.1.0

Hi, I'm not around much so please let me know if you're keen on staying with rspec 2.99.

I forked the repo and upgraded rspec and converted everything to be 3.1.0-compatible using transpec and everything is green.

If this is OK I'll send a PR.

Thanks and cheers,
TH.

How long does search take?

I copied the search feature for this gem to test it out. Client has thousands of items. I am searching for just a subset. Results are disappointing. It is so SLOW. Is this right? 10 records take 11 seconds, and 100 takes 102 seconds... so if they have thousands.. it takes thousands of seconds? Gahhh... I tried getting them all, and the search just bombed at 20 minutes saying no method results for false. Hehehehe... how does one deal with NetSuite?

ruby test.rb
   user     system      total        real
NetSuiteD, [2014-12-11T17:25:01.105121 #3297] DEBUG -- : HTTPI POST request to webservices.na1.netsuite.com (excon)
Found 10 records
0.200000   0.030000   0.230000 ( 11.245570)
17:25 ~/Documents/workspace/netsuite_tests $ ruby test.rb
   user     system      total        real
NetSuiteD, [2014-12-11T17:25:39.983756 #3700] DEBUG -- : HTTPI POST request to     webservices.na1.netsuite.com (excon)
Found 100 records
1.050000   0.110000   1.160000 (102.074705)

Adding Support for SalesOrder

First of all, great job! I like this gem and the API it provides to me.

Any plan on supporting SalesOrder type of record? There is a order has_many items relationship which I haven't seen elsewhere. Any ideas on how to implement that one without re-inventing the wheel?

Attempting an item search, getting error

Using Ruby 2.1.5 I have successfully logged into NetSuite with API v2014_2. I am trying to query an inventory for items available. My code is copied from this repo to try and make some progress. My attempt ends with a failure on OpenStruct in the Matrix. I am not sure at all on how to search inventory in NetSuite. I know there are fields like Name and Display Name and Taxable from using the Web Suite to examine the clients inventory, but how to search with Ruby is still fuzzy to me. Would love to just get an item back!

# item search
NetSuite::Records::InventoryItem.search({
criteria: {
  basic: [
    {
      field: 'type',
      operator: 'anyOf',
      type: 'SearchEnumMultiSelectField',
      value: [
        '_inventoryItem'
      ] 
    ]
 }
 }).results.first

Results in

ruby test.rb
D, [2014-12-06T11:20:54.992915 #45452] DEBUG -- : HTTPI GET request to webservices.na1.netsuite.com (excon)
D, [2014-12-06T11:20:55.470918 #45452] DEBUG -- : HTTPI POST request to webservices.na1.netsuite.com (excon)
/Users/dlazar/.rvm/gems/ruby-2.1.5/gems/netsuite-0.2.6/lib/netsuite/records/matrix_option_list.rb:28:in `initialize': uninitialized constant NetSuite::Records::MatrixOptionList::OpenStruct (NameError)
from /Users/dlazar/.rvm/gems/ruby-2.1.5/gems/netsuite-0.2.6/lib/netsuite/support/fields.rb:34:in `new'
from /Users/dlazar/.rvm/gems/ruby-2.1.5/gems/netsuite-0.2.6/lib/netsuite/support/fields.rb:34:in `block in field'
from /Users/dlazar/.rvm/gems/ruby-2.1.5/gems/netsuite-0.2.6/lib/netsuite/support/attributes.rb:15:in `block in initialize_from_attributes_hash'
from /Users/dlazar/.rvm/gems/ruby-2.1.5/gems/netsuite-0.2.6/lib/netsuite/support/attributes.rb:14:in `each'
from /Users/dlazar/.rvm/gems/ruby-2.1.5/gems/netsuite-0.2.6/lib/netsuite/support/attributes.rb:14:in `initialize_from_attributes_hash'
from /Users/dlazar/.rvm/gems/ruby-2.1.5/gems/netsuite-0.2.6/lib/netsuite/records/inventory_item.rb:68:in `initialize'
from /Users/dlazar/.rvm/gems/ruby-2.1.5/gems/netsuite-0.2.6/lib/netsuite/support/search_result.rb:29:in `new'
from /Users/dlazar/.rvm/gems/ruby-2.1.5/gems/netsuite-0.2.6/lib/netsuite/support/search_result.rb:29:in `block in initialize'
from /Users/dlazar/.rvm/gems/ruby-2.1.5/gems/netsuite-0.2.6/lib/netsuite/support/search_result.rb:28:in `each'
from /Users/dlazar/.rvm/gems/ruby-2.1.5/gems/netsuite-0.2.6/lib/netsuite/support/search_result.rb:28:in `initialize'
from /Users/dlazar/.rvm/gems/ruby-2.1.5/gems/netsuite-0.2.6/lib/netsuite/actions/search.rb:235:in `new'
from /Users/dlazar/.rvm/gems/ruby-2.1.5/gems/netsuite-0.2.6/lib/netsuite/actions/search.rb:235:in `search'
from test.rb:15:in `<main>'

Can't create CashBackItem through CashBackItemList on Deposit

ns_deposit = NetSuite::Records::Deposit.new(external_id: 'test')
ns_deposit.cash_back_list.cashback = {
  amount: 100,
  memo: "Test memo",
}

This code raises

NoMethodError: undefined method `fields' for #<NetSuite::Records::RecordRef:0x007fc1bc629848>
    /.../lib/netsuite/records/record_ref.rb:32:in `method_missing'
    /.../lib/netsuite/support/attributes.rb:14:in `block in initialize_from_attributes_hash'
    /.../lib/netsuite/support/attributes.rb:14:in `select'
    /.../lib/netsuite/support/attributes.rb:14:in `initialize_from_attributes_hash'
    /.../lib/netsuite/records/deposit_cash_back.rb:23:in `initialize'
    /.../lib/netsuite/records/deposit_cash_back_list.rb:18:in `new'
    /.../lib/netsuite/records/deposit_cash_back_list.rb:18:in `block in cashback='
    /.../lib/netsuite/records/deposit_cash_back_list.rb:18:in `each'
    /.../lib/netsuite/records/deposit_cash_back_list.rb:18:in `cashback='

Search Action improvements

Perfect timing to add the search functionality as I am working on a project that needs to import everything from NetSuite.

Playing around with it I noticed that:

  • the search action is not available for InventoryItem;
  • a search would only return 1000 records for results, for the first page i guess.

Not sure if this are issues that you are aware of or should i make a pull request to make this additions.

Thanks,

Laura

Specs failing on master, at 44878d91cf

There are a couple of failing tests in master:

  • NetSuite::Records::PhoneCall to_record should be verified with our params
  • NetSuite::Actions::Search saved search should handle a search with joined params containing custom field search
$ ruby -v
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin12.5.0]
$ bundle exec rspec
..*..**.****........***....**.............******.....**********..********...****F*.*...**..****.................................................**.******..**.*..**...**...*....................*.................F...............................**..******..********..******......*.........................******...................**.**.....*.....**.....................................**.....******..**.****....**....**...........*..******.............*...........................

Pending:
  NetSuite::Support::Actions
    # No reason given
    # ./spec/netsuite/support/actions_spec.rb:4
  NetSuite::Records::CreditMemo#sales_team_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:82
  NetSuite::Records::CreditMemo#sales_team_list can be set from a CreditMemoSalesTeamList object
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:83
  NetSuite::Records::CreditMemo#partners_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:87
  NetSuite::Records::CreditMemo#partners_list can be set from a CreditMemoPartnersList object
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:88
  NetSuite::Records::CreditMemo#custom_field_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:92
  NetSuite::Records::CreditMemo#custom_field_list can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:93
  NetSuite::Records::CreditMemo.initialize when the response is unsuccessful
    # No reason given
    # ./spec/netsuite/records/credit_memo_spec.rb:131
  NetSuite::Records::CreditMemo#revenue_status can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:77
  NetSuite::Records::CreditMemo#revenue_status can be set from a RevenueStatus object
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:78
  NetSuite::Records::CreditMemo#transaction_bill_address can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:72
  NetSuite::Records::CreditMemo#transaction_bill_address can be set from a BillAddress object
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_spec.rb:73
  NetSuite::Records::InventoryItem#item_options_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:58
  NetSuite::Records::InventoryItem#item_options_list can be set from a ItemOptionsList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:59
  NetSuite::Records::InventoryItem#custom_field_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:98
  NetSuite::Records::InventoryItem#custom_field_list can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:99
  NetSuite::Records::InventoryItem#matrix_option_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:88
  NetSuite::Records::InventoryItem#matrix_option_list can be set from a MatrixOptionList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:89
  NetSuite::Records::InventoryItem#locations_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:83
  NetSuite::Records::InventoryItem#locations_list can be set from an InventoryItemLocationsList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:84
  NetSuite::Records::InventoryItem#bin_number_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:78
  NetSuite::Records::InventoryItem#bin_number_list can be set from an InventoryItemBinNumberList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:79
  NetSuite::Records::InventoryItem#item_vendor_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:63
  NetSuite::Records::InventoryItem#item_vendor_list can be set from an ItemVendorList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:64
  NetSuite::Records::InventoryItem#site_category_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:68
  NetSuite::Records::InventoryItem#site_category_list can be set from a SiteCategoryList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:69
  NetSuite::Records::InventoryItem#presentation_item_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:93
  NetSuite::Records::InventoryItem#presentation_item_list can be set from a PresentationItemList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:94
  NetSuite::Records::InventoryItem#pricing_matrix can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:43
  NetSuite::Records::InventoryItem#pricing_matrix can be set from a PricingMatrix object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:44
  NetSuite::Records::InventoryItem#translations_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:73
  NetSuite::Records::InventoryItem#translations_list can be set from a TranslationList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:74
  NetSuite::Records::InventoryItem#product_feed_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:48
  NetSuite::Records::InventoryItem#product_feed_list can be set from a ProductFeedList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:49
  NetSuite::Records::InventoryItem#subsidiary_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:53
  NetSuite::Records::InventoryItem#subsidiary_list can be set from a RecordRefList object
    # Not yet implemented
    # ./spec/netsuite/records/inventory_item_spec.rb:54
  NetSuite::Actions::Search basic search should handle searching basic fields
    # No reason given
    # ./spec/netsuite/actions/search_spec.rb:154
  NetSuite::Actions::Search basic search should handle searching with joined fields
    # No reason given
    # ./spec/netsuite/actions/search_spec.rb:155
  NetSuite::Actions::Search advanced search should handle search column definitions
    # No reason given
    # ./spec/netsuite/actions/search_spec.rb:149
  NetSuite::Actions::Search advanced search should handle joined search results
    # No reason given
    # ./spec/netsuite/actions/search_spec.rb:150
  NetSuite::Actions::Search saved search should handle a search with joined params
    # No reason given
    # ./spec/netsuite/actions/search_spec.rb:46
  NetSuite::Actions::Search saved search should handle a ID search with basic params
    # No reason given
    # ./spec/netsuite/actions/search_spec.rb:45
  NetSuite::Records::Location#class_translation_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/location_spec.rb:24
  NetSuite::Records::Location#class_translation_list can be set from a ClassTranslationList object
    # Not yet implemented
    # ./spec/netsuite/records/location_spec.rb:25
  NetSuite::Records::Location#custom_field_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/location_spec.rb:34
  NetSuite::Records::Location#custom_field_list can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/location_spec.rb:35
  NetSuite::Records::Location#subsidiary_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/location_spec.rb:29
  NetSuite::Records::Location#subsidiary_list can be set from a RecordRefList object
    # Not yet implemented
    # ./spec/netsuite/records/location_spec.rb:30
  NetSuite::Records::SalesOrder#revenue_status can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:72
  NetSuite::Records::SalesOrder#revenue_status can be set from a RevenueStatus object
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:73
  NetSuite::Records::SalesOrder#sales_team_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:77
  NetSuite::Records::SalesOrder#sales_team_list can be set from a SalesOrderSalesTeamList object
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:78
  NetSuite::Records::SalesOrder#partners_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:82
  NetSuite::Records::SalesOrder#partners_list can be set from a SalesOrderPartnersList object
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:83
  NetSuite::Records::SalesOrder#order_status can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:38
  NetSuite::Records::SalesOrder#order_status can be set from a SalesOrderOrderStatus object
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:39
  NetSuite::Records::SalesOrder#custom_field_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:87
  NetSuite::Records::SalesOrder#custom_field_list can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:88
  NetSuite::Records::SalesOrder.initialize when the response is unsuccessful
    # No reason given
    # ./spec/netsuite/records/sales_order_spec.rb:126
  NetSuite::Records::SalesOrder#transaction_ship_address can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:67
  NetSuite::Records::SalesOrder#transaction_ship_address can be set from a ShipAddress object
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:68
  NetSuite::Records::SalesOrder#transaction_bill_address can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:62
  NetSuite::Records::SalesOrder#transaction_bill_address can be set from a BillAddress object
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_spec.rb:63
  NetSuite::Records::CustomRecordRef
    # No reason given
    # ./spec/netsuite/records/custom_record_ref_spec.rb:7
  NetSuite::Records::CustomerRefund.initialize when the response is unsuccessful
    # No reason given
    # ./spec/netsuite/records/customer_refund_spec.rb:119
  NetSuite::Records::CustomRecordType#online_forms_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:47
  NetSuite::Records::CustomRecordType#online_forms_list can be set from a CustomRecordTypeOnlineFormsList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:48
  NetSuite::Records::CustomRecordType#permissions_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:52
  NetSuite::Records::CustomRecordType#permissions_list can be set from a CustomRecordTypePermissionsList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:53
  NetSuite::Records::CustomRecordType#links_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:57
  NetSuite::Records::CustomRecordType#links_list can be set from a CustomRecordTypeLinksList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:58
  NetSuite::Records::CustomRecordType#field_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:27
  NetSuite::Records::CustomRecordType#field_list can be set from a CustomRecordTypeFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:28
  NetSuite::Records::CustomRecordType#managers_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:62
  NetSuite::Records::CustomRecordType#managers_list can be set from a CustomRecordTypeManagersList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:63
  NetSuite::Records::CustomRecordType#parents_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:72
  NetSuite::Records::CustomRecordType#parents_list can be set from a CustomRecordTypeParentsList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:73
  NetSuite::Records::CustomRecordType#children_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:67
  NetSuite::Records::CustomRecordType#children_list can be set from a CustomRecordTypeChildrenList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:68
  NetSuite::Records::CustomRecordType#forms_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:42
  NetSuite::Records::CustomRecordType#forms_list can be set from a CustomRecordTypeFormsList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:43
  NetSuite::Records::CustomRecordType#tabs_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:32
  NetSuite::Records::CustomRecordType#tabs_list can be set from a CustomRecordTypeTabsList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:33
  NetSuite::Records::CustomRecordType#sublists_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:37
  NetSuite::Records::CustomRecordType#sublists_list can be set from a CustomRecordTypeSublistsList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:38
  NetSuite::Records::CustomRecordType#translations_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:77
  NetSuite::Records::CustomRecordType#translations_list can be set from a CustomRecordTypeTranslationsList object
    # Not yet implemented
    # ./spec/netsuite/records/custom_record_type_spec.rb:78
  NetSuite::Records::CustomField
    # No reason given
    # ./spec/netsuite/records/custom_field_spec.rb:4
  NetSuite::Records::Account#translations_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/account_spec.rb:29
  NetSuite::Records::Account#translations_list can be set from an AccountTranslationList object
    # Not yet implemented
    # ./spec/netsuite/records/account_spec.rb:30
  NetSuite::Records::Account#custom_field_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/account_spec.rb:34
  NetSuite::Records::Account#custom_field_list can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/account_spec.rb:35
  NetSuite::Records::Account#subsidiary_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/account_spec.rb:24
  NetSuite::Records::Account#subsidiary_list can be set from a RecordRefList object
    # Not yet implemented
    # ./spec/netsuite/records/account_spec.rb:25
  NetSuite::Records::CustomerPayment#credit_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/customer_payment_spec.rb:53
  NetSuite::Records::CustomerPayment#credit_list can be set from a CustomerPaymentCreditList object
    # Not yet implemented
    # ./spec/netsuite/records/customer_payment_spec.rb:54
  NetSuite::Records::CustomerPayment#deposit_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/customer_payment_spec.rb:58
  NetSuite::Records::CustomerPayment#deposit_list can be set from a CustomerPaymentDepositList object
    # Not yet implemented
    # ./spec/netsuite/records/customer_payment_spec.rb:59
  NetSuite::Records::CustomerPayment.initialize when the response is unsuccessful
    # No reason given
    # ./spec/netsuite/records/customer_payment_spec.rb:97
  NetSuite::Records::CustomerPayment#apply_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/customer_payment_spec.rb:48
  NetSuite::Records::CustomerPayment#apply_list can be set from a CustomerPaymentApplyList object
    # Not yet implemented
    # ./spec/netsuite/records/customer_payment_spec.rb:49
  NetSuite::Records::PaymentMethod#merchant_accounts_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/payment_method_spec.rb:24
  NetSuite::Records::PaymentMethod#merchant_accounts_list can be set from a RecordRefList object
    # Not yet implemented
    # ./spec/netsuite/records/payment_method_spec.rb:25
  NetSuite::Records::SalesOrderItem#options can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_item_spec.rb:27
  NetSuite::Records::SalesOrderItem#options can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_item_spec.rb:28
  NetSuite::Records::SalesOrderItem#inventory_detail can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_item_spec.rb:32
  NetSuite::Records::SalesOrderItem#inventory_detail can be set from an InventoryDetail object
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_item_spec.rb:33
  NetSuite::Records::SalesOrderItem#custom_field_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_item_spec.rb:37
  NetSuite::Records::SalesOrderItem#custom_field_list can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/sales_order_item_spec.rb:38
  NetSuite::Records::Job#addressbook_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:87
  NetSuite::Records::Job#addressbook_list can be set from a JobAddressbookList object
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:88
  NetSuite::Records::Job#milestones_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:92
  NetSuite::Records::Job#milestones_list can be set from a JobMilestonesList object
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:93
  NetSuite::Records::Job#credit_cards_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:97
  NetSuite::Records::Job#credit_cards_list can be set from a JobCreditCardsList object
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:98
  NetSuite::Records::Job#custom_field_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:102
  NetSuite::Records::Job#custom_field_list can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:103
  NetSuite::Records::Job#job_resources_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:82
  NetSuite::Records::Job#job_resources_list can be set from a JobResourcesList object
    # Not yet implemented
    # ./spec/netsuite/records/job_spec.rb:83
  NetSuite::Support::Attributes
    # No reason given
    # ./spec/netsuite/support/attributes_spec.rb:4
  NetSuite::Records::CreditMemoItem#options can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_item_spec.rb:27
  NetSuite::Records::CreditMemoItem#options can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_item_spec.rb:28
  NetSuite::Records::CreditMemoItem#inventory_detail can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_item_spec.rb:32
  NetSuite::Records::CreditMemoItem#inventory_detail can be set from an InventoryDetail object
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_item_spec.rb:33
  NetSuite::Records::CreditMemoItem#custom_field_list can be set from attributes
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_item_spec.rb:37
  NetSuite::Records::CreditMemoItem#custom_field_list can be set from a CustomFieldList object
    # Not yet implemented
    # ./spec/netsuite/records/credit_memo_item_spec.rb:38
  NetSuite::Records::Invoice.initialize when the response is unsuccessful
    # No reason given
    # ./spec/netsuite/records/invoice_spec.rb:169

Failures:

  1) NetSuite::Actions::Search saved search should handle a search with joined params containing custom field search
     Failure/Error: search = NetSuite::Records::Customer.search({
     Savon::ExpectationError:
       Expected a request to the :search operation
         with this message: {"searchRecord"=>{"@xsi:type"=>"listRel:CustomerSearchAdvanced", "@savedSearchId"=>500, :content!=>{"listRel:criteria"=>{}}}}
       Received a request to the :search operation
         with this message: {"searchRecord"=>{"@savedSearchId"=>500, "@xsi:type"=>"listRel:CustomerSearchAdvanced", :content!=>{"listRel:criteria"=>{"listRel:basic"=>{"platformCommon:entityId"=>{:content!=>{"platformCore:searchValue"=>"New Keywords"}, :@operator=>"hasKeywords"}, "platformCommon:stage"=>{:content!=>{"platformCore:searchValue"=>["_lead", "_customer"]}, :@operator=>"anyOf"}, "platformCommon:customFieldList"=>{"platformCore:customField"=>[{"platformCore:searchValue"=>[{:@internalId=>4}, {:@internalId=>11}], :attributes!=>{"platformCore:searchValue"=>{"internalId"=>[4, 11]}}}, {"platformCore:searchValue"=>[{}], :attributes!=>{"platformCore:searchValue"=>{"internalId"=>[88825]}}}], :attributes!=>{"platformCore:customField"=>{"internalId"=>["custentity_customerandcontacttypelist", "custentity_relatedthing"], "operator"=>["anyOf", "anyOf"], "xsi:type"=>["platformCore:SearchMultiSelectCustomField", "platformCore:SearchMultiSelectCustomField"]}}}}}}}}
     # ./lib/netsuite/actions/search.rb:32:in `request'
     # ./lib/netsuite/support/requests.rb:18:in `call'
     # ./lib/netsuite/support/requests.rb:12:in `call'
     # ./lib/netsuite/actions/search.rb:232:in `search'
     # ./spec/netsuite/actions/search_spec.rb:98:in `block (3 levels) in <top (required)>'

  2) NetSuite::Records::PhoneCall to_record should be verified with our params
     Failure/Error: fail 'Not Verified.'
     RuntimeError:
       Not Verified.
     # ./spec/netsuite/records/phone_call_spec.rb:20:in `block (3 levels) in <top (required)>'

Finished in 0.96036 seconds
477 examples, 2 failures, 127 pending

Failed examples:

rspec ./spec/netsuite/actions/search_spec.rb:48 # NetSuite::Actions::Search saved search should handle a search with joined params containing custom field search
rspec ./spec/netsuite/records/phone_call_spec.rb:19 # NetSuite::Records::PhoneCall to_record should be verified with our params

Getting days_overdue

after doing a call like this
search = NetSuite::Records::Customer.search({
basic: [
{
field: 'entityId',
operator: 'contains',
value: '2323'
}
]
})

this is how i get the terms:
search.results.last.terms

this is how I get the days over due
search.results.last.days_overdue

But in netsuite when I look at that particular customer there are two invoices that that are overdue.

I thought maybe results would have multiple objects in it, but there was only one.

Any ideas on how I'd get to that second days_overdue?

Working with Inventory

Total N00b question:

I can get an InventoryItem using simple code.

record = NetSuite::Records::InventoryItem.get( internal_id: 39 )

When I inspect the record there are some useful details. A lot is still missing though. When I dumped out the methods on the results of a search, I saw methods like quantity_available, quantity_committed and quantity_on_hand... but when I get a record, those are all nil... what does one do to get at inventory quantity for a record?

Multiuser support

What is the best way to go about using this library in a multiuser environment? I see that a credentials hash can be passed to Netsuite::Connection, but it doesn't seem like there is a way to initialize a Netsuite::Connection and then use it for all requests. Is there a good way to do this without having to pass the credentials hash each time?

Missing git tags

There's no corresponding Git tag for versions above v0.2.0, it'd be nice to add them.

I was confused by the fact that Rubygems bumped me up to 0.2.4 when the repo didn't seem to indicate that it existed.

Here's a one-liner, presuming the commits that changed lib/netsuite/version.rb (w/ message "Version bump") are the appropriate targets for the corresponding tags:

git push [email protected]:RevolutionPrep/netsuite \
 fa333bc8d87f91160f93a2598056707b8355997c:refs/tags/v0.2.4 \
 a131a08ae4e18a69fcaf172a6ac16954f581873d:refs/tags/v0.2.3 \
 02fc9c853b1aab8e2356cfed93d79d82c1cd0f57:refs/tags/v0.2.2 \
 22eea4a98edaae44f16bec816b8fbfa6d7304768:refs/tags/v0.2.1

Getting all of a specific record type

Great work on the netsuite gem!

I've been digging into the code looking for the ability to get all records for a record type, but didn't find anything. Is this in there or is this functionality I'll need to add on?

Cheers,
David

Searching for Inventory Items/Kits doesn't always include pricing data

I've found something odd with InventoryItem/Kit Items search results vs fetching individual netsuite internal_ids.

When I search for an inventory Item using the get method I find pricing_matrix populated.

NetSuite::Records::InventoryItem.get(:internal_id => 1234)

When I issue a search (that results in the same inventory item being returned), pricing_matrix is not on the record.

  search = NetSuite::Records::InventoryItem.search(
        criteria: {
          basic: [
            {
              field: 'type',
              operator: 'anyOf',
              type: 'SearchEnumMultiSelectField',
              value: ['_inventoryItem','_kit']
            },
            {
              field: 'internalIdNumber',
              operator: 'notEmpty',
            },
            {
              field: 'isInactive',
              value: false,
            },
          ]
        },
        preferences: { page_size: 10, }
      )

I took a dive into the netsuite.log and it LOOKS to me like it's missing from the XML

I see this XML for the get, but nothing when I do a search.

 <listAcct:pricingMatrix>
            <listAcct:pricing>
              <listAcct:currency xmlns:platformCore="urn:core_2012_1.platform.webservices.netsuite.com" internalId="1">
                <platformCore:name>USA</platformCore:name>
              </listAcct:currency>
              <listAcct:priceLevel xmlns:platformCore="urn:core_2012_1.platform.webservices.netsuite.com" internalId="1">
                <platformCore:name>Base Price</platformCore:name>
              </listAcct:priceLevel>
              <listAcct:priceList>
                <listAcct:price>
                  <listAcct:value>14.95</listAcct:value>
                  <listAcct:quantity>0.0</listAcct:quantity>
                </listAcct:price>
              </listAcct:priceList>
            </listAcct:pricing>
            <listAcct:pricing>
              <listAcct:currency xmlns:platformCore="urn:core_2012_1.platform.webservices.netsuite.com" internalId="1">
                <platformCore:name>USA</platformCore:name>
              </listAcct:currency>
              <listAcct:priceLevel xmlns:platformCore="urn:core_2012_1.platform.webservices.netsuite.com" internalId="5">
                <platformCore:name>Online Price</platformCore:name>
              </listAcct:priceLevel>
              <listAcct:priceList>
                <listAcct:price>
                  <listAcct:value>12.95</listAcct:value>
                  <listAcct:quantity>0.0</listAcct:quantity>
                </listAcct:price>
              </listAcct:priceList>
            </listAcct:pricing>
          </listAcct:pricingMatrix>

So if it's not in the XML then it's not an issue with the Gem I get it..

I was hoping someone could verify that I'm not losing my mind and/or using the gem wrong.

If I need to sync our entire product catalog and I forced to do individual GETs if I want pricing data? or is there a work around? (I peaked at the Spree wombat stuff and it seems to do individual gets)

Search functionality

I would like to pull out a SalesOrder via the :txn_id and I missing how the search functionality is meant to work.

r1 = NetSuite::Records::SalesOrder.get(:internal_id => 42)
puts tran_id = r1.tran_id   => 212-124312-am
r2 = NetSuite::Records::SalesOrder.get(:tran_id => tran_id)

logs this as:

NetSuite::RecordNotFound: NetSuite::Records::SalesOrder with OPTIONS={:tran_id=>"212-124312-am"} could not be found

which looks as though it is not being formed correctly

  <env:Body>
    <platformMsgs:get>
      <platformMsgs:baseRef xsi:type="platformCore:RecordRef" type="salesOrder"/>
    </platformMsgs:get>
  </env:Body>
</env:Envelope>
SOAP response (status 200):
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Header>
    <platformMsgs:documentInfo xmlns:platformMsgs="urn:messages_2013_1.platform.webservices.netsuite.com">
      <platformMsgs:nsId>WEBSERVICES_3670775_041620133249242221438094087_b1eb8a3f4d89</platformMsgs:nsId>
    </platformMsgs:documentInfo>
  </soapenv:Header>
  <soapenv:Body>
    <getResponse xmlns="urn:messages_2013_1.platform.webservices.netsuite.com">
      <readResponse>
        <platformCore:status xmlns:platformCore="urn:core_2013_1.platform.webservices.netsuite.com" isSuccess="false">
          <platformCore:statusDetail type="ERROR">
            <platformCore:code>INVALID_KEY_OR_REF</platformCore:code>
            <platformCore:message>The specified key is invalid.</platformCore:message>
          </platformCore:statusDetail>
        </platformCore:status>
      </readResponse>
    </getResponse>
  </soapenv:Body>
</soapenv:Envelope>

Is Search yet to be implemented or am I missing something?

Transaction(Sales Order) Search - item list is empty

When I perform a search for sales orders with shipDate within a range, i get the order records but the search result records return empty item list when i perform a

search.results.first.item_list.items

But I can see items when I check on netsuite.

search = NetSuite::Records::Transaction.search({
                                                 criteria: {
                                                   basic: [
                                                           {
                                                             field: 'type',
                                                             operator: 'anyOf',
                                                             type: 'SearchEnumMultiSelectField',
                                                             value: [ "_salesOrder" ]
                                                           },
                                                           {
                                                             field: 'shipDate',
                                                             operator: 'within',
                                                             type: 'SearchDateField',
                                                             value: [

                                                                     Time.parse("15/02/2015").iso8601,
                                                                     Time.parse("16/02/2015").iso8601


                                                                    ]
                                                           }
                                                          ]
                                                 },
                                                 preferences: {
                                                   page_size: 10
                                                 }
                                               });

Pricing Matrix Issue

Sorry this may not be an issue at all, but just a silly question.

I am attempting to retrieve prices of inventory items, which definitely have a base price set.

2.0.0-p247 :021 > item.attributes[:pricing_matrix].prices
[
[0] #NetSuite::Records::RecordRef:0x007fe1e73161b0 @type="array",
[1] #NetSuite::Records::RecordRef:0x007fe1e7315508 @type="array",
[2] #NetSuite::Records::RecordRef:0x007fe1e7314d88 @type="array"
]

This is what I am getting returned from the console, it seems like there is information missing?

Looking here: https://github.com/spree/netsuite_endpoint/blob/a40a7846e44fcf7dfc7a55d09c6c7a050e8b7a1a/lib/netsuite_integration/product.rb#L173

I feel like I should be seeing more?

dynamic record creation

Thanks for the gem. Curious, have you considered constructing NetSuite record classes dynamically in memory using the published schema? Or is this approach a dead end?

Improve Update Call

Right now the following does not actually update a NS record:

customer = NetSuite::Records::Customer.get("12345")
customer.email = "[email protected]"
customer.update

You have to instead manually define which fields you want to update:

customer = NetSuite::Records::Customer.get("12345")
customer.update(:email => "[email protected]")

The NS gem architecture doesn't track the dirty status of fields. This is how ActiveRecord handles automatically updating their fields.

There are a two possibly approaches we can take to simplify the interface:

  1. Look for a plain ruby library that can track the dirty/changed status of fields and update all changed fields automatically
  2. Instead of having to define the values of fields to be updates, just provide an array of fields to the update action that you want to be updated.

I think it's safer to whitelist which fields you want changed in an update call rather that just trust what was changed in the ruby model, or to adopt a blacklist model, so I would opt for option 2 rather than option 1.

Any thoughts or suggestions on a better approach?

Unable to install Gem

I'm trying to install this Gem and get the below error. I'm using ruby-2.0.0-p353 and Rails 4.0.2

Bundler could not find compatible versions for gem "savon":
  In Gemfile:
    netsuite (>= 0) ruby depends on
      savon (= 0.9.7) ruby

    spree_gateway (>= 0) ruby depends on
      savon (1.2.0)

My Gemfile: https://gist.github.com/117d487a1a8b3718517a
My Gemfile.lock: https://gist.github.com/7e20f738c5b3f22d0dce

Bundler could not find compatible versions for gem "savon":
  In Gemfile:
    netsuite (>= 0) ruby depends on
      savon (= 0.9.7) ruby

    spree_gateway (>= 0) ruby depends on
      savon (1.2.0)

Concurrency issue with authentication?

The NetSuite documentation is a little unclear but seems to imply that only one request can be processed at a time.

If we create 100 jobs to create 100 inventory items in netsuite, will those jobs be able to execute concurrently as implemented currently?

I'm looking at this page: https://netsuite.custhelp.com/app/answers/detail/a_id/10729/kw/authentication

Authentication Using Request Level Credentials

Rather than authenticating to NetSuite by invoking login, users have the option of sending their credentials in the SOAP header of each request. Sending credentials with each request eliminates the need for session management and separate logins. This approach, in particular, benefits developers using PHP or other scripting languages that do not have built-in mechanisms for session management, manipulating HTTP headers, or tracking session IDs. Best practices to avoid concurrency errors include the use of request level credentials, along with retries upon concurrency errors.

Note the following about using request level credentials:

  • In order to avoid errors, you should not accept cookies when you use request level credentials. If a JSESSIONID is sent, request level credentials cannot be expected to work.
    • To prevent the acceptance of cookies in Java: use setMaintainSession(false).
    • To prevent the acceptance of cookies in .NET, do not create a CookieContainer.
  • Users must submit a role with every request.
  • When sending user credentials in the SOAP header for an integrated application that has an application ID assigned, users must submit the application ID with every request. Users will also be responsible for handling SOAP faults related to exceeded request limits, since they are presumably not synchronizing access to the session.
  • As with any request (sent after login is invoked or sent with user credentials in the SOAP header), only one Web services request may be in flight at a time. Any attempt to violate this will result in a SOAP fault.

Access to the failure message for Update Action

When performing an update, the return value you get from calling the action is a success/failure boolean. If it fails to perform the action, NetSuite DOES respond with a message explaining the cause of the failure in the webservices XML. This is visible if you are spitting out the XML to stdout.

The current API does not allow us to access this. Even hacking the Support::update method in lib/netsuite/actions/update.rb to return 'response' rather than 'response.is_success?' does not do the trick. 'response.body' does not seem to return the error code from NS.

Looking at other actions does not provide any clues, either. The initialize action throws an error on failure, but it is a generic 'InitializationError'. The get action throws a 'RecordNotFound' exception anytime success? is false- which is probably wrong. There are other things that could cause failure here (ex: permissions).

At a minimum, the API ought to spit an exception which includes the failure code from NetSuite. However, it is not clear to me how to pick this code out of the response XML, even though I see it in my verbose output to stdout.

Basic wrapper around basic search

I've added a convenience method ::find that I've found valuable for quickly looking up records based on arbitrary fields. It's a special case of basic search where it looks for an exact match of all given fields.

Customer.find(account_number: '10001')

It prefers to use the search API but will fallback to getAll with the search done in-memory if search is not supported. Do you think it would be worthwhile to add to NetSuite::Support::Records? I'd be happy to add it if you think it'd be useful.

Operator not found on SearchBooleanField

I'm new to the SuiteTalk API, but from what I can tell, this query SHOULD work:

memorized_invoices = NetSuite::Records::Transaction.search({ criteria: { basic: [{ field: 'type', operator: 'anyOf', type: 'SearchEnumMultiSelectField', value: ["_invoice"]}, {field: 'memorized', value: true}]}})

But all I receive is a missing operator on SearchBooleanField:

D, [2013-10-15T16:23:10.607161 #5131] DEBUG -- : HTTPI POST request to webservices.netsuite.com (curb)
Savon::SOAPFault: (soapenv:Server.userException) org.xml.sax.SAXException: operator not found on {urn:core_2011_2.platform.webservices.netsuite.com}SearchBooleanField

Any suggestions as to why it's missing an operator on the SearchBooleanField? From your example on the main markdown page (search for: # no operator for booleans), a boolean field shouldn't need an operator.

I've done a basic google search, and haven't found much, except a few PHP examples that show that they use the operator 'is', which doesn't work either.

Any ideas?

CustomRecord Update Improvements

  • Should take into account that a customRecord is being used and pass the rec_type over automatically
  • Possibly pass the custom_field_list by default as well. I believe there isn't any fields to update on a CustomRecord

Savon 2.1

Are there any plans to upgrade Savon to the latest version http://savonrb.com/version2.html
Would the improvements in there be worth the effort? I have yet to go through the code but I will see how difficult it would be.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.