netsuite-soap 2025.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.envrc +9 -0
- data/.github/FUNDING.yml +1 -0
- data/.github/dependabot.yml +14 -0
- data/.github/workflows/codeql-analysis.yml +70 -0
- data/.github/workflows/main.yml +55 -0
- data/.github/workflows/publish.yml +53 -0
- data/.gitignore +23 -0
- data/.rspec +6 -0
- data/.ruby-version +1 -0
- data/.tool-versions +1 -0
- data/AGENTS.md +150 -0
- data/CLAUDE.md +111 -0
- data/DEVELOPMENT.md +34 -0
- data/Gemfile +10 -0
- data/HISTORY.md +171 -0
- data/LICENSE +22 -0
- data/README.md +87 -0
- data/Rakefile +130 -0
- data/docs/async.md +46 -0
- data/docs/configuration.md +88 -0
- data/docs/contributing.md +36 -0
- data/docs/usage.md +149 -0
- data/lib/netsuite/actions/abstract_action.rb +32 -0
- data/lib/netsuite/actions/add.rb +93 -0
- data/lib/netsuite/actions/async_add_list.rb +74 -0
- data/lib/netsuite/actions/async_delete_list.rb +40 -0
- data/lib/netsuite/actions/async_get_list.rb +46 -0
- data/lib/netsuite/actions/async_initialize_list.rb +85 -0
- data/lib/netsuite/actions/async_response.rb +52 -0
- data/lib/netsuite/actions/async_search.rb +36 -0
- data/lib/netsuite/actions/async_update_list.rb +53 -0
- data/lib/netsuite/actions/async_upsert_list.rb +53 -0
- data/lib/netsuite/actions/attach_file.rb +87 -0
- data/lib/netsuite/actions/check_async_status.rb +29 -0
- data/lib/netsuite/actions/delete.rb +102 -0
- data/lib/netsuite/actions/delete_list.rb +108 -0
- data/lib/netsuite/actions/get.rb +87 -0
- data/lib/netsuite/actions/get_all.rb +78 -0
- data/lib/netsuite/actions/get_async_result.rb +35 -0
- data/lib/netsuite/actions/get_deleted.rb +92 -0
- data/lib/netsuite/actions/get_list.rb +98 -0
- data/lib/netsuite/actions/get_select_value.rb +80 -0
- data/lib/netsuite/actions/initialize.rb +86 -0
- data/lib/netsuite/actions/search.rb +265 -0
- data/lib/netsuite/actions/update.rb +86 -0
- data/lib/netsuite/actions/update_list.rb +113 -0
- data/lib/netsuite/actions/upsert.rb +86 -0
- data/lib/netsuite/actions/upsert_list.rb +118 -0
- data/lib/netsuite/client.rb +19 -0
- data/lib/netsuite/configuration.rb +470 -0
- data/lib/netsuite/errors.rb +18 -0
- data/lib/netsuite/namespaces/act_sched.rb +11 -0
- data/lib/netsuite/namespaces/comm_general.rb +11 -0
- data/lib/netsuite/namespaces/file_cabinet.rb +11 -0
- data/lib/netsuite/namespaces/list_acct.rb +11 -0
- data/lib/netsuite/namespaces/list_emp.rb +12 -0
- data/lib/netsuite/namespaces/list_mkt.rb +12 -0
- data/lib/netsuite/namespaces/list_rel.rb +11 -0
- data/lib/netsuite/namespaces/list_support.rb +11 -0
- data/lib/netsuite/namespaces/list_website.rb +11 -0
- data/lib/netsuite/namespaces/platform_common.rb +11 -0
- data/lib/netsuite/namespaces/platform_core.rb +11 -0
- data/lib/netsuite/namespaces/setup_custom.rb +11 -0
- data/lib/netsuite/namespaces/tran_bank.rb +11 -0
- data/lib/netsuite/namespaces/tran_cust.rb +11 -0
- data/lib/netsuite/namespaces/tran_emp.rb +11 -0
- data/lib/netsuite/namespaces/tran_general.rb +11 -0
- data/lib/netsuite/namespaces/tran_invt.rb +11 -0
- data/lib/netsuite/namespaces/tran_purch.rb +11 -0
- data/lib/netsuite/namespaces/tran_sales.rb +11 -0
- data/lib/netsuite/passports/token.rb +55 -0
- data/lib/netsuite/passports/user.rb +25 -0
- data/lib/netsuite/records/account.rb +30 -0
- data/lib/netsuite/records/accounting_period.rb +25 -0
- data/lib/netsuite/records/address.rb +46 -0
- data/lib/netsuite/records/assembly_build.rb +39 -0
- data/lib/netsuite/records/assembly_component.rb +26 -0
- data/lib/netsuite/records/assembly_component_list.rb +12 -0
- data/lib/netsuite/records/assembly_item.rb +66 -0
- data/lib/netsuite/records/assembly_unbuild.rb +37 -0
- data/lib/netsuite/records/base_ref_list.rb +17 -0
- data/lib/netsuite/records/bill_address.rb +17 -0
- data/lib/netsuite/records/billing_schedule.rb +33 -0
- data/lib/netsuite/records/billing_schedule_milestone.rb +28 -0
- data/lib/netsuite/records/billing_schedule_milestone_list.rb +14 -0
- data/lib/netsuite/records/billing_schedule_recurrence.rb +28 -0
- data/lib/netsuite/records/billing_schedule_recurrence_list.rb +14 -0
- data/lib/netsuite/records/bin.rb +30 -0
- data/lib/netsuite/records/bin_number.rb +18 -0
- data/lib/netsuite/records/bin_number_list.rb +11 -0
- data/lib/netsuite/records/bin_transfer.rb +38 -0
- data/lib/netsuite/records/bin_transfer_inventory.rb +20 -0
- data/lib/netsuite/records/bin_transfer_inventory_list.rb +10 -0
- data/lib/netsuite/records/campaign.rb +28 -0
- data/lib/netsuite/records/cash_refund.rb +135 -0
- data/lib/netsuite/records/cash_refund_item.rb +32 -0
- data/lib/netsuite/records/cash_refund_item_list.rb +13 -0
- data/lib/netsuite/records/cash_sale.rb +51 -0
- data/lib/netsuite/records/cash_sale_item.rb +40 -0
- data/lib/netsuite/records/cash_sale_item_list.rb +13 -0
- data/lib/netsuite/records/classification.rb +30 -0
- data/lib/netsuite/records/contact.rb +44 -0
- data/lib/netsuite/records/contact_access_roles.rb +23 -0
- data/lib/netsuite/records/contact_access_roles_list.rb +9 -0
- data/lib/netsuite/records/contact_addressbook.rb +64 -0
- data/lib/netsuite/records/contact_addressbook_list.rb +11 -0
- data/lib/netsuite/records/contact_list.rb +49 -0
- data/lib/netsuite/records/contact_role.rb +23 -0
- data/lib/netsuite/records/cost_category.rb +28 -0
- data/lib/netsuite/records/credit_memo.rb +59 -0
- data/lib/netsuite/records/credit_memo_apply.rb +16 -0
- data/lib/netsuite/records/credit_memo_apply_list.rb +15 -0
- data/lib/netsuite/records/credit_memo_item.rb +34 -0
- data/lib/netsuite/records/credit_memo_item_list.rb +11 -0
- data/lib/netsuite/records/currency.rb +30 -0
- data/lib/netsuite/records/currency_rate.rb +34 -0
- data/lib/netsuite/records/custom_field.rb +23 -0
- data/lib/netsuite/records/custom_field_list.rb +186 -0
- data/lib/netsuite/records/custom_list.rb +27 -0
- data/lib/netsuite/records/custom_list_custom_value.rb +22 -0
- data/lib/netsuite/records/custom_list_custom_value_list.rb +13 -0
- data/lib/netsuite/records/custom_record.rb +56 -0
- data/lib/netsuite/records/custom_record_ref.rb +50 -0
- data/lib/netsuite/records/custom_record_type.rb +30 -0
- data/lib/netsuite/records/customer.rb +265 -0
- data/lib/netsuite/records/customer_addressbook.rb +64 -0
- data/lib/netsuite/records/customer_addressbook_list.rb +11 -0
- data/lib/netsuite/records/customer_category.rb +26 -0
- data/lib/netsuite/records/customer_credit_cards.rb +36 -0
- data/lib/netsuite/records/customer_credit_cards_list.rb +10 -0
- data/lib/netsuite/records/customer_currency.rb +28 -0
- data/lib/netsuite/records/customer_currency_list.rb +9 -0
- data/lib/netsuite/records/customer_deposit.rb +47 -0
- data/lib/netsuite/records/customer_deposit_apply.rb +17 -0
- data/lib/netsuite/records/customer_deposit_apply_list.rb +12 -0
- data/lib/netsuite/records/customer_partner.rb +24 -0
- data/lib/netsuite/records/customer_partners_list.rb +9 -0
- data/lib/netsuite/records/customer_payment.rb +56 -0
- data/lib/netsuite/records/customer_payment_apply.rb +17 -0
- data/lib/netsuite/records/customer_payment_apply_list.rb +12 -0
- data/lib/netsuite/records/customer_payment_credit.rb +17 -0
- data/lib/netsuite/records/customer_payment_credit_list.rb +12 -0
- data/lib/netsuite/records/customer_refund.rb +52 -0
- data/lib/netsuite/records/customer_refund_apply.rb +16 -0
- data/lib/netsuite/records/customer_refund_apply_list.rb +12 -0
- data/lib/netsuite/records/customer_refund_deposit.rb +16 -0
- data/lib/netsuite/records/customer_refund_deposit_list.rb +11 -0
- data/lib/netsuite/records/customer_sales_team.rb +24 -0
- data/lib/netsuite/records/customer_sales_team_list.rb +9 -0
- data/lib/netsuite/records/customer_status.rb +29 -0
- data/lib/netsuite/records/department.rb +27 -0
- data/lib/netsuite/records/deposit.rb +40 -0
- data/lib/netsuite/records/deposit_application.rb +64 -0
- data/lib/netsuite/records/deposit_cash_back.rb +42 -0
- data/lib/netsuite/records/deposit_cash_back_list.rb +9 -0
- data/lib/netsuite/records/deposit_other.rb +35 -0
- data/lib/netsuite/records/deposit_other_list.rb +9 -0
- data/lib/netsuite/records/deposit_payment.rb +48 -0
- data/lib/netsuite/records/deposit_payment_list.rb +14 -0
- data/lib/netsuite/records/description_item.rb +34 -0
- data/lib/netsuite/records/discount_item.rb +37 -0
- data/lib/netsuite/records/duration.rb +15 -0
- data/lib/netsuite/records/employee.rb +42 -0
- data/lib/netsuite/records/entity_custom_field.rb +53 -0
- data/lib/netsuite/records/estimate.rb +122 -0
- data/lib/netsuite/records/estimate_item.rb +47 -0
- data/lib/netsuite/records/estimate_item_list.rb +11 -0
- data/lib/netsuite/records/file.rb +31 -0
- data/lib/netsuite/records/folder.rb +26 -0
- data/lib/netsuite/records/gift_cert_redemption.rb +22 -0
- data/lib/netsuite/records/gift_cert_redemption_list.rb +11 -0
- data/lib/netsuite/records/gift_certificate.rb +30 -0
- data/lib/netsuite/records/gift_certificate_item.rb +84 -0
- data/lib/netsuite/records/inbound_shipment.rb +32 -0
- data/lib/netsuite/records/inbound_shipment_item.rb +39 -0
- data/lib/netsuite/records/inbound_shipment_item_list.rb +11 -0
- data/lib/netsuite/records/inter_company_journal_entry.rb +48 -0
- data/lib/netsuite/records/inter_company_journal_entry_line.rb +28 -0
- data/lib/netsuite/records/inter_company_journal_entry_line_list.rb +12 -0
- data/lib/netsuite/records/inventory_adjustment.rb +30 -0
- data/lib/netsuite/records/inventory_adjustment_inventory.rb +21 -0
- data/lib/netsuite/records/inventory_adjustment_inventory_list.rb +10 -0
- data/lib/netsuite/records/inventory_assignment.rb +24 -0
- data/lib/netsuite/records/inventory_assignment_list.rb +35 -0
- data/lib/netsuite/records/inventory_detail.rb +18 -0
- data/lib/netsuite/records/inventory_item.rb +341 -0
- data/lib/netsuite/records/inventory_number.rb +34 -0
- data/lib/netsuite/records/inventory_number_locations.rb +16 -0
- data/lib/netsuite/records/inventory_number_locations_list.rb +10 -0
- data/lib/netsuite/records/inventory_transfer.rb +30 -0
- data/lib/netsuite/records/inventory_transfer_inventory.rb +21 -0
- data/lib/netsuite/records/inventory_transfer_inventory_list.rb +10 -0
- data/lib/netsuite/records/invoice.rb +167 -0
- data/lib/netsuite/records/invoice_item.rb +46 -0
- data/lib/netsuite/records/invoice_item_list.rb +15 -0
- data/lib/netsuite/records/item_availability.rb +45 -0
- data/lib/netsuite/records/item_fulfillment.rb +62 -0
- data/lib/netsuite/records/item_fulfillment_item.rb +45 -0
- data/lib/netsuite/records/item_fulfillment_item_list.rb +14 -0
- data/lib/netsuite/records/item_fulfillment_package.rb +24 -0
- data/lib/netsuite/records/item_fulfillment_package_fed_ex.rb +28 -0
- data/lib/netsuite/records/item_fulfillment_package_fed_ex_list.rb +32 -0
- data/lib/netsuite/records/item_fulfillment_package_list.rb +37 -0
- data/lib/netsuite/records/item_fulfillment_package_ups.rb +27 -0
- data/lib/netsuite/records/item_fulfillment_package_ups_list.rb +32 -0
- data/lib/netsuite/records/item_fulfillment_package_usps.rb +26 -0
- data/lib/netsuite/records/item_fulfillment_package_usps_list.rb +32 -0
- data/lib/netsuite/records/item_group.rb +37 -0
- data/lib/netsuite/records/item_member.rb +26 -0
- data/lib/netsuite/records/item_member_list.rb +12 -0
- data/lib/netsuite/records/item_option_custom_field.rb +52 -0
- data/lib/netsuite/records/item_receipt.rb +46 -0
- data/lib/netsuite/records/item_receipt_item.rb +43 -0
- data/lib/netsuite/records/item_receipt_item_list.rb +11 -0
- data/lib/netsuite/records/item_vendor.rb +24 -0
- data/lib/netsuite/records/item_vendor_list.rb +11 -0
- data/lib/netsuite/records/job.rb +41 -0
- data/lib/netsuite/records/job_status.rb +25 -0
- data/lib/netsuite/records/journal_entry.rb +48 -0
- data/lib/netsuite/records/journal_entry_line.rb +27 -0
- data/lib/netsuite/records/journal_entry_line_list.rb +12 -0
- data/lib/netsuite/records/kit_item.rb +71 -0
- data/lib/netsuite/records/location.rb +40 -0
- data/lib/netsuite/records/locations_list.rb +15 -0
- data/lib/netsuite/records/lot_numbered_assembly_item.rb +64 -0
- data/lib/netsuite/records/lot_numbered_inventory_item.rb +260 -0
- data/lib/netsuite/records/matrix_option_list.rb +71 -0
- data/lib/netsuite/records/member_list.rb +10 -0
- data/lib/netsuite/records/message.rb +30 -0
- data/lib/netsuite/records/non_inventory_purchase_item.rb +52 -0
- data/lib/netsuite/records/non_inventory_resale_item.rb +189 -0
- data/lib/netsuite/records/non_inventory_sale_item.rb +165 -0
- data/lib/netsuite/records/note.rb +33 -0
- data/lib/netsuite/records/note_type.rb +27 -0
- data/lib/netsuite/records/null_field_list.rb +15 -0
- data/lib/netsuite/records/opportunity.rb +45 -0
- data/lib/netsuite/records/opportunity_item.rb +41 -0
- data/lib/netsuite/records/opportunity_item_list.rb +9 -0
- data/lib/netsuite/records/other_charge_sale_item.rb +73 -0
- data/lib/netsuite/records/partner.rb +35 -0
- data/lib/netsuite/records/payment_item.rb +36 -0
- data/lib/netsuite/records/payment_method.rb +28 -0
- data/lib/netsuite/records/payroll_item.rb +36 -0
- data/lib/netsuite/records/phone_call.rb +29 -0
- data/lib/netsuite/records/price.rb +17 -0
- data/lib/netsuite/records/price_level.rb +26 -0
- data/lib/netsuite/records/price_list.rb +9 -0
- data/lib/netsuite/records/pricing.rb +20 -0
- data/lib/netsuite/records/pricing_matrix.rb +11 -0
- data/lib/netsuite/records/promotion_code.rb +38 -0
- data/lib/netsuite/records/promotions.rb +26 -0
- data/lib/netsuite/records/promotions_list.rb +9 -0
- data/lib/netsuite/records/purchase_order.rb +52 -0
- data/lib/netsuite/records/purchase_order_item.rb +42 -0
- data/lib/netsuite/records/purchase_order_item_list.rb +11 -0
- data/lib/netsuite/records/record_ref.rb +38 -0
- data/lib/netsuite/records/record_ref_list.rb +22 -0
- data/lib/netsuite/records/return_authorization.rb +135 -0
- data/lib/netsuite/records/return_authorization_item.rb +43 -0
- data/lib/netsuite/records/return_authorization_item_list.rb +11 -0
- data/lib/netsuite/records/rev_rec_schedule.rb +32 -0
- data/lib/netsuite/records/rev_rec_template.rb +25 -0
- data/lib/netsuite/records/role_list.rb +24 -0
- data/lib/netsuite/records/roles.rb +17 -0
- data/lib/netsuite/records/sales_order.rb +61 -0
- data/lib/netsuite/records/sales_order_item.rb +49 -0
- data/lib/netsuite/records/sales_order_item_list.rb +11 -0
- data/lib/netsuite/records/sales_order_ship_group_list.rb +11 -0
- data/lib/netsuite/records/sales_role.rb +26 -0
- data/lib/netsuite/records/sales_tax_item.rb +34 -0
- data/lib/netsuite/records/serialized_assembly_item.rb +240 -0
- data/lib/netsuite/records/serialized_inventory_item.rb +248 -0
- data/lib/netsuite/records/serialized_inventory_item_location.rb +36 -0
- data/lib/netsuite/records/serialized_inventory_item_locations_list.rb +10 -0
- data/lib/netsuite/records/serialized_inventory_item_numbers.rb +15 -0
- data/lib/netsuite/records/serialized_inventory_item_numbers_list.rb +10 -0
- data/lib/netsuite/records/service_resale_item.rb +154 -0
- data/lib/netsuite/records/service_sale_item.rb +50 -0
- data/lib/netsuite/records/ship_address.rb +17 -0
- data/lib/netsuite/records/site_category.rb +33 -0
- data/lib/netsuite/records/subscription.rb +18 -0
- data/lib/netsuite/records/subscriptions_list.rb +10 -0
- data/lib/netsuite/records/subsidiary.rb +38 -0
- data/lib/netsuite/records/subtotal_item.rb +34 -0
- data/lib/netsuite/records/support_case.rb +32 -0
- data/lib/netsuite/records/support_case_type.rb +26 -0
- data/lib/netsuite/records/task.rb +31 -0
- data/lib/netsuite/records/tax_group.rb +35 -0
- data/lib/netsuite/records/tax_type.rb +22 -0
- data/lib/netsuite/records/term.rb +27 -0
- data/lib/netsuite/records/time_bill.rb +32 -0
- data/lib/netsuite/records/transaction_body_custom_field.rb +61 -0
- data/lib/netsuite/records/transaction_column_custom_field.rb +59 -0
- data/lib/netsuite/records/transaction_ship_group.rb +40 -0
- data/lib/netsuite/records/transfer_order.rb +45 -0
- data/lib/netsuite/records/transfer_order_item.rb +43 -0
- data/lib/netsuite/records/transfer_order_item_list.rb +11 -0
- data/lib/netsuite/records/translation.rb +17 -0
- data/lib/netsuite/records/translation_list.rb +11 -0
- data/lib/netsuite/records/units_type.rb +25 -0
- data/lib/netsuite/records/units_type_uom.rb +20 -0
- data/lib/netsuite/records/units_type_uom_list.rb +12 -0
- data/lib/netsuite/records/vendor.rb +46 -0
- data/lib/netsuite/records/vendor_bill.rb +53 -0
- data/lib/netsuite/records/vendor_bill_expense.rb +40 -0
- data/lib/netsuite/records/vendor_bill_expense_list.rb +13 -0
- data/lib/netsuite/records/vendor_bill_item.rb +46 -0
- data/lib/netsuite/records/vendor_bill_item_list.rb +12 -0
- data/lib/netsuite/records/vendor_category.rb +26 -0
- data/lib/netsuite/records/vendor_credit.rb +54 -0
- data/lib/netsuite/records/vendor_credit_apply.rb +18 -0
- data/lib/netsuite/records/vendor_credit_apply_list.rb +12 -0
- data/lib/netsuite/records/vendor_credit_expense.rb +31 -0
- data/lib/netsuite/records/vendor_credit_expense_list.rb +12 -0
- data/lib/netsuite/records/vendor_credit_item.rb +34 -0
- data/lib/netsuite/records/vendor_credit_item_list.rb +12 -0
- data/lib/netsuite/records/vendor_currency.rb +26 -0
- data/lib/netsuite/records/vendor_currency_list.rb +9 -0
- data/lib/netsuite/records/vendor_payment.rb +52 -0
- data/lib/netsuite/records/vendor_payment_apply.rb +16 -0
- data/lib/netsuite/records/vendor_payment_apply_list.rb +12 -0
- data/lib/netsuite/records/vendor_return_authorization.rb +30 -0
- data/lib/netsuite/records/vendor_return_authorization_item.rb +23 -0
- data/lib/netsuite/records/vendor_return_authorization_item_list.rb +12 -0
- data/lib/netsuite/records/work_order.rb +45 -0
- data/lib/netsuite/records/work_order_item.rb +30 -0
- data/lib/netsuite/records/work_order_item_list.rb +11 -0
- data/lib/netsuite/response.rb +20 -0
- data/lib/netsuite/rest/utilities/request.rb +62 -0
- data/lib/netsuite/rest/utilities/roles.rb +47 -0
- data/lib/netsuite/support/actions.rb +74 -0
- data/lib/netsuite/support/attributes.rb +22 -0
- data/lib/netsuite/support/country.rb +289 -0
- data/lib/netsuite/support/fields.rb +86 -0
- data/lib/netsuite/support/record_refs.rb +30 -0
- data/lib/netsuite/support/records.rb +89 -0
- data/lib/netsuite/support/requests.rb +56 -0
- data/lib/netsuite/support/search_result.rb +150 -0
- data/lib/netsuite/support/sublist.rb +71 -0
- data/lib/netsuite/utilities/data_center.rb +53 -0
- data/lib/netsuite/utilities/strings.rb +15 -0
- data/lib/netsuite/utilities.rb +324 -0
- data/lib/netsuite/version.rb +3 -0
- data/lib/netsuite.rb +348 -0
- data/netsuite.gemspec +30 -0
- data/spec/integration/soap_http_spec.rb +76 -0
- data/spec/netsuite/actions/add_spec.rb +155 -0
- data/spec/netsuite/actions/async_add_list_spec.rb +123 -0
- data/spec/netsuite/actions/async_delete_list_spec.rb +60 -0
- data/spec/netsuite/actions/async_get_list_spec.rb +78 -0
- data/spec/netsuite/actions/async_initialize_list_spec.rb +106 -0
- data/spec/netsuite/actions/async_lifecycle_spec.rb +51 -0
- data/spec/netsuite/actions/async_response_spec.rb +187 -0
- data/spec/netsuite/actions/async_search_spec.rb +27 -0
- data/spec/netsuite/actions/async_update_list_spec.rb +80 -0
- data/spec/netsuite/actions/async_upsert_list_spec.rb +157 -0
- data/spec/netsuite/actions/attach_file_spec.rb +59 -0
- data/spec/netsuite/actions/check_async_status_spec.rb +29 -0
- data/spec/netsuite/actions/delete_list_spec.rb +86 -0
- data/spec/netsuite/actions/delete_spec.rb +93 -0
- data/spec/netsuite/actions/get_all_spec.rb +100 -0
- data/spec/netsuite/actions/get_async_result_spec.rb +78 -0
- data/spec/netsuite/actions/get_deleted_spec.rb +60 -0
- data/spec/netsuite/actions/get_list_spec.rb +157 -0
- data/spec/netsuite/actions/get_select_value_spec.rb +43 -0
- data/spec/netsuite/actions/get_spec.rb +72 -0
- data/spec/netsuite/actions/initialize_spec.rb +34 -0
- data/spec/netsuite/actions/search_spec.rb +387 -0
- data/spec/netsuite/actions/update_list_spec.rb +107 -0
- data/spec/netsuite/actions/update_spec.rb +133 -0
- data/spec/netsuite/actions/upsert_list_spec.rb +112 -0
- data/spec/netsuite/actions/upsert_spec.rb +117 -0
- data/spec/netsuite/configuration_spec.rb +661 -0
- data/spec/netsuite/records/account_spec.rb +107 -0
- data/spec/netsuite/records/accounting_period_spec.rb +138 -0
- data/spec/netsuite/records/address_spec.rb +139 -0
- data/spec/netsuite/records/assembly_item_spec.rb +64 -0
- data/spec/netsuite/records/basic_record_spec.rb +128 -0
- data/spec/netsuite/records/bill_address_spec.rb +52 -0
- data/spec/netsuite/records/billing_schedule_milestone_list_spec.rb +24 -0
- data/spec/netsuite/records/billing_schedule_milestone_spec.rb +51 -0
- data/spec/netsuite/records/billing_schedule_recurrence_list_spec.rb +24 -0
- data/spec/netsuite/records/billing_schedule_recurrence_spec.rb +49 -0
- data/spec/netsuite/records/billing_schedule_spec.rb +164 -0
- data/spec/netsuite/records/bin_number_spec.rb +23 -0
- data/spec/netsuite/records/campaign_spec.rb +43 -0
- data/spec/netsuite/records/cash_refund_item_list_spec.rb +27 -0
- data/spec/netsuite/records/cash_refund_item_spec.rb +27 -0
- data/spec/netsuite/records/cash_refund_spec.rb +152 -0
- data/spec/netsuite/records/cash_sale_item_list_spec.rb +27 -0
- data/spec/netsuite/records/cash_sale_item_spec.rb +23 -0
- data/spec/netsuite/records/cash_sale_spec.rb +34 -0
- data/spec/netsuite/records/classification_spec.rb +77 -0
- data/spec/netsuite/records/cost_category_spec.rb +105 -0
- data/spec/netsuite/records/credit_memo_apply_list_spec.rb +27 -0
- data/spec/netsuite/records/credit_memo_apply_spec.rb +14 -0
- data/spec/netsuite/records/credit_memo_item_list_spec.rb +26 -0
- data/spec/netsuite/records/credit_memo_item_spec.rb +29 -0
- data/spec/netsuite/records/credit_memo_spec.rb +213 -0
- data/spec/netsuite/records/currency_rate_spec.rb +45 -0
- data/spec/netsuite/records/custom_field_list_spec.rb +276 -0
- data/spec/netsuite/records/custom_list_spec.rb +21 -0
- data/spec/netsuite/records/custom_record_spec.rb +125 -0
- data/spec/netsuite/records/custom_record_type_spec.rb +114 -0
- data/spec/netsuite/records/customer_addressbook_list_spec.rb +41 -0
- data/spec/netsuite/records/customer_addressbook_spec.rb +105 -0
- data/spec/netsuite/records/customer_credit_cards_list_spec.rb +23 -0
- data/spec/netsuite/records/customer_payment_apply_list_spec.rb +25 -0
- data/spec/netsuite/records/customer_payment_credit_list_spec.rb +26 -0
- data/spec/netsuite/records/customer_payment_spec.rb +168 -0
- data/spec/netsuite/records/customer_refund_apply_list_spec.rb +25 -0
- data/spec/netsuite/records/customer_refund_apply_spec.rb +14 -0
- data/spec/netsuite/records/customer_refund_deposit_list_spec.rb +25 -0
- data/spec/netsuite/records/customer_refund_deposit_spec.rb +14 -0
- data/spec/netsuite/records/customer_refund_spec.rb +205 -0
- data/spec/netsuite/records/customer_sales_team_list_spec.rb +41 -0
- data/spec/netsuite/records/customer_spec.rb +561 -0
- data/spec/netsuite/records/department_spec.rb +103 -0
- data/spec/netsuite/records/deposit_spec.rb +165 -0
- data/spec/netsuite/records/discount_item_spec.rb +125 -0
- data/spec/netsuite/records/duration_spec.rb +14 -0
- data/spec/netsuite/records/employee_spec.rb +148 -0
- data/spec/netsuite/records/entity_custom_field_spec.rb +34 -0
- data/spec/netsuite/records/estimate_item_list_spec.rb +26 -0
- data/spec/netsuite/records/estimate_item_spec.rb +35 -0
- data/spec/netsuite/records/estimate_spec.rb +274 -0
- data/spec/netsuite/records/file_spec.rb +11 -0
- data/spec/netsuite/records/folder_spec.rb +33 -0
- data/spec/netsuite/records/gift_cert_redemption_list_spec.rb +26 -0
- data/spec/netsuite/records/gift_cert_redemption_spec.rb +21 -0
- data/spec/netsuite/records/inter_company_journal_entry_line_list_spec.rb +26 -0
- data/spec/netsuite/records/inter_company_journal_entry_line_spec.rb +60 -0
- data/spec/netsuite/records/inter_company_journal_entry_spec.rb +156 -0
- data/spec/netsuite/records/inventory_assignment_list_spec.rb +59 -0
- data/spec/netsuite/records/inventory_assignment_spec.rb +21 -0
- data/spec/netsuite/records/inventory_detail_spec.rb +13 -0
- data/spec/netsuite/records/inventory_item_spec.rb +532 -0
- data/spec/netsuite/records/inventory_transfer_spec.rb +79 -0
- data/spec/netsuite/records/invoice_item_list_spec.rb +24 -0
- data/spec/netsuite/records/invoice_item_spec.rb +79 -0
- data/spec/netsuite/records/invoice_spec.rb +494 -0
- data/spec/netsuite/records/item_availability_spec.rb +59 -0
- data/spec/netsuite/records/item_fulfillment_package_fed_ex_list_spec.rb +27 -0
- data/spec/netsuite/records/item_fulfillment_package_list_spec.rb +27 -0
- data/spec/netsuite/records/item_fulfillment_package_ups_list_spec.rb +27 -0
- data/spec/netsuite/records/item_fulfillment_package_usps_list_spec.rb +27 -0
- data/spec/netsuite/records/item_fulfillment_spec.rb +49 -0
- data/spec/netsuite/records/item_group_spec.rb +117 -0
- data/spec/netsuite/records/item_member_list_spec.rb +26 -0
- data/spec/netsuite/records/item_option_custom_field_spec.rb +27 -0
- data/spec/netsuite/records/item_vendor_list_spec.rb +27 -0
- data/spec/netsuite/records/item_vendor_spec.rb +27 -0
- data/spec/netsuite/records/job_spec.rb +201 -0
- data/spec/netsuite/records/journal_entry_line_list_spec.rb +26 -0
- data/spec/netsuite/records/journal_entry_line_spec.rb +59 -0
- data/spec/netsuite/records/journal_entry_spec.rb +156 -0
- data/spec/netsuite/records/kit_item_spec.rb +117 -0
- data/spec/netsuite/records/location_spec.rb +51 -0
- data/spec/netsuite/records/lot_numbered_inventory_item_spec.rb +247 -0
- data/spec/netsuite/records/matrix_option_list_spec.rb +61 -0
- data/spec/netsuite/records/message_spec.rb +49 -0
- data/spec/netsuite/records/non_inventory_resale_item_spec.rb +300 -0
- data/spec/netsuite/records/non_inventory_sale_item_spec.rb +278 -0
- data/spec/netsuite/records/note_spec.rb +134 -0
- data/spec/netsuite/records/note_type_spec.rb +88 -0
- data/spec/netsuite/records/null_field_list_spec.rb +30 -0
- data/spec/netsuite/records/partner_spec.rb +143 -0
- data/spec/netsuite/records/payment_item_spec.rb +117 -0
- data/spec/netsuite/records/payment_method_spec.rb +49 -0
- data/spec/netsuite/records/phone_call_spec.rb +17 -0
- data/spec/netsuite/records/pomo_code_spec.rb +40 -0
- data/spec/netsuite/records/price_level_spec.rb +16 -0
- data/spec/netsuite/records/pricing_matrix_spec.rb +27 -0
- data/spec/netsuite/records/record_ref_spec.rb +87 -0
- data/spec/netsuite/records/return_authorization_item_list_spec.rb +26 -0
- data/spec/netsuite/records/return_authorization_item_spec.rb +31 -0
- data/spec/netsuite/records/return_authorization_spec.rb +62 -0
- data/spec/netsuite/records/rev_rec_template_spec.rb +39 -0
- data/spec/netsuite/records/sales_order_item_list_spec.rb +26 -0
- data/spec/netsuite/records/sales_order_item_spec.rb +36 -0
- data/spec/netsuite/records/sales_order_spec.rb +250 -0
- data/spec/netsuite/records/sales_tax_item_spec.rb +26 -0
- data/spec/netsuite/records/service_resale_item_spec.rb +239 -0
- data/spec/netsuite/records/service_sale_item_spec.rb +135 -0
- data/spec/netsuite/records/ship_address_spec.rb +36 -0
- data/spec/netsuite/records/site_category_spec.rb +51 -0
- data/spec/netsuite/records/subscription_spec.rb +37 -0
- data/spec/netsuite/records/subscriptions_list_spec.rb +19 -0
- data/spec/netsuite/records/subsidiary_spec.rb +25 -0
- data/spec/netsuite/records/support_case_spec.rb +157 -0
- data/spec/netsuite/records/support_case_type_spec.rb +22 -0
- data/spec/netsuite/records/tax_type_spec.rb +11 -0
- data/spec/netsuite/records/term_spec.rb +96 -0
- data/spec/netsuite/records/transaction_body_custom_field_spec.rb +32 -0
- data/spec/netsuite/records/transaction_column_custom_field_spec.rb +32 -0
- data/spec/netsuite/records/translation_list_spec.rb +34 -0
- data/spec/netsuite/records/translation_spec.rb +28 -0
- data/spec/netsuite/records/units_type_spec.rb +33 -0
- data/spec/netsuite/records/units_type_uom_list_spec.rb +23 -0
- data/spec/netsuite/records/units_type_uom_spec.rb +14 -0
- data/spec/netsuite/records/vendor_bill_expense_list_spec.rb +36 -0
- data/spec/netsuite/records/vendor_bill_expense_spec.rb +72 -0
- data/spec/netsuite/records/vendor_bill_item_list_spec.rb +36 -0
- data/spec/netsuite/records/vendor_bill_item_spec.rb +118 -0
- data/spec/netsuite/records/vendor_bill_spec.rb +187 -0
- data/spec/netsuite/records/vendor_credit_spec.rb +29 -0
- data/spec/netsuite/records/vendor_payment_apply_list_spec.rb +25 -0
- data/spec/netsuite/records/vendor_payment_apply_spec.rb +15 -0
- data/spec/netsuite/records/vendor_payment_spec.rb +164 -0
- data/spec/netsuite/records/vendor_spec.rb +145 -0
- data/spec/netsuite/records/work_order_item_list_spec.rb +26 -0
- data/spec/netsuite/records/work_order_item_spec.rb +45 -0
- data/spec/netsuite/records/work_order_spec.rb +92 -0
- data/spec/netsuite/response_spec.rb +34 -0
- data/spec/netsuite/support/fields_spec.rb +107 -0
- data/spec/netsuite/support/record_refs_spec.rb +14 -0
- data/spec/netsuite/support/records_spec.rb +60 -0
- data/spec/netsuite/support/refresh_spec.rb +28 -0
- data/spec/netsuite/support/requests_spec.rb +38 -0
- data/spec/netsuite/support/search_result_spec.rb +53 -0
- data/spec/netsuite/support/sublist_spec.rb +42 -0
- data/spec/netsuite/utilities/data_center_spec.rb +110 -0
- data/spec/netsuite/utilities/request_spec.rb +29 -0
- data/spec/netsuite/utilities/roles_spec.rb +145 -0
- data/spec/netsuite/utilities_spec.rb +140 -0
- data/spec/netsuite_spec.rb +41 -0
- data/spec/spec_helper.rb +50 -0
- data/spec/support/configuration.rb +23 -0
- data/spec/support/field_matcher.rb +21 -0
- data/spec/support/fixtures/add/add_customer.xml +16 -0
- data/spec/support/fixtures/add/add_file.xml +20 -0
- data/spec/support/fixtures/add/add_invoice.xml +20 -0
- data/spec/support/fixtures/add/add_invoice_error.xml +19 -0
- data/spec/support/fixtures/add/add_invoice_multiple_errors.xml +24 -0
- data/spec/support/fixtures/async_add_list/async_add_list_pending.xml +18 -0
- data/spec/support/fixtures/async_delete_list/async_delete_list_pending.xml +18 -0
- data/spec/support/fixtures/async_get_list/async_get_list_pending.xml +18 -0
- data/spec/support/fixtures/async_initialize_list/async_initialize_list_pending.xml +18 -0
- data/spec/support/fixtures/async_search/async_search_pending.xml +18 -0
- data/spec/support/fixtures/async_update_list/async_update_list_pending.xml +18 -0
- data/spec/support/fixtures/async_upsert_list/async_upsert_list_customers.xml +16 -0
- data/spec/support/fixtures/async_upsert_list/async_upsert_list_one_customer.xml +16 -0
- data/spec/support/fixtures/async_upsert_list/async_upsert_list_with_errors.xml +21 -0
- data/spec/support/fixtures/attach/attach_file_to_sales_order.xml +16 -0
- data/spec/support/fixtures/attach/attach_file_to_sales_order_error.xml +20 -0
- data/spec/support/fixtures/check_async_status/check_async_status_pending.xml +18 -0
- data/spec/support/fixtures/custom_fields/multi_select.xml +47 -0
- data/spec/support/fixtures/delete/delete_customer.xml +16 -0
- data/spec/support/fixtures/delete/delete_customer_error.xml +21 -0
- data/spec/support/fixtures/delete/delete_customer_multiple_errors.xml +25 -0
- data/spec/support/fixtures/delete_list/delete_list_customers.xml +26 -0
- data/spec/support/fixtures/delete_list/delete_list_customers_with_errors.xml +31 -0
- data/spec/support/fixtures/get/get_customer.xml +61 -0
- data/spec/support/fixtures/get/get_invoice.xml +101 -0
- data/spec/support/fixtures/get_all/get_all_currencies.xml +24 -0
- data/spec/support/fixtures/get_all/get_all_error.xml +15 -0
- data/spec/support/fixtures/get_async_result/get_async_result_finished.xml +22 -0
- data/spec/support/fixtures/get_async_result/get_async_result_upsert_list_finished.xml +26 -0
- data/spec/support/fixtures/get_async_result/get_async_result_write_list_multiple.xml +34 -0
- data/spec/support/fixtures/get_deleted/get_deleted_invoices.xml +38 -0
- data/spec/support/fixtures/get_item_availability/get_item_availability.xml +46 -0
- data/spec/support/fixtures/get_list/get_list_customer_error.xml +22 -0
- data/spec/support/fixtures/get_list/get_list_customers.xml +21 -0
- data/spec/support/fixtures/get_list/get_list_customers_multiple.xml +28 -0
- data/spec/support/fixtures/get_select_value/empty_result.xml +22 -0
- data/spec/support/fixtures/get_select_value/item_fulfillment_ship_method.xml +43 -0
- data/spec/support/fixtures/initialize/initialize_invoice_from_customer.xml +69 -0
- data/spec/support/fixtures/login/failure_concurrent_requests.xml +15 -0
- data/spec/support/fixtures/login/failure_invalid_credentials.xml +15 -0
- data/spec/support/fixtures/login/success.xml +35 -0
- data/spec/support/fixtures/search/basic_search_contact.xml +39 -0
- data/spec/support/fixtures/search/saved_search_customer.xml +54 -0
- data/spec/support/fixtures/search/saved_search_item.xml +55 -0
- data/spec/support/fixtures/search/saved_search_joined_custom_customer.xml +101 -0
- data/spec/support/fixtures/search/single_search_result.xml +46 -0
- data/spec/support/fixtures/soap/v2025_2_0/wsdl/netsuite.wsdl +2531 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/activities/scheduling.xsd +603 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/activities/schedulingTypes.xsd +198 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/documents/fileCabinet.xsd +159 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/documents/fileCabinetTypes.xsd +110 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/general/communication.xsd +210 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/general/communicationTypes.xsd +20 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/lists/accounting.xsd +6768 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/lists/accountingTypes.xsd +1043 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/lists/employeeTypes.xsd +344 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/lists/employees.xsd +518 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/lists/marketing.xsd +528 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/lists/marketingTypes.xsd +145 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/lists/relationshipTypes.xsd +190 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/lists/relationships.xsd +1658 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/lists/supplyChain.xsd +282 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/lists/supplyChainTypes.xsd +26 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/lists/support.xsd +534 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/lists/supportTypes.xsd +74 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/lists/website.xsd +99 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/lists/websiteTypes.xsd +2 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/platform/common.xsd +8411 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/platform/commonTypes.xsd +1371 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/platform/core.xsd +1096 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/platform/coreTypes.xsd +877 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/platform/faultTypes.xsd +1446 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/platform/faults.xsd +82 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/platform/messages.xsd +664 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/setup/customization.xsd +1604 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/setup/customizationTypes.xsd +119 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/transactions/bank.xsd +212 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/transactions/bankTypes.xsd +2 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/transactions/customerTypes.xsd +99 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/transactions/customers.xsd +1131 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/transactions/demandPlanning.xsd +173 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/transactions/demandPlanningTypes.xsd +52 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/transactions/employeeTypes.xsd +10 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/transactions/employees.xsd +723 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/transactions/financial.xsd +88 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/transactions/financialTypes.xsd +9 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/transactions/general.xsd +364 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/transactions/inventory.xsd +780 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/transactions/inventoryTypes.xsd +49 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/transactions/purchaseTypes.xsd +44 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/transactions/purchases.xsd +986 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/transactions/saleTypes.xsd +754 -0
- data/spec/support/fixtures/soap/v2025_2_0/xsd/transactions/sales.xsd +2025 -0
- data/spec/support/fixtures/update/update_customer.xml +16 -0
- data/spec/support/fixtures/update/update_customer_error.xml +21 -0
- data/spec/support/fixtures/update/update_customer_multiple_errors.xml +25 -0
- data/spec/support/fixtures/update/update_invoice.xml +16 -0
- data/spec/support/fixtures/update_list/update_list_items.xml +22 -0
- data/spec/support/fixtures/update_list/update_list_one_item.xml +18 -0
- data/spec/support/fixtures/update_list/update_list_with_errors.xml +32 -0
- data/spec/support/fixtures/upsert/upsert_customer.xml +16 -0
- data/spec/support/fixtures/upsert/upsert_invoice.xml +16 -0
- data/spec/support/fixtures/upsert/upsert_invoice_error.xml +20 -0
- data/spec/support/fixtures/upsert/upsert_invoice_multiple_errors.xml +24 -0
- data/spec/support/fixtures/upsert_list/upsert_list_customers.xml +21 -0
- data/spec/support/fixtures/upsert_list/upsert_list_one_customer.xml +17 -0
- data/spec/support/fixtures/upsert_list/upsert_list_with_errors.xml +32 -0
- data/spec/support/read_only_field_matcher.rb +7 -0
- data/spec/support/record_ref_matcher.rb +25 -0
- data/spec/support/savon.rb +5 -0
- data/spec/support/search_only_field_matcher.rb +7 -0
- data/spec/support/webmock_soap_helper.rb +15 -0
- data/workflow.md +368 -0
- metadata +764 -0
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe NetSuite::Configuration do
|
|
4
|
+
let(:config) { NetSuite::Configuration }
|
|
5
|
+
|
|
6
|
+
before do
|
|
7
|
+
config.reset!
|
|
8
|
+
config.api_version = '2025_2'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
describe '#reset!' do
|
|
12
|
+
it 'clears the attributes hash' do
|
|
13
|
+
config.attributes[:blah] = 'something'
|
|
14
|
+
expect(config.attributes).not_to be_empty
|
|
15
|
+
config.reset!
|
|
16
|
+
expect(config.attributes).to be_empty
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'treats attributes as shared/global in default single tenant mode' do
|
|
20
|
+
config.attributes[:blah] = 'something'
|
|
21
|
+
expect(config.attributes[:blah]).to eq('something')
|
|
22
|
+
|
|
23
|
+
thread = Thread.new {
|
|
24
|
+
expect(config.attributes[:blah]).to eq('something')
|
|
25
|
+
|
|
26
|
+
config.attributes[:blah] = 'something_else'
|
|
27
|
+
expect(config.attributes[:blah]).to eq('something_else')
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
thread.join
|
|
31
|
+
|
|
32
|
+
expect(config.attributes[:blah]).to eq('something_else')
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'treats attributes as thread-local in multi-tenant mode, which each thread starting with empty attributes' do
|
|
36
|
+
begin
|
|
37
|
+
config.multi_tenant!
|
|
38
|
+
|
|
39
|
+
config.attributes[:blah] = 'something'
|
|
40
|
+
expect(config.attributes[:blah]).to eq('something')
|
|
41
|
+
|
|
42
|
+
thread = Thread.new {
|
|
43
|
+
expect(config.attributes[:blah]).to be_nil
|
|
44
|
+
|
|
45
|
+
config.attributes[:blah] = 'something_else'
|
|
46
|
+
expect(config.attributes[:blah]).to eq('something_else')
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
thread.join
|
|
50
|
+
|
|
51
|
+
expect(config.attributes[:blah]).to eq('something')
|
|
52
|
+
ensure
|
|
53
|
+
config.instance_variable_set(:@multi_tenant, false)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
describe '#filters' do
|
|
59
|
+
it 'filters out email and password by default' do
|
|
60
|
+
expect(config.filters).to eq([:password, :email, :consumerKey, :token])
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it 'allows the user to set custom filters' do
|
|
64
|
+
config.filters([:special])
|
|
65
|
+
|
|
66
|
+
expect(config.filters).to eq([:special])
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
describe "#savon_params" do
|
|
71
|
+
it 'includes the expectd logging details' do
|
|
72
|
+
fake_logger = double "fake logger"
|
|
73
|
+
config.logger = fake_logger
|
|
74
|
+
config.log_level = :fake_level
|
|
75
|
+
config.silent = true
|
|
76
|
+
|
|
77
|
+
expect(config.savon_params).to include(logger: fake_logger)
|
|
78
|
+
expect(config.savon_params).to include(log_level: :fake_level)
|
|
79
|
+
expect(config.savon_params).to include(log: false)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
context "when savon is on a recent version" do
|
|
83
|
+
before { stub_const "Savon::VERSION", "2.13.0" }
|
|
84
|
+
|
|
85
|
+
it 'includes the expected timeouts' do
|
|
86
|
+
config.read_timeout = 9.1
|
|
87
|
+
config.open_timeout = 10.2
|
|
88
|
+
config.write_timeout = 11.3
|
|
89
|
+
expect(config.savon_params).to include(read_timeout: be_within(0.01).of(9.1))
|
|
90
|
+
expect(config.savon_params).to include(open_timeout: be_within(0.01).of(10.2))
|
|
91
|
+
expect(config.savon_params).to include(write_timeout: be_within(0.01).of(11.3))
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
context "when savon is on an older version" do
|
|
96
|
+
before { stub_const "Savon::VERSION", "2.12.1" }
|
|
97
|
+
|
|
98
|
+
it 'includes the expected timeouts' do
|
|
99
|
+
config.read_timeout = 9.1
|
|
100
|
+
config.open_timeout = 10.2
|
|
101
|
+
expect(config.savon_params).to include(read_timeout: be_within(0.01).of(9.1))
|
|
102
|
+
expect(config.savon_params).to include(open_timeout: be_within(0.01).of(10.2))
|
|
103
|
+
expect(config.savon_params).not_to include(:write_timeout)
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
it 'constructs the appropriate soap headers' do
|
|
108
|
+
config.soap_header = { :foo => "foo-1" }
|
|
109
|
+
credentials = { :bar => "bar-2" }
|
|
110
|
+
soap_header_extra_info = { :baz => "baz-3" }
|
|
111
|
+
|
|
112
|
+
savon_params = config.savon_params({}, credentials, soap_header_extra_info)
|
|
113
|
+
expect(savon_params[:soap_header]).to include(:foo => "foo-1", :baz => "baz-3")
|
|
114
|
+
expect(savon_params[:soap_header]).to include("platformMsgs:passport")
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
it 'includes the correct wsdl' do
|
|
118
|
+
uncached_wsdl = double('uncached wsdl')
|
|
119
|
+
allow(config).to receive(:wsdl).and_return(uncached_wsdl)
|
|
120
|
+
|
|
121
|
+
cached_wsdl = double('cached wsdl')
|
|
122
|
+
allow(config).to receive(:cached_wsdl).and_return(cached_wsdl)
|
|
123
|
+
expect(config.savon_params[:wsdl]).to eq(cached_wsdl)
|
|
124
|
+
|
|
125
|
+
allow(config).to receive(:cached_wsdl).and_return(nil)
|
|
126
|
+
expect(config.savon_params[:wsdl]).to eq(uncached_wsdl)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
it 'includes the other parameters' do
|
|
130
|
+
config.endpoint = "fake endpoint"
|
|
131
|
+
expect(config.savon_params).to include(:endpoint => "fake endpoint")
|
|
132
|
+
|
|
133
|
+
expect(config.savon_params).to include(:pretty_print_xml => true)
|
|
134
|
+
|
|
135
|
+
config.filters = [:a, :b]
|
|
136
|
+
expect(config.savon_params).to include(:filters => [:a, :b])
|
|
137
|
+
|
|
138
|
+
config.proxy = "fake proxy"
|
|
139
|
+
expect(config.savon_params).to include(:proxy => "fake proxy")
|
|
140
|
+
|
|
141
|
+
expect(config.savon_params[:namespaces]).to eq(config.namespaces)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
it 'merges in the supplied params' do
|
|
145
|
+
supplied_params = { :foo => "bar", :baz => "blam" }
|
|
146
|
+
expect(config.savon_params(supplied_params)).to include(supplied_params)
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
describe '#connection' do
|
|
151
|
+
EXAMPLE_ENDPOINT = 'https://1023.suitetalk.api.netsuite.com/services/NetSuitePort_2020_2'
|
|
152
|
+
before(:each) do
|
|
153
|
+
# reset clears out the password info
|
|
154
|
+
config.email 'me@example.com'
|
|
155
|
+
config.password 'me@example.com'
|
|
156
|
+
config.endpoint EXAMPLE_ENDPOINT
|
|
157
|
+
config.account 1023
|
|
158
|
+
config.wsdl "my_wsdl"
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
it 'returns a Savon::Client object that allows requests to the service' do
|
|
162
|
+
expect(config.connection).to be_kind_of(Savon::Client)
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
it 'caches the client' do
|
|
166
|
+
expect(config.wsdl_cache).to be_empty
|
|
167
|
+
conn = config.connection
|
|
168
|
+
|
|
169
|
+
expect(
|
|
170
|
+
config.wsdl_cache.fetch(config.wsdl)
|
|
171
|
+
).to eq(conn)
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
it 'uses cached wsdls' do
|
|
175
|
+
allow(config).to receive(:cached_wsdl)
|
|
176
|
+
config.connection
|
|
177
|
+
|
|
178
|
+
expect(config).to have_received(:cached_wsdl)
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
it 'sets the endpoint on the Savon client' do
|
|
182
|
+
# this is ugly/brittle, but it's hard to see how else to test this
|
|
183
|
+
savon_configs = config.connection.globals.instance_eval {@options}
|
|
184
|
+
expect(savon_configs.fetch(:endpoint)).to eq(EXAMPLE_ENDPOINT)
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
it 'handles a nil endpoint' do
|
|
188
|
+
config.endpoint = nil
|
|
189
|
+
# this is ugly/brittle, but it's hard to see how else to test this
|
|
190
|
+
savon_configs = config.connection.globals.instance_eval {@options}
|
|
191
|
+
expect(savon_configs.fetch(:endpoint)).to eq(nil)
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
describe '#wsdl' do
|
|
196
|
+
context 'when the wsdl has been set' do
|
|
197
|
+
before do
|
|
198
|
+
config.wsdl = 'https://system.sandbox.netsuite.com/wsdl/v2025_2_0/netsuite.wsdl'
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
it 'returns a path to the WSDL to use for the API' do
|
|
202
|
+
expect(config.wsdl).to eql('https://system.sandbox.netsuite.com/wsdl/v2025_2_0/netsuite.wsdl')
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
context 'when the wsdl has not been set' do
|
|
207
|
+
it 'returns a path to the WSDL to use for the API' do
|
|
208
|
+
expect(config.wsdl).to eq("https://webservices.netsuite.com/wsdl/v2025_2_0/netsuite.wsdl")
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
context 'when the wsdl has not been set, but sandbox is false' do
|
|
213
|
+
it 'should correctly return the full HTTP URL' do
|
|
214
|
+
config.sandbox false
|
|
215
|
+
expect(config.wsdl).to eql('https://webservices.netsuite.com/wsdl/v2025_2_0/netsuite.wsdl')
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
context 'when the wsdl domain has been set' do
|
|
220
|
+
it 'should correctly modify the full wsdl path' do
|
|
221
|
+
config.sandbox = false
|
|
222
|
+
config.wsdl_domain = 'system.na1.netsuite.com'
|
|
223
|
+
|
|
224
|
+
expect(config.wsdl).to eql('https://system.na1.netsuite.com/wsdl/v2025_2_0/netsuite.wsdl')
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
context '#cache_wsdl' do
|
|
229
|
+
it 'stores the client' do
|
|
230
|
+
expect(config.wsdl_cache).to be_empty
|
|
231
|
+
config.cache_wsdl("whatevs")
|
|
232
|
+
expect(config.wsdl_cache).to eq(
|
|
233
|
+
{config.wsdl => "whatevs"}
|
|
234
|
+
)
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
it 'doesnt write over old values' do
|
|
238
|
+
config.class_exec(config.api_version, config.wsdl) do |api, wsdl|
|
|
239
|
+
wsdl_cache[wsdl] = "old value"
|
|
240
|
+
end
|
|
241
|
+
config.cache_wsdl("new value")
|
|
242
|
+
|
|
243
|
+
expect(config.wsdl_cache.values.first).to eq("old value")
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
it 'handles a nil cache' do
|
|
247
|
+
config.class_eval { @wsdl_cache = nil }
|
|
248
|
+
config.cache_wsdl("whatevs")
|
|
249
|
+
expect(config.wsdl_cache).to eq(
|
|
250
|
+
{config.wsdl => "whatevs"}
|
|
251
|
+
)
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
it 'can cache multiple values' do
|
|
255
|
+
config.class_exec("2020_2", "fake wsdl") do |api, wsdl|
|
|
256
|
+
wsdl_cache[wsdl] = "old value"
|
|
257
|
+
end
|
|
258
|
+
expect(config.wsdl_cache.keys.count).to eq 1
|
|
259
|
+
config.cache_wsdl("new value")
|
|
260
|
+
|
|
261
|
+
expect(config.wsdl_cache.keys.count).to eq 2
|
|
262
|
+
end
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
context '#cached_wsdl' do
|
|
266
|
+
it 'returns wsdl (xml)' do
|
|
267
|
+
config.class_exec(config.api_version, config.wsdl) do |api, wsdl|
|
|
268
|
+
wsdl_cache[wsdl] = "xml wsdl string"
|
|
269
|
+
end
|
|
270
|
+
expect( config.cached_wsdl ).to eq "xml wsdl string"
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
it 'stores client xml' do
|
|
274
|
+
client = double(:savon_client)
|
|
275
|
+
allow(client).to receive(:is_a?).with(String).and_return(false)
|
|
276
|
+
allow(client).to receive(:is_a?).with(Savon::Client).and_return(true)
|
|
277
|
+
wsdl_dbl = double(:wsdl, xml: "xml wsdl")
|
|
278
|
+
client.instance_exec(wsdl_dbl) {|wsdl| @wsdl = wsdl }
|
|
279
|
+
config.class_exec(config.api_version, config.wsdl, client) do |api, wsdl, c|
|
|
280
|
+
wsdl_cache[wsdl] = c
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
expect( config.wsdl_cache.values.first ).to eq client
|
|
284
|
+
expect( config.cached_wsdl ).to eq "xml wsdl"
|
|
285
|
+
expect( config.wsdl_cache.values.first ).to eq "xml wsdl"
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
it 'handles a nil cache' do
|
|
289
|
+
config.class_eval { @wsdl_cache = nil }
|
|
290
|
+
expect( config.cached_wsdl ).to eq nil
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
it 'handles an empty cache' do
|
|
294
|
+
expect(config.wsdl_cache).to be_empty
|
|
295
|
+
expect( config.cached_wsdl ).to eq nil
|
|
296
|
+
end
|
|
297
|
+
end
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
describe '#endpoint' do
|
|
301
|
+
it 'can be set with endpoint=' do
|
|
302
|
+
config.endpoint = 42
|
|
303
|
+
expect(config.endpoint).to eq(42)
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
it 'can be set with just endpoint(value)' do
|
|
307
|
+
config.endpoint(42)
|
|
308
|
+
expect(config.endpoint).to eq(42)
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
it 'supports nil endpoints' do
|
|
312
|
+
config.endpoint = nil
|
|
313
|
+
expect(config.endpoint).to eq(nil)
|
|
314
|
+
end
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
describe '#auth_header' do
|
|
318
|
+
context 'when doing user authentication' do
|
|
319
|
+
before do
|
|
320
|
+
config.account = 1234
|
|
321
|
+
config.email = 'user@example.com'
|
|
322
|
+
config.password = 'myPassword'
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
it 'returns a hash representation of the authentication header' do
|
|
326
|
+
expect(config.auth_header).to eql({
|
|
327
|
+
'platformMsgs:passport' => {
|
|
328
|
+
'platformCore:account' => '1234',
|
|
329
|
+
'platformCore:email' => 'user@example.com',
|
|
330
|
+
'platformCore:password' => 'myPassword',
|
|
331
|
+
'platformCore:role' => { :@internalId => '3' },
|
|
332
|
+
}
|
|
333
|
+
})
|
|
334
|
+
end
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
context 'when doing token authentication' do
|
|
338
|
+
before do
|
|
339
|
+
config.account = 1234
|
|
340
|
+
config.consumer_key = 'consumer_key'
|
|
341
|
+
config.consumer_secret = 'consumer_secret'
|
|
342
|
+
config.token_id = 'token_id'
|
|
343
|
+
config.token_secret = 'token_secret'
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
it 'returns tokenPassport object' do
|
|
347
|
+
expect(config.auth_header.has_key?('platformMsgs:tokenPassport')).to be_truthy
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
it 'returns proper elements of tokenPassport' do
|
|
351
|
+
expect(config.auth_header['platformMsgs:tokenPassport']['platformCore:account']).to eql('1234')
|
|
352
|
+
expect(config.auth_header['platformMsgs:tokenPassport']['platformCore:consumerKey']).to eql('consumer_key')
|
|
353
|
+
expect(config.auth_header['platformMsgs:tokenPassport']['platformCore:token']).to eql('token_id')
|
|
354
|
+
expect(config.auth_header['platformMsgs:tokenPassport'][:attributes!]).to eql({ 'platformCore:signature' => { 'algorithm' => 'HMAC-SHA256' } })
|
|
355
|
+
|
|
356
|
+
expect(config.auth_header['platformMsgs:tokenPassport'].has_key?('platformCore:nonce')).to be_truthy
|
|
357
|
+
expect(config.auth_header['platformMsgs:tokenPassport'].has_key?('platformCore:timestamp')).to be_truthy
|
|
358
|
+
expect(config.auth_header['platformMsgs:tokenPassport'].has_key?('platformCore:signature')).to be_truthy
|
|
359
|
+
end
|
|
360
|
+
end
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
describe '#soap_header' do
|
|
364
|
+
before do
|
|
365
|
+
config.email = 'user@example.com'
|
|
366
|
+
config.password = 'myPassword'
|
|
367
|
+
config.account = 1234
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
it 'adds a new header to the soap header' do
|
|
371
|
+
config.soap_header = {
|
|
372
|
+
'platformMsgs:preferences' => {
|
|
373
|
+
'platformMsgs:ignoreReadOnlyFields' => true,
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
expect(config.soap_header).to eql({
|
|
377
|
+
'platformMsgs:preferences' => {
|
|
378
|
+
'platformMsgs:ignoreReadOnlyFields' => true,
|
|
379
|
+
}
|
|
380
|
+
})
|
|
381
|
+
end
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
describe '#email' do
|
|
385
|
+
context 'when the email has been set' do
|
|
386
|
+
before do
|
|
387
|
+
config.email = 'test@example.com'
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
it 'returns the email' do
|
|
391
|
+
expect(config.email).to eql('test@example.com')
|
|
392
|
+
end
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
context 'when the email has not been set' do
|
|
396
|
+
it 'raises a ConfigurationError' do
|
|
397
|
+
expect(config.email).to be_nil
|
|
398
|
+
end
|
|
399
|
+
end
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
describe '#password' do
|
|
403
|
+
context 'when the password has been set' do
|
|
404
|
+
before do
|
|
405
|
+
config.password = 'password'
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
it 'returns the password' do
|
|
409
|
+
expect(config.password).to eql('password')
|
|
410
|
+
end
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
context 'when the password has not been set' do
|
|
414
|
+
it 'raises a ConfigurationError' do
|
|
415
|
+
expect(config.password).to be_nil
|
|
416
|
+
end
|
|
417
|
+
end
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
describe '#account' do
|
|
421
|
+
context 'when the account has been set' do
|
|
422
|
+
before do
|
|
423
|
+
config.account = 4321
|
|
424
|
+
end
|
|
425
|
+
|
|
426
|
+
it 'returns the account' do
|
|
427
|
+
expect(config.account).to eql(4321)
|
|
428
|
+
end
|
|
429
|
+
end
|
|
430
|
+
|
|
431
|
+
context 'when the account has not been set' do
|
|
432
|
+
it 'raises a ConfigurationError' do
|
|
433
|
+
expect(config.account).to be_nil
|
|
434
|
+
end
|
|
435
|
+
end
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
describe '#role' do
|
|
440
|
+
context 'when no role is defined' do
|
|
441
|
+
it 'defaults to "3"' do
|
|
442
|
+
expect(config.role).to eq("3")
|
|
443
|
+
end
|
|
444
|
+
end
|
|
445
|
+
end
|
|
446
|
+
|
|
447
|
+
describe '#role=' do
|
|
448
|
+
it 'sets the role according to the input value' do
|
|
449
|
+
config.role = "6"
|
|
450
|
+
expect(config.role).to eq("6")
|
|
451
|
+
end
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
describe '#api_version' do
|
|
455
|
+
context 'when no api_version is defined' do
|
|
456
|
+
before { config.reset! }
|
|
457
|
+
|
|
458
|
+
it 'raises a ConfigurationError' do
|
|
459
|
+
expect { config.api_version }.to raise_error(NetSuite::ConfigurationError, /api_version is not set/)
|
|
460
|
+
end
|
|
461
|
+
end
|
|
462
|
+
|
|
463
|
+
context 'when api_version is set' do
|
|
464
|
+
it 'returns the configured version' do
|
|
465
|
+
expect(config.api_version).to eq('2025_2')
|
|
466
|
+
end
|
|
467
|
+
end
|
|
468
|
+
end
|
|
469
|
+
|
|
470
|
+
describe '#api_version=' do
|
|
471
|
+
context 'when api version is valid' do
|
|
472
|
+
it 'sets the api_version and regenerates the wsdl url' do
|
|
473
|
+
# retrieve wsdl to ensure setting the api works when the wsdl is cached
|
|
474
|
+
config.wsdl
|
|
475
|
+
config.api_version = '2025_2'
|
|
476
|
+
|
|
477
|
+
expect(config.api_version).to eq('2025_2')
|
|
478
|
+
expect(config.wsdl).to include('2025_2')
|
|
479
|
+
end
|
|
480
|
+
end
|
|
481
|
+
|
|
482
|
+
context 'when api version is invalid' do
|
|
483
|
+
it 'raises a ConfigurationError' do
|
|
484
|
+
expect { config.api_version = '1980_1' }.to raise_error(
|
|
485
|
+
NetSuite::ConfigurationError, /api_version must be/
|
|
486
|
+
)
|
|
487
|
+
end
|
|
488
|
+
end
|
|
489
|
+
end
|
|
490
|
+
|
|
491
|
+
describe "#credentials" do
|
|
492
|
+
context "when none are defined" do
|
|
493
|
+
end
|
|
494
|
+
|
|
495
|
+
context "when they are defined" do
|
|
496
|
+
end
|
|
497
|
+
end
|
|
498
|
+
|
|
499
|
+
it '#silent' do
|
|
500
|
+
config.silent = false
|
|
501
|
+
expect(config.silent).to eq(false)
|
|
502
|
+
|
|
503
|
+
config.silent = true
|
|
504
|
+
expect(config.silent).to eq(true)
|
|
505
|
+
end
|
|
506
|
+
|
|
507
|
+
it '#wsdl_domain' do
|
|
508
|
+
# NOTE wsdl is tested since it uses wsdl_domain
|
|
509
|
+
expect(config.wsdl_domain).to eq('webservices.netsuite.com')
|
|
510
|
+
|
|
511
|
+
config.wsdl_domain('custom.domain.com')
|
|
512
|
+
expect(config.wsdl_domain).to eq('custom.domain.com')
|
|
513
|
+
expect(config.wsdl).to include('custom.domain.com')
|
|
514
|
+
|
|
515
|
+
config.sandbox = true
|
|
516
|
+
expect(config.wsdl_domain).to eq('webservices.sandbox.netsuite.com')
|
|
517
|
+
expect(config.wsdl).to include('webservices.sandbox.netsuite.com')
|
|
518
|
+
end
|
|
519
|
+
|
|
520
|
+
describe '#logger=' do
|
|
521
|
+
let(:logger) { Logger.new(nil) }
|
|
522
|
+
|
|
523
|
+
before do
|
|
524
|
+
config.logger = logger
|
|
525
|
+
end
|
|
526
|
+
|
|
527
|
+
it 'sets logger' do
|
|
528
|
+
expect(config.logger).to eql(logger)
|
|
529
|
+
end
|
|
530
|
+
end
|
|
531
|
+
|
|
532
|
+
describe "#log" do
|
|
533
|
+
it 'allows a file path to be set as the log destination' do
|
|
534
|
+
file_path = Tempfile.new('tmplog').path
|
|
535
|
+
config.log = file_path
|
|
536
|
+
config.logger.info "foo"
|
|
537
|
+
|
|
538
|
+
log_contents = File.read(file_path)
|
|
539
|
+
expect(log_contents).to include("foo")
|
|
540
|
+
end
|
|
541
|
+
|
|
542
|
+
it 'allows an IO device to bet set as the log destination' do
|
|
543
|
+
stream = StringIO.new
|
|
544
|
+
config.log = stream
|
|
545
|
+
config.logger.info "foo"
|
|
546
|
+
|
|
547
|
+
expect(stream.string).to include("foo")
|
|
548
|
+
end
|
|
549
|
+
end
|
|
550
|
+
|
|
551
|
+
describe '#log_level' do
|
|
552
|
+
it 'defaults to :debug' do
|
|
553
|
+
expect(config.log_level).to eq(:debug)
|
|
554
|
+
end
|
|
555
|
+
|
|
556
|
+
it 'can be initially set to any log level' do
|
|
557
|
+
config.log_level(:info)
|
|
558
|
+
|
|
559
|
+
expect(config.log_level).to eq(:info)
|
|
560
|
+
end
|
|
561
|
+
|
|
562
|
+
it 'can override itself' do
|
|
563
|
+
config.log_level = :info
|
|
564
|
+
|
|
565
|
+
expect(config.log_level).to eq(:info)
|
|
566
|
+
|
|
567
|
+
config.log_level(:debug)
|
|
568
|
+
|
|
569
|
+
expect(config.log_level).to eq(:debug)
|
|
570
|
+
end
|
|
571
|
+
end
|
|
572
|
+
|
|
573
|
+
describe '#log_level=' do
|
|
574
|
+
it 'can set the initial log_level' do
|
|
575
|
+
config.log_level = :info
|
|
576
|
+
|
|
577
|
+
expect(config.log_level).to eq(:info)
|
|
578
|
+
end
|
|
579
|
+
|
|
580
|
+
it 'can override a previously set log level' do
|
|
581
|
+
config.log_level = :info
|
|
582
|
+
|
|
583
|
+
expect(config.log_level).to eq(:info)
|
|
584
|
+
|
|
585
|
+
config.log_level = :debug
|
|
586
|
+
|
|
587
|
+
expect(config.log_level).to eq(:debug)
|
|
588
|
+
end
|
|
589
|
+
end
|
|
590
|
+
|
|
591
|
+
describe 'timeouts' do
|
|
592
|
+
context "when savon is on a recent version" do
|
|
593
|
+
before { stub_const "Savon::VERSION", "2.13.0" }
|
|
594
|
+
|
|
595
|
+
it 'has defaults' do
|
|
596
|
+
expect(config.read_timeout).to eql(60)
|
|
597
|
+
expect(config.open_timeout).to be_nil
|
|
598
|
+
expect(config.write_timeout).to be_nil
|
|
599
|
+
end
|
|
600
|
+
|
|
601
|
+
it 'sets timeouts' do
|
|
602
|
+
config.read_timeout = 100
|
|
603
|
+
config.open_timeout = 60
|
|
604
|
+
config.write_timeout = 14
|
|
605
|
+
|
|
606
|
+
expect(config.read_timeout).to eql(100)
|
|
607
|
+
expect(config.open_timeout).to eql(60)
|
|
608
|
+
expect(config.write_timeout).to eql(14)
|
|
609
|
+
end
|
|
610
|
+
end
|
|
611
|
+
|
|
612
|
+
context "when savon is on an older version" do
|
|
613
|
+
before { stub_const "Savon::VERSION", "2.12.1" }
|
|
614
|
+
|
|
615
|
+
it 'has defaults' do
|
|
616
|
+
expect(config.read_timeout).to eql(60)
|
|
617
|
+
expect(config.open_timeout).to be_nil
|
|
618
|
+
end
|
|
619
|
+
|
|
620
|
+
it 'sets timeouts' do
|
|
621
|
+
config.read_timeout = 100
|
|
622
|
+
config.open_timeout = 60
|
|
623
|
+
expect { config.write_timeout = 14 }.to raise_error(NetSuite::ConfigurationError, /doesn't support/)
|
|
624
|
+
expect { config.write_timeout(15) }.to raise_error(NetSuite::ConfigurationError, /doesn't support/)
|
|
625
|
+
|
|
626
|
+
expect(config.read_timeout).to eql(100)
|
|
627
|
+
expect(config.open_timeout).to eql(60)
|
|
628
|
+
end
|
|
629
|
+
end
|
|
630
|
+
end
|
|
631
|
+
|
|
632
|
+
describe '#proxy' do
|
|
633
|
+
it 'defaults to nil' do
|
|
634
|
+
expect(config.proxy).to be_nil
|
|
635
|
+
end
|
|
636
|
+
|
|
637
|
+
it 'does not pass in nil proxy to savon' do
|
|
638
|
+
connection = config.connection
|
|
639
|
+
|
|
640
|
+
expect(connection.globals.include?(:proxy)).to eql(false)
|
|
641
|
+
end
|
|
642
|
+
|
|
643
|
+
it 'can be set with proxy=' do
|
|
644
|
+
config.proxy = "https://my-proxy"
|
|
645
|
+
|
|
646
|
+
expect(config.proxy).to eql("https://my-proxy")
|
|
647
|
+
|
|
648
|
+
# ensure no exception is raised
|
|
649
|
+
connection = config.connection
|
|
650
|
+
|
|
651
|
+
expect(connection.globals.include?(:proxy)).to eql(true)
|
|
652
|
+
end
|
|
653
|
+
|
|
654
|
+
it 'can be set with proxy(value)' do
|
|
655
|
+
config.proxy("https://my-proxy")
|
|
656
|
+
|
|
657
|
+
expect(config.proxy).to eql("https://my-proxy")
|
|
658
|
+
end
|
|
659
|
+
end
|
|
660
|
+
|
|
661
|
+
end
|