netsuite 0.7.2 → 0.7.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.
- data/lib/netsuite.rb +1 -0
- data/lib/netsuite/records/return_authorization.rb +133 -0
- data/lib/netsuite/records/sales_order.rb +1 -1
- data/lib/netsuite/rest/utilities/request.rb +8 -3
- data/lib/netsuite/rest/utilities/roles.rb +27 -25
- data/lib/netsuite/utilities.rb +2 -1
- data/lib/netsuite/version.rb +1 -1
- data/spec/netsuite/records/basic_record_spec.rb +1 -0
- data/spec/netsuite/utilities/roles_spec.rb +82 -35
- metadata +3 -2
    
        data/lib/netsuite.rb
    CHANGED
    
    | @@ -196,6 +196,7 @@ module NetSuite | |
| 196 196 | 
             
                autoload :RevRecTemplate,                   'netsuite/records/rev_rec_template'
         | 
| 197 197 | 
             
                autoload :RevRecSchedule,                   'netsuite/records/rev_rec_schedule'
         | 
| 198 198 | 
             
                autoload :RoleList,                         'netsuite/records/role_list'
         | 
| 199 | 
            +
                autoload :ReturnAuthorization,              'netsuite/records/return_authorization'
         | 
| 199 200 | 
             
                autoload :SalesOrder,                       'netsuite/records/sales_order'
         | 
| 200 201 | 
             
                autoload :SalesOrderItem,                   'netsuite/records/sales_order_item'
         | 
| 201 202 | 
             
                autoload :SalesOrderItemList,               'netsuite/records/sales_order_item_list'
         | 
| @@ -0,0 +1,133 @@ | |
| 1 | 
            +
            module NetSuite
         | 
| 2 | 
            +
              module Records
         | 
| 3 | 
            +
                class ReturnAuthorization
         | 
| 4 | 
            +
                  include Support::Fields
         | 
| 5 | 
            +
                  include Support::RecordRefs
         | 
| 6 | 
            +
                  include Support::Records
         | 
| 7 | 
            +
                  include Support::Actions
         | 
| 8 | 
            +
                  include Namespaces::TranSales
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                  # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2015_2/schema/record/returnauthorization.html
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                  actions :get, :get_list, :initialize, :add, :update, :delete, :upsert, :search
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                  fields :alt_sales_total,
         | 
| 15 | 
            +
                    :cc_approved,
         | 
| 16 | 
            +
                    :cc_expire_date,
         | 
| 17 | 
            +
                    :cc_name,
         | 
| 18 | 
            +
                    :cc_number,
         | 
| 19 | 
            +
                    :cc_street,
         | 
| 20 | 
            +
                    :cc_zip_code,
         | 
| 21 | 
            +
                    :contrib_pct,
         | 
| 22 | 
            +
                    :created_date,
         | 
| 23 | 
            +
                    :currency_name,
         | 
| 24 | 
            +
                    :debit_card_issue_no,
         | 
| 25 | 
            +
                    :deferred_revenue,
         | 
| 26 | 
            +
                    :discount_rate,
         | 
| 27 | 
            +
                    :discount_total,
         | 
| 28 | 
            +
                    :email,
         | 
| 29 | 
            +
                    :est_gross_profit,
         | 
| 30 | 
            +
                    :est_gross_profit_percent,
         | 
| 31 | 
            +
                    :exchange_rate,
         | 
| 32 | 
            +
                    :exclude_commission,
         | 
| 33 | 
            +
                    :fax,
         | 
| 34 | 
            +
                    :gift_cert_applied,
         | 
| 35 | 
            +
                    :gift_cert_available,
         | 
| 36 | 
            +
                    :gift_cert_total,
         | 
| 37 | 
            +
                    :is_taxable,
         | 
| 38 | 
            +
                    :job,
         | 
| 39 | 
            +
                    :last_modified_date,
         | 
| 40 | 
            +
                    :memo,
         | 
| 41 | 
            +
                    :message,
         | 
| 42 | 
            +
                    :other_ref_num,
         | 
| 43 | 
            +
                    :pay_pal_auth_id,
         | 
