netsuite_client 0.0.2 → 1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,34 +2,24 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{netsuite_client}
5
- s.version = "0.0.2"
5
+ s.version = "1.0"
6
6
 
7
+ s.required_ruby_version = '~> 1.8.7'
7
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
9
  s.authors = ["Vlad Jebelev"]
9
- s.date = %q{2010-07-07}
10
+ s.date = %q{2011-11-25}
10
11
  s.description = %q{Ruby soap4r-based Netsuite client.}
11
12
  s.email = ["vlad@jebelev.com"]
12
- s.extra_rdoc_files = ["History.txt", "Manifest.txt"]
13
- s.files = ["History.txt", "Manifest.txt", "README.rdoc", "Rakefile", "TODO", "lib/netsuite_client.rb", "lib/netsuite_client/client.rb", "lib/netsuite_client/netsuite_exception.rb", "lib/netsuite_client/netsuite_result.rb", "lib/netsuite_client/soap_netsuite.rb", "lib/netsuite_client/string.rb", "netsuite_client.gemspec", "test/test_helper.rb", "test/test_netsuite_client.rb"]
13
+ s.rdoc_options += ['-m', 'README.rdoc', '-x', 'lib/netsuite_client/soap*.*', 'lib/netsuite_client/netsuite*', 'lib/netsuite_client/string.rb', 'lib/netsuite_client/client.rb', 'README.rdoc']
14
+ s.extra_rdoc_files = ["CHANGELOG", "Manifest.txt"]
15
+ s.files = ["CHANGELOG", "Manifest.txt", "README.rdoc", "Rakefile", "TODO", "netsuite_client.gemspec"] + Dir['lib/**/*.rb'] + Dir['test/*.rb']
14
16
  s.homepage = %q{http://rubygems.org/gems/netsuite_client}
15
- s.post_install_message = %q{PostInstall.txt}
16
- s.rdoc_options = ["--main", "README.rdoc"]
17
+ # s.post_install_message = %q{PostInstall.txt}
17
18
  s.require_paths = ["lib"]
18
19
  s.rubyforge_project = %q{netsuiteclient}
19
20
  s.rubygems_version = %q{1.3.7}
20
21
  s.summary = %q{Ruby soap4r-based Netsuite client.}
21
- s.test_files = ["test/test_netsuite_client.rb", "test/test_helper.rb"]
22
+ s.test_files = ["test/netsuite_client_test.rb", "test/test_helper.rb"]
22
23
 
23
- if s.respond_to? :specification_version then
24
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
25
- s.specification_version = 3
26
-
27
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
28
- s.add_development_dependency(%q<hoe>, [">= 2.3.3"])
29
- else
30
- s.add_dependency(%q<hoe>, [">= 2.3.3"])
31
- end
32
- else
33
- s.add_dependency(%q<hoe>, [">= 2.3.3"])
34
- end
24
+ s.add_dependency 'soap4r'
35
25
  end
@@ -0,0 +1,95 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class NetsuiteClientClient < Test::Unit::TestCase
4
+ include NetSuite::SOAP
5
+
6
+ def setup
7
+ ENV['NS_ENDPOINT_URL'] ||= NetSuite::SOAP::NetSuitePortType::DefaultEndpointUrl.sub(/webservices/, "webservices.sandbox")
8
+
9
+ unless ENV['NS_ACCOUNT_ID'] && ENV['NS_EMAIL'] && ENV['NS_PASSWORD']
10
+ puts "Ensure that all your environment variables are set: NS_ACCOUNT_ID, NS_EMAIL, NS_PASSWORD"
11
+ exit(-1)
12
+ end
13
+
14
+ @client = NetsuiteClient.new(:account_id => ENV['NS_ACCOUNT_ID'], :email => ENV['NS_EMAIL'], :password => ENV['NS_PASSWORD'], :endpoint_url => ENV['NS_ENDPOINT_URL'])
15
+ #@client.debug = true
16
+ end
17
+
18
+ def test_init
19
+ assert_not_nil @client
20
+ end
21
+
22
+ def test_find_by_internal_id
23
+ records = @client.find_by_internal_ids('TransactionSearchBasic', [1])
24
+ assert_equal [], records
25
+ end
26
+
27
+ def test_get
28
+ record = @client.get('RecordType::PaymentMethod', 1)
29
+ assert_not_nil record
30
+ assert_equal 1, record.xmlattr_internalId.to_i
31
+ assert_equal 'NetSuite::SOAP::PaymentMethod', record.class.to_s
32
+ end
33
+
34
+ def test_get_all
35
+ records = @client.get_all('GetAllRecordType::Currency')
36
+ assert records.any?
37
+ assert records.all? {|r| r.class.to_s == 'NetSuite::SOAP::Currency'}
38
+ end
39
+
40
+ # inventory item tests are currently disabled
41
+ # FIXME: 2011_2 requires cogs and asset accounts
42
+ # def test_add_inventory_item
43
+ # ref = InventoryItem.new
44
+ # ref.itemId = 'test inventory item'
45
+ # res = @client.add(ref)
46
+ # assert_not_nil res
47
+ # assert res.success? || res.error_code == 'DUP_ITEM'
48
+ # end
49
+
50
+
51
+ # FIXME
52
+ # def test_find_by_item_id
53
+ # test_add_inventory_item
54
+ # item = @client.find_by('ItemSearchBasic', 'itemId', 'test inventory item')
55
+ #
56
+ # assert_not_nil item
57
+ # assert_equal 'NetSuite::SOAP::RecordList', item.class.to_s
58
+ # assert_equal 1, item.size
59
+ # assert_equal 'NetSuite::SOAP::InventoryItem', item[0].class.to_s
60
+ # end
61
+
62
+ # FIXME
63
+ # def test_update_inventory_item
64
+ # test_add_inventory_item
65
+ # new_name = String.random_string
66
+ #
67
+ # item = @client.find_by('ItemSearchBasic', 'itemId', 'test inventory item')[0]
68
+ # assert item.displayName != new_name
69
+ #
70
+ # ref = InventoryItem.new
71
+ # ref.xmlattr_internalId = item.xmlattr_internalId
72
+ # ref.displayName = new_name
73
+ # res = @client.update(ref)
74
+ # assert_not_nil res
75
+ # assert res.success?
76
+ #
77
+ # item = @client.find_by('ItemSearchBasic', 'itemId', 'test inventory item')[0]
78
+ # assert item.displayName == new_name
79
+ # end
80
+
81
+ # FIXME
82
+ # def test_delete_inventory_item
83
+ # test_add_inventory_item
84
+ # item = @client.find_by('ItemSearchBasic', 'itemId', 'test inventory item')[0]
85
+ # assert_not_nil item
86
+ #
87
+ # ref = InventoryItem.new
88
+ # ref.xmlattr_internalId = item.xmlattr_internalId
89
+ # res = @client.delete(ref)
90
+ # assert_not_nil res
91
+ # assert res.success?
92
+ # assert_nil @client.find_by('ItemSearchBasic', 'itemId', 'test inventory item')[0]
93
+ # end
94
+
95
+ end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netsuite_client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease: false
4
+ hash: 15
5
+ prerelease:
6
6
  segments:
7
+ - 1
7
8
  - 0
8
- - 0
9
- - 2
10
- version: 0.0.2
9
+ version: "1.0"
11
10
  platform: ruby
12
11
  authors:
13
12
  - Vlad Jebelev
@@ -15,24 +14,22 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-07-07 00:00:00 -04:00
17
+ date: 2011-11-25 00:00:00 -05:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- name: hoe
21
+ name: soap4r
23
22
  prerelease: false
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 5
28
+ hash: 3
30
29
  segments:
31
- - 2
32
- - 3
33
- - 3
34
- version: 2.3.3
35
- type: :development
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
36
33
  version_requirements: *id001
37
34
  description: Ruby soap4r-based Netsuite client.
38
35
  email:
@@ -42,42 +39,52 @@ executables: []
42
39
  extensions: []
43
40
 
44
41
  extra_rdoc_files:
45
- - History.txt
42
+ - CHANGELOG
46
43
  - Manifest.txt
47
44
  files:
48
- - History.txt
45
+ - CHANGELOG
49
46
  - Manifest.txt
50
47
  - README.rdoc
51
48
  - Rakefile
52
49
  - TODO
53
- - lib/netsuite_client.rb
50
+ - netsuite_client.gemspec
54
51
  - lib/netsuite_client/client.rb
55
52
  - lib/netsuite_client/netsuite_exception.rb
56
53
  - lib/netsuite_client/netsuite_result.rb
57
- - lib/netsuite_client/soap_netsuite.rb
54
+ - lib/netsuite_client/soap_netsuite_2009_1.rb
55
+ - lib/netsuite_client/soap_netsuite_2011_1.rb
56
+ - lib/netsuite_client/soap_netsuite_2011_2.rb
58
57
  - lib/netsuite_client/string.rb
59
- - netsuite_client.gemspec
58
+ - lib/netsuite_client.rb
59
+ - test/netsuite_client_test.rb
60
60
  - test/test_helper.rb
61
- - test/test_netsuite_client.rb
62
61
  has_rdoc: true
63
62
  homepage: http://rubygems.org/gems/netsuite_client
64
63
  licenses: []
65
64
 
66
65
  post_install_message:
67
66
  rdoc_options:
68
- - --main
67
+ - -m
68
+ - README.rdoc
69
+ - -x
70
+ - lib/netsuite_client/soap*.*
71
+ - lib/netsuite_client/netsuite*
72
+ - lib/netsuite_client/string.rb
73
+ - lib/netsuite_client/client.rb
69
74
  - README.rdoc
70
75
  require_paths:
71
76
  - lib
72
77
  required_ruby_version: !ruby/object:Gem::Requirement
73
78
  none: false
74
79
  requirements:
75
- - - ">="
80
+ - - ~>
76
81
  - !ruby/object:Gem::Version
77
- hash: 3
82
+ hash: 57
78
83
  segments:
79
- - 0
80
- version: "0"
84
+ - 1
85
+ - 8
86
+ - 7
87
+ version: 1.8.7
81
88
  required_rubygems_version: !ruby/object:Gem::Requirement
82
89
  none: false
83
90
  requirements:
@@ -89,11 +96,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
96
  version: "0"
90
97
  requirements: []
91
98
 
92
- rubyforge_project: netsuite_client
93
- rubygems_version: 1.3.7
99
+ rubyforge_project: netsuiteclient
100
+ rubygems_version: 1.6.2
94
101
  signing_key:
95
102
  specification_version: 3
96
103
  summary: Ruby soap4r-based Netsuite client.
97
104
  test_files:
98
- - test/test_netsuite_client.rb
105
+ - test/netsuite_client_test.rb
99
106
  - test/test_helper.rb
data/History.txt DELETED
@@ -1,4 +0,0 @@
1
- === 0.0.1 2009-12-01
2
-
3
- * 1 major enhancement:
4
- * Initial release
@@ -1,88 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- class TestNetsuiteClient < Test::Unit::TestCase
4
- include NetSuite::SOAP
5
-
6
- def setup
7
- ENV['NS_ENDPOINT_URL'] ||= 'https://webservices.sandbox.netsuite.com/services/NetSuitePort_2009_1'
8
-
9
- unless ENV['NS_ACCOUNT_ID'] && ENV['NS_EMAIL'] && ENV['NS_PASSWORD']
10
- puts "Ensure that your environment variables are set: NS_ACCOUNT_ID, NS_EMAIL, NS_PASSWORD"
11
- exit(-1)
12
- end
13
-
14
- @client = NetsuiteClient.new(:account_id => ENV['NS_ACCOUNT_ID'], :email => ENV['NS_EMAIL'], :password => ENV['NS_PASSWORD'], :endpoint_url => ENV['NS_ENDPOINT_URL'])
15
- #@client.debug = true
16
- end
17
-
18
- def test_init
19
- assert_not_nil @client
20
- end
21
-
22
- def test_find_by_internal_id
23
- records = @client.find_by_internal_ids('TransactionSearchBasic', [1])
24
- assert_equal [], records
25
- end
26
-
27
- def test_get
28
- record = @client.get('RecordType::PaymentMethod', 1)
29
- assert_not_nil record
30
- assert_equal 1, record.xmlattr_internalId.to_i
31
- assert_equal 'NetSuite::SOAP::PaymentMethod', record.class.to_s
32
- end
33
-
34
- def test_get_all
35
- records = @client.get_all('RecordType::PaymentMethod')
36
- assert records.any?
37
- assert records.all? {|r| r.class.to_s == 'NetSuite::SOAP::PaymentMethod'}
38
- end
39
-
40
- def test_add_inventory_item
41
- ref = InventoryItem.new
42
- ref.itemId = 'test inventory item'
43
- res = @client.add(ref)
44
- assert_not_nil res
45
- assert res.success? || res.error_code == 'DUP_ITEM'
46
- end
47
-
48
- def test_find_by_item_id
49
- test_add_inventory_item
50
- item = @client.find_by('ItemSearchBasic', 'itemId', 'test inventory item')
51
-
52
- assert_not_nil item
53
- assert_equal 'NetSuite::SOAP::RecordList', item.class.to_s
54
- assert_equal 1, item.size
55
- assert_equal 'NetSuite::SOAP::InventoryItem', item[0].class.to_s
56
- end
57
-
58
- def test_update_inventory_item
59
- test_add_inventory_item
60
- new_name = String.random_string
61
-
62
- item = @client.find_by('ItemSearchBasic', 'itemId', 'test inventory item')[0]
63
- assert item.displayName != new_name
64
-
65
- ref = InventoryItem.new
66
- ref.xmlattr_internalId = item.xmlattr_internalId
67
- ref.displayName = new_name
68
- res = @client.update(ref)
69
- assert_not_nil res
70
- assert res.success?
71
-
72
- item = @client.find_by('ItemSearchBasic', 'itemId', 'test inventory item')[0]
73
- assert item.displayName == new_name
74
- end
75
-
76
- def test_delete_inventory_item
77
- test_add_inventory_item
78
- item = @client.find_by('ItemSearchBasic', 'itemId', 'test inventory item')[0]
79
- assert_not_nil item
80
-
81
- ref = InventoryItem.new
82
- ref.xmlattr_internalId = item.xmlattr_internalId
83
- res = @client.delete(ref)
84
- assert_not_nil res
85
- assert res.success?
86
- assert_nil @client.find_by('ItemSearchBasic', 'itemId', 'test inventory item')[0]
87
- end
88
- end