Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Commit

Permalink
Add ability to speak to sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesChristie committed Oct 4, 2013
1 parent a312c0b commit b7bc39b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/netsuite-rest-client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
require 'uri'

module Netsuite

class Client

BASE_URL = "https://rest.netsuite.com/app/site/hosting/restlet.nl"
DEFAULT_SCRIPT_ID = 13
DEFAULT_DEPLOY_ID = 1
DEFAULT_GET_RECORD_BATCH_SIZE = 10000
Expand Down Expand Up @@ -41,6 +41,8 @@ def initialize(account_id, login, password, role_id, options={})
@search_batch_size = options[:search_batch_size] || DEFAULT_SEARCH_BATCH_SIZE

@retry_limit = options[:retry_limit] || DEFAULT_RETRY_LIMIT

@sandbox = options[:sandbox]
end

def initialize_record(record_type)
Expand Down Expand Up @@ -232,7 +234,7 @@ def stringify(data)
end

def create_url(params)
BASE_URL + '?' + params.map { |key, value| "#{key}=#{value}" }.join('&')
base_url + '?' + params.map { |key, value| "#{key}=#{value}" }.join('&')
end

def retryable(tries, exception, &block)
Expand All @@ -244,5 +246,15 @@ def retryable(tries, exception, &block)

yield
end

def base_url
if @sandbox
"https://rest.sandbox.netsuite.com/app/site/hosting/restlet.nl"
else
"https://rest.netsuite.com/app/site/hosting/restlet.nl"
end
end

end

end

0 comments on commit b7bc39b

Please sign in to comment.