| 44 | 
            +
                    :pay_pal_process,
         | 
| 45 | 
            +
                    :pn_ref_num,
         | 
| 46 | 
            +
                    :recognized_revenue,
         | 
| 47 | 
            +
                    :rev_rec_end_date,
         | 
| 48 | 
            +
                    :rev_rec_on_rev_commitment,
         | 
| 49 | 
            +
                    :rev_rec_start_date,
         | 
| 50 | 
            +
                    :sales_effective_date,
         | 
| 51 | 
            +
                    :ship_address,
         | 
| 52 | 
            +
                    :source,
         | 
| 53 | 
            +
                    :status,
         | 
| 54 | 
            +
                    :sub_total,
         | 
| 55 | 
            +
                    :sync_partner_teams,
         | 
| 56 | 
            +
                    :sync_sales_teams,
         | 
| 57 | 
            +
                    :tax2_total,
         | 
| 58 | 
            +
                    :tax_rate,
         | 
| 59 | 
            +
                    :tax_total,
         | 
| 60 | 
            +
                    :to_be_emailed,
         | 
| 61 | 
            +
                    :to_be_faxed,
         | 
| 62 | 
            +
                    :to_be_printed,
         | 
| 63 | 
            +
                    :total,
         | 
| 64 | 
            +
                    :total_cost_estimate,
         | 
| 65 | 
            +
                    :tran_date,
         | 
| 66 | 
            +
                    :tran_id,
         | 
| 67 | 
            +
                    :tran_is_vsoe_bundle,
         | 
| 68 | 
            +
                    :valid_from,
         | 
| 69 | 
            +
                    :vat_reg_num,
         | 
| 70 | 
            +
                    :vsoe_auto_calc
         | 
| 71 | 
            +
             | 
| 72 | 
            +
                  record_refs :klass,
         | 
| 73 | 
            +
                    :created_from,
         | 
| 74 | 
            +
                    :credit_card,
         | 
| 75 | 
            +
                    :credit_card_processor,
         | 
| 76 | 
            +
                    :currency,
         | 
| 77 | 
            +
                    :custom_form,
         | 
| 78 | 
            +
                    :department,
         | 
| 79 | 
            +
                    :discount_item,
         | 
| 80 | 
            +
                    :dr_account,
         | 
| 81 | 
            +
                    :entity,
         | 
| 82 | 
            +
                    :fx_account,
         | 
| 83 | 
            +
                    :gift_cert,
         | 
| 84 | 
            +
                    :interco_status,
         | 
| 85 | 
            +
                    :interco_transaction,
         | 
| 86 | 
            +
                    :lead_source,
         | 
| 87 | 
            +
                    :location,
         | 
| 88 | 
            +
                    :message_sel,
         | 
| 89 | 
            +
                    :order_status,
         | 
| 90 | 
            +
                    :partner,
         | 
| 91 | 
            +
                    :payment_method,
         | 
| 92 | 
            +
                    :promo_code,
         | 
| 93 | 
            +
                    :rev_commit_status,
         | 
| 94 | 
            +
                    :revenue_status,
         | 
| 95 | 
            +
                    :rev_rec_schedule,
         | 
| 96 | 
            +
                    :sales_group,
         | 
| 97 | 
            +
                    :sales_rep,
         | 
| 98 | 
            +
                    :subsidiary,
         | 
| 99 | 
            +
                    :tax_item
         | 
| 100 | 
            +
             | 
| 101 | 
            +
                  # :bill_address_list
         | 
| 102 | 
            +
                  # :item_list,
         | 
| 103 | 
            +
                  # :partners_list,
         | 
| 104 | 
            +
                  # :sales_team_list,
         | 
| 105 | 
            +
                  # :ship_address_list,
         | 
| 106 | 
            +
                  
         | 
| 107 | 
            +
                  field :billing_address,          Address
         | 
| 108 | 
            +
                  field :custom_field_list,        CustomFieldList
         | 
| 109 | 
            +
             | 
| 110 | 
            +
                  attr_reader   :internal_id
         | 
| 111 | 
            +
                  attr_accessor :external_id
         | 
| 112 | 
            +
             | 
