Class: Netsuite::Client
- Inherits:
-
Object
- Object
- Netsuite::Client
- Defined in:
- lib/netsuite-rest-client.rb
Constant Summary collapse
- BASE_URL =
"https://rest.netsuite.com/app/site/hosting/restlet.nl"
Instance Attribute Summary collapse
-
#headers ⇒ Object
Returns the value of attribute headers.
Instance Method Summary collapse
- #get_saved_search(record_type, search_id) ⇒ Object
-
#initialize(account_id, login, password, role_id) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(account_id, login, password, role_id) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/netsuite-rest-client.rb', line 10 def initialize(account_id, login, password, role_id) super() auth_string = "NLAuth nlauth_account=#{account_id}," + "nlauth_email=#{login}," + "nlauth_signature=#{password}," + "nlauth_role=#{role_id}" @headers = { :authorization => auth_string, :content_type => "application/json", #:accept => "*/*" } #@cookies = "NS_VER=2011.2.0; JSESSIONID=fWXFT7PBHm8HvxR59DGbTTkk7CBkQlyb6fHTypQY41ZYzJyCDygQQvhXTLKpLvwPpkZk2TNvh0gy9pTLqtgxqW4tw1pGT7G1NGhckQZ01YqQTVS1GvZ32JycJczrGZQF!-93580996" @cookies = { "NS_VER" => "2011.2.0", #"JSESSIONID" => "tWp7T7JccNgQBwFwk0ymdQVpQK9nhtB1BHRr1HPGDHhn2TvnTJykpLkcQ44fyg7bJmjQxL2LzqMyX1PPS25n5z10GFlXTPKyh4FqGhTG7XFj4S2TQxsHVjLvJPsBQvhJ!-93580996" } end |
Instance Attribute Details
#headers ⇒ Object
Returns the value of attribute headers.
8 9 10 |
# File 'lib/netsuite-rest-client.rb', line 8 def headers @headers end |
Instance Method Details
#get_saved_search(record_type, search_id) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/netsuite-rest-client.rb', line 26 def get_saved_search(record_type, search_id) url = BASE_URL + "?script=10&deploy=1&record_type=#{record_type}&search_id=#{search_id}" params = { "script" => 10, "deploy" => 1, "record_type" => record_type, "search_id" => search_id, } $stderr.puts "Executing request via URL #{url} and headers #{@headers}" results_json = RestClient::Request.execute :method => :get, :url => url, :headers => @headers, :cookies => @cookies, :timeout => -1 JSON.parse(results_json) end |