| 113 | 
            +
                  def initialize(attributes = {})
         | 
| 114 | 
            +
                    @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
         | 
| 115 | 
            +
                    @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
         | 
| 116 | 
            +
                    initialize_from_attributes_hash(attributes)
         | 
| 117 | 
            +
                  end
         | 
| 118 | 
            +
             | 
| 119 | 
            +
                  def to_record
         | 
| 120 | 
            +
                    rec = super
         | 
| 121 | 
            +
                    if rec["#{record_namespace}:customFieldList"]
         | 
| 122 | 
            +
                      rec["#{record_namespace}:customFieldList!"] = rec.delete("#{record_namespace}:customFieldList")
         | 
| 123 | 
            +
                    end
         | 
| 124 | 
            +
                    rec
         | 
| 125 | 
            +
                  end
         | 
| 126 | 
            +
             | 
| 127 | 
            +
                  def self.search_class_name
         | 
| 128 | 
            +
                    "Transaction"
         | 
| 129 | 
            +
                  end
         | 
| 130 | 
            +
             | 
| 131 | 
            +
                end
         | 
| 132 | 
            +
              end
         | 
| 133 | 
            +
            end
         | 
| @@ -18,7 +18,7 @@ module NetSuite | |
| 18 18 | 
             
                    :start_date, :status, :sync_partner_teams, :sync_sales_teams, :tax2_total, :tax_rate, :to_be_emailed, :to_be_faxed,
         | 
| 19 19 | 
             
                    :to_be_printed, :total_cost_estimate, :tran_date, :tran_id, :tran_is_vsoe_bundle, :vat_reg_num,
         | 
| 20 20 | 
             
                    :linked_tracking_numbers, :vsoe_auto_calc, :quantity, :bill_city, :bill_state, :ship_city, :ship_state, :cost_estimate,
         | 
| 21 | 
            -
                    :amount, :is_ship_address
         | 
| 21 | 
            +
                    :amount, :is_ship_address, :auth_code
         | 
| 22 22 |  | 
| 23 23 | 
             
                  # NOTE API >= 2014_2 only
         | 
| 24 24 | 
             
                  field :shipping_address, Address
         | 
| @@ -7,7 +7,8 @@ module NetSuite | |
| 7 7 | 
             
                module Utilities
         | 
| 8 8 | 
             
                  class Request
         | 
| 9 9 |  | 
| 10 | 
            -
                     | 
| 10 | 
            +
                    PRODUCTION_API = "https://rest.netsuite.com/rest"
         | 
| 11 | 
            +
                    SANDBOX_API = "https://rest.sandbox.netsuite.com/rest"
         | 
| 11 12 | 
             
                    DEFAULT_TIMEOUT = 30
         | 
| 12 13 | 
             
                    USE_SSL = true
         | 
| 13 14 |  | 
| @@ -16,7 +17,8 @@ module NetSuite | |
| 16 17 | 
             
                      def get(options)
         | 
| 17 18 | 
             
                        email       = encode(options.fetch :email)
         | 
| 18 19 | 
             
                        signature   = encode(options.fetch :password)
         | 
| 19 | 
            -
                         | 
| 20 | 
            +
                        sandbox     = options.fetch(:sandbox, false)
         | 
| 21 | 
            +
                        uri         = determine_uri(options.fetch(:uri), sandbox)
         | 
| 20 22 | 
             
                        response    = make_request(:get, uri, email, signature)
         | 
| 21 23 | 
             
                        [response.code, JSON.parse(response.body)]
         | 
| 22 24 | 
             
                      end
         | 
| @@ -24,7 +26,6 @@ module NetSuite | |
| 24 26 | 
             
                      private
         | 
| 25 27 |  | 
| 26 28 | 
             
                      def make_request(method_name, uri, email, signature)
         | 
| 27 | 
            -
                        uri = URI(BASE_API + uri)
         | 
| 28 29 | 
             
                        klass = Module.const_get "Net::HTTP::#{method_name.to_s.capitalize}"
         | 
| 29 30 | 
             
                        method = klass.new(uri)
         | 
| 30 31 | 
             
                        method['AUTHORIZATION'] = auth_header(email, signature)
         | 
| @@ -39,6 +40,10 @@ module NetSuite | |
| 39 40 | 
             
                        "NLAuth nlauth_email=#{email},nlauth_signature=#{signature}"
         | 
| 40 41 | 
             
                      end
         | 
| 41 42 |  | 
| 43 | 
            +
                      def determine_uri(uri, sandbox)
         | 
| 44 | 
            +
                        URI((sandbox ? SANDBOX_API : PRODUCTION_API) + uri)
         | 
| 45 | 
            +
                      end
         | 
| 46 | 
            +
             | 
| 42 47 | 
             
                      def encode(unencoded_string)
         | 
| 43 48 | 
             
                        URI.escape(
         | 
| 44 49 | 
             
                          unencoded_string,
         | 
| @@ -5,37 +5,39 @@ module NetSuite | |
| 5 5 |  | 
| 6 6 | 
             
                    class << self
         | 
| 7 7 |  | 
| 8 | 
            -
                      def get( | 
| 9 | 
            -
                         | 
| 10 | 
            -
                          email: email,
         | 
| 11 | 
            -
                          password: password,
         | 
| 12 | 
            -
                           | 
| 8 | 
            +
                      def get(opts={})
         | 
| 9 | 
            +
                        status, body = Request.get(
         | 
| 10 | 
            +
                          email:    opts.fetch(:email, Configuration.email),
         | 
| 11 | 
            +
                          password: opts.fetch(:password, Configuration.password),
         | 
| 12 | 
            +
                          sandbox:  opts.fetch(:sandbox, Configuration.sandbox),
         | 
| 13 | 
            +
                          uri:      '/roles',
         | 
| 13 14 | 
             
                        )
         | 
| 14 | 
            -
                         | 
| 15 | 
            +
                        status == "200" ? format_response(body) : body
         | 
| 15 16 | 
             
                      end
         | 
| 16 17 |  | 
| 17 18 | 
             
                      private
         | 
| 18 19 |  | 
| 19 20 | 
             
                      def format_response(parsed)
         | 
| 20 | 
            -
                         | 
| 21 | 
            -
             | 
| 22 | 
            -
                         | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 21 | 
            +
                        uniq_accounts = parsed.map {|hash| hash["account"] }.uniq
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                        uniq_accounts.map do |hash|
         | 
| 24 | 
            +
                          matches = parsed.select {|x| x["account"]["internalId"] == hash["internalId"]}
         | 
| 25 | 
            +
                          {
         | 
| 26 | 
            +
                            account_id:    hash["internalId"],
         | 
| 27 | 
            +
                            account_name:  hash["name"],
         | 
| 28 | 
            +
                            roles: matches.map do |match|
         | 
| 29 | 
            +
                              {
         | 
| 30 | 
            +
                                id:   match["role"]["internalId"],
         | 
| 31 | 
            +
                                name: match["role"]["name"]
         | 
| 32 | 
            +
                              }
         | 
| 33 | 
            +
                            end.uniq,
         | 
| 34 | 
            +
                            wsdls: {
         | 
| 35 | 
            +
                              webservices: matches.map {|match| match["dataCenterURLs"]["webservicesDomain"] }.uniq,
         | 
| 36 | 
            +
                              rest:        matches.map {|match| match["dataCenterURLs"]["restDomain"] }.uniq,
         | 
| 37 | 
            +
                              system:      matches.map {|match| match["dataCenterURLs"]["systemDomain"] }.uniq,
         | 
| 38 | 
            +
                            }
         | 
| 39 | 
            +
                          }
         | 
| 40 | 
            +
                        end
         | 
| 39 41 | 
             
                      end
         | 
| 40 42 |  | 
| 41 43 | 
             
                    end
         | 
    
        data/lib/netsuite/utilities.rb
    CHANGED
    
    | @@ -32,7 +32,8 @@ module NetSuite | |
| 32 32 | 
             
                    count += 1
         | 
| 33 33 | 
             
                    yield
         | 
| 34 34 | 
             
                  rescue options[:exception] || Savon::SOAPFault => e
         | 
| 35 | 
            -
                    if !e.message.include?("Only one request may be made against a session at a time")
         | 
| 35 | 
            +
                    if !e.message.include?("Only one request may be made against a session at a time") &&
         | 
| 36 | 
            +
                       !e.message.include?('java.util.ConcurrentModificationException')
         | 
| 36 37 | 
             
                      raise e
         | 
| 37 38 | 
             
                    end
         | 
| 38 39 | 
             
                    if count >= (options[:attempts] || 8)
         | 
    
        data/lib/netsuite/version.rb
    CHANGED
    
    
| @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 3 | 
             
            describe NetSuite::Rest::Utilities::Roles do
         | 
| 4 | 
            -
              subject { described_class }
         | 
| 5 4 |  | 
| 6 5 | 
             
              describe '#get' do
         | 
| 6 | 
            +
                subject { described_class }
         | 
| 7 7 | 
             
                it { is_expected.to respond_to :get }
         | 
| 8 8 |  | 
| 9 9 | 
             
                it 'invokes the request module' do
         | 
| 10 10 | 
             
                  expect( NetSuite::Rest::Utilities::Request ).to receive(:get)
         | 
| 11 | 
            -
                  subject.get('jimbob@netzero.com', 'pickles')
         | 
| 11 | 
            +
                  subject.get(email: 'jimbob@netzero.com', password: 'pickles')
         | 
| 12 12 | 
             
                end
         | 
| 13 13 |  | 
| 14 14 | 
             
                it 'formats the API response if successful' do
         | 
| @@ -16,7 +16,7 @@ describe NetSuite::Rest::Utilities::Roles do | |
| 16 16 | 
             
                    ["200", {parsed: :response}]
         | 
| 17 17 | 
             
                  )
         | 
| 18 18 | 
             
                  expect( subject ).to receive(:format_response).with({parsed: :response}).and_return nil
         | 
| 19 | 
            -
                  subject.get('jimbob@netzero.com', 'pickles')
         | 
| 19 | 
            +
                  subject.get(email: 'jimbob@netzero.com', password: 'pickles')
         | 
| 20 20 | 
             
                end
         | 
| 21 21 |  | 
| 22 22 | 
             
                it 'returns the full error message if unsuccessful' do
         | 
| @@ -24,11 +24,13 @@ describe NetSuite::Rest::Utilities::Roles do | |
| 24 24 | 
             
                    ["500", {oh: :no!}]
         | 
| 25 25 | 
             
                  )
         | 
| 26 26 | 
             
                  expect( subject ).to_not receive(:format_reponse)
         | 
| 27 | 
            -
                  expect( subject.get('jimbob@netzero.com', 'pickles') ).to eq({oh: :no!})
         | 
| 27 | 
            +
                  expect( subject.get(email: 'jimbob@netzero.com', password: 'pickles') ).to eq({oh: :no!})
         | 
| 28 28 | 
             
                end
         | 
| 29 29 | 
             
              end
         | 
| 30 30 |  | 
| 31 31 | 
             
              describe '#format_response' do
         | 
| 32 | 
            +
                subject { described_class.send(:format_response, parsed) }
         | 
| 33 | 
            +
             | 
| 32 34 | 
             
                let(:parsed) do
         | 
| 33 35 | 
             
                  [
         | 
| 34 36 | 
             
                    {
         | 
| @@ -36,61 +38,106 @@ describe NetSuite::Rest::Utilities::Roles do | |
| 36 38 | 
             
                        "internalId"=>"TSTDRV15",
         | 
| 37 39 | 
             
                        "name"=>"Honeycomb Mfg SDN (Leading)"},
         | 
| 38 40 | 
             
                      "role"=>{
         | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 41 | 
            +
                        "internalId"=>3,
         | 
| 42 | 
            +
                        "name"=>"Administrator"},
         | 
| 43 | 
            +
                      "dataCenterURLs"=>{
         | 
| 44 | 
            +
                        "webservicesDomain"=>"https://webservices.na1.netsuite.com",
         | 
| 45 | 
            +
                        "restDomain"=>"https://rest.na1.netsuite.com",
         | 
| 46 | 
            +
                        "systemDomain"=>"https://system.na1.netsuite.com"}
         | 
| 45 47 | 
             
                    },
         | 
| 46 48 | 
             
                    {
         | 
| 47 49 | 
             
                      "account"=>{
         | 
| 48 50 | 
             
                        "internalId"=>"TSTDRV15",
         | 
| 49 51 | 
             
                        "name"=>"Honeycomb Mfg SDN (Leading)"},
         | 
| 50 52 | 
             
                      "role"=>{
         | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 53 | 
            +
                        "internalId"=>1,
         | 
| 54 | 
            +
                        "name"=>"Accountant"},
         | 
| 55 | 
            +
                       "dataCenterURLs"=>{
         | 
| 56 | 
            +
                         "webservicesDomain"=>"https://webservices.na1.netsuite.com",
         | 
| 57 | 
            +
                         "restDomain"=>"https://rest.na1.netsuite.com",
         | 
| 58 | 
            +
                         "systemDomain"=>"https://system.na1.netsuite.com"}
         | 
| 57 59 | 
             
                    },
         | 
| 58 60 | 
             
                    {
         | 
| 59 61 | 
             
                      "account"=>{
         | 
| 60 62 | 
             
                        "internalId"=>"TSTDRV14",
         | 
| 61 63 | 
             
                        "name"=>"Honeycomb Mfg SDN (Leading)"},
         | 
| 62 64 | 
             
                      "role"=>{
         | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 65 | 
            +
                        "internalId"=>1,
         | 
| 66 | 
            +
                        "name"=>"Accountant"},
         | 
| 67 | 
            +
                      "dataCenterURLs"=>{
         | 
| 68 | 
            +
                        "webservicesDomain"=>"https://webservices.netsuite.com",
         | 
| 69 | 
            +
                        "restDomain"=>"https://rest.netsuite.com",
         | 
| 70 | 
            +
                        "systemDomain"=>"https://system.netsuite.com"}
         | 
| 69 71 | 
             
                    },
         | 
| 70 72 | 
             
                  ]
         | 
| 71 73 | 
             
                end
         | 
| 72 74 |  | 
| 73 | 
            -
                it ' | 
| 74 | 
            -
                  expect(
         | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 75 | 
            +
                it 'groups by uniq account ids' do
         | 
| 76 | 
            +
                  expect( subject.count ).to eq 2
         | 
| 77 | 
            +
                end
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                it 'returns the account name and id' do
         | 
| 80 | 
            +
                  expect( subject.first ).to be_a Hash
         | 
| 81 | 
            +
                  expect( subject.first[:account_id] ).to be_a String
         | 
| 82 | 
            +
                  expect( subject.first[:account_name] ).to be_a String
         | 
| 77 83 | 
             
                end
         | 
| 78 84 |  | 
| 79 | 
            -
                it ' | 
| 80 | 
            -
                  expect(
         | 
| 81 | 
            -
             | 
| 82 | 
            -
                  ).to  | 
| 85 | 
            +
                it 'returns the account roles' do
         | 
| 86 | 
            +
                  expect( subject.first[:roles] ).to be_an Array
         | 
| 87 | 
            +
                  expect( subject.first[:roles].first ).to be_a Hash
         | 
| 88 | 
            +
                  expect( subject.first[:roles].first[:id] ).to be_an Integer
         | 
| 89 | 
            +
                  expect( subject.first[:roles].first[:name] ).to be_a String
         | 
| 83 90 | 
             
                end
         | 
| 84 91 |  | 
| 85 | 
            -
                it ' | 
| 86 | 
            -
                  expect(
         | 
| 87 | 
            -
             | 
| 88 | 
            -
                  ).to  | 
| 92 | 
            +
                it 'returns the wsdls' do
         | 
| 93 | 
            +
                  expect( subject.first[:wsdls] ).to be_a Hash
         | 
| 94 | 
            +
                  expect( subject.first[:wsdls][:webservices] ).to be_an Array
         | 
| 95 | 
            +
                  expect( subject.first[:wsdls][:rest] ).to be_an Array
         | 
| 96 | 
            +
                  expect( subject.first[:wsdls][:system] ).to be_an Array
         | 
| 97 | 
            +
                end
         | 
| 98 | 
            +
             | 
| 99 | 
            +
                it 'parses correctly' do
         | 
| 100 | 
            +
                  expect(subject).to eq(
         | 
| 101 | 
            +
                    [
         | 
| 102 | 
            +
                      { account_id: 'TSTDRV15',
         | 
| 103 | 
            +
                        account_name: 'Honeycomb Mfg SDN (Leading)',
         | 
| 104 | 
            +
                        roles: [
         | 
| 105 | 
            +
                          {
         | 
| 106 | 
            +
                            id: 3,
         | 
| 107 | 
            +
                            name: 'Administrator'
         | 
| 108 | 
            +
                          },
         | 
| 109 | 
            +
                          {
         | 
| 110 | 
            +
                            id: 1,
         | 
| 111 | 
            +
                            name: 'Accountant'
         | 
| 112 | 
            +
                          }
         | 
| 113 | 
            +
                        ],
         | 
| 114 | 
            +
                        wsdls: {
         | 
| 115 | 
            +
                          webservices:  ["https://webservices.na1.netsuite.com"],
         | 
| 116 | 
            +
                          rest:         ["https://rest.na1.netsuite.com"],
         | 
| 117 | 
            +
                          system:       ["https://system.na1.netsuite.com"]
         | 
| 118 | 
            +
                        }
         | 
| 119 | 
            +
                      },
         | 
| 120 | 
            +
                      { account_id: 'TSTDRV14',
         | 
| 121 | 
            +
                        account_name: 'Honeycomb Mfg SDN (Leading)',
         | 
| 122 | 
            +
                        roles: [
         | 
| 123 | 
            +
                          {
         | 
| 124 | 
            +
                            id: 1,
         | 
| 125 | 
            +
                            name: 'Accountant'
         | 
| 126 | 
            +
                          }
         | 
| 127 | 
            +
                        ],
         | 
| 128 | 
            +
                        wsdls: {
         | 
| 129 | 
            +
                          webservices:  ["https://webservices.netsuite.com"],
         | 
| 130 | 
            +
                          rest:         ["https://rest.netsuite.com"],
         | 
| 131 | 
            +
                          system:       ["https://system.netsuite.com"]
         | 
| 132 | 
            +
                        }
         | 
| 133 | 
            +
                      }
         | 
| 134 | 
            +
                    ]
         | 
| 135 | 
            +
                  )
         | 
| 89 136 | 
             
                end
         | 
| 90 137 |  | 
| 91 138 | 
             
                it 'handles an empty response body' do
         | 
| 92 139 | 
             
                  expect{
         | 
| 93 | 
            -
                     | 
| 140 | 
            +
                    described_class.send(:format_response, [])
         | 
| 94 141 | 
             
                  }.to_not raise_error
         | 
| 95 142 | 
             
                end
         | 
| 96 143 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: netsuite
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.7. | 
| 4 | 
            +
              version: 0.7.3
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -10,7 +10,7 @@ authors: | |
| 10 10 | 
             
            autorequire: 
         | 
| 11 11 | 
             
            bindir: bin
         | 
| 12 12 | 
             
            cert_chain: []
         | 
| 13 | 
            -
            date: 2016- | 
| 13 | 
            +
            date: 2016-09-07 00:00:00.000000000 Z
         | 
| 14 14 | 
             
            dependencies:
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 16 16 | 
             
              name: savon
         | 
| @@ -228,6 +228,7 @@ files: | |
| 228 228 | 
             
            - lib/netsuite/records/purchase_order_item_list.rb
         | 
| 229 229 | 
             
            - lib/netsuite/records/record_ref.rb
         | 
| 230 230 | 
             
            - lib/netsuite/records/record_ref_list.rb
         | 
| 231 | 
            +
            - lib/netsuite/records/return_authorization.rb
         | 
| 231 232 | 
             
            - lib/netsuite/records/rev_rec_schedule.rb
         | 
| 232 233 | 
             
            - lib/netsuite/records/rev_rec_template.rb
         | 
| 233 234 | 
             
            - lib/netsuite/records/role_list.rb
         |