netsuite 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/netsuite.rb CHANGED
@@ -34,7 +34,6 @@ module NetSuite
34
34
  module Support
35
35
  autoload :Actions, 'netsuite/support/actions'
36
36
  autoload :Attributes, 'netsuite/support/attributes'
37
- autoload :Base, 'netsuite/support/base'
38
37
  autoload :Fields, 'netsuite/support/fields'
39
38
  autoload :Sublist, 'netsuite/support/sublist'
40
39
  autoload :RecordRefs, 'netsuite/support/record_refs'
@@ -1,7 +1,9 @@
1
1
  module NetSuite
2
2
  module Records
3
-
4
- class Bin < NetSuite::Support::Base
3
+
4
+ class Bin
5
+ include Support::Records
6
+ include Support::Fields
5
7
  include Support::RecordRefs
6
8
  include Support::Actions
7
9
  include Namespaces::ListAcct
@@ -16,7 +18,13 @@ module NetSuite
16
18
  fields :bin_number, :is_inactive, :location, :memo
17
19
 
18
20
  field :custom_field_list, NetSuite::Records::CustomFieldList
21
+
22
+ def initialize(attributes = {})
23
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
24
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
25
+ initialize_from_attributes_hash(attributes)
26
+ end
19
27
  end
20
28
 
21
29
  end
22
- end
30
+ end
@@ -1,6 +1,8 @@
1
1
  module NetSuite
2
2
  module Records
3
- class ContactAccessRoles < NetSuite::Support::Base
3
+ class ContactAccessRoles
4
+ include Support::Records
5
+ include Support::Fields
4
6
  include Support::RecordRefs
5
7
  include Namespaces::ListRel
6
8
 
@@ -9,6 +11,13 @@ module NetSuite
9
11
  fields :email, :give_access, :password, :password2, :send_email
10
12
 
11
13
  record_refs :contact, :role
14
+
15
+ def initialize(attributes = {})
16
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
17
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
18
+ initialize_from_attributes_hash(attributes)
19
+ end
20
+
12
21
  end
13
22
  end
14
23
  end
@@ -38,6 +38,14 @@ module NetSuite
38
38
  initialize_from_attributes_hash(attributes)
39
39
  end
40
40
 
41
+ def self.search_class_name
42
+ "Transaction"
43
+ end
44
+
45
+ def self.search_class_namespace
46
+ 'tranSales'
47
+ end
48
+
41
49
  end
42
50
  end
43
51
  end
@@ -13,4 +13,3 @@ module NetSuite
13
13
  end
14
14
  end
15
15
  end
16
- \
@@ -1,6 +1,8 @@
1
1
  module NetSuite
2
2
  module Records
3
- class CustomListCustomValue < Support::Base
3
+ class CustomListCustomValue
4
+ include Support::Records
5
+ include Support::Fields
4
6
  include Namespaces::SetupCustom
5
7
 
6
8
  # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/other/customlistcustomvalue.html?mode=package
@@ -9,6 +11,12 @@ module NetSuite
9
11
 
10
12
  # field valueLanguageValueList
11
13
 
14
+ def initialize(attributes = {})
15
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
16
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
17
+ initialize_from_attributes_hash(attributes)
18
+ end
19
+
12
20
  end
13
21
  end
14
- end
22
+ end
@@ -1,6 +1,8 @@
1
1
  module NetSuite
2
2
  module Records
3
- class Employee < Support::Base
3
+ class Employee
4
+ include Support::Records
5
+ include Support::Fields
4
6
  include Support::Actions
5
7
  include Support::RecordRefs
6
8
  include Namespaces::ListEmp
@@ -24,6 +26,12 @@ module NetSuite
24
26
  attr_reader :internal_id
25
27
  attr_accessor :external_id
26
28
 
29
+ def initialize(attributes = {})
30
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
31
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
32
+ initialize_from_attributes_hash(attributes)
33
+ end
34
+
27
35
  def self.search_class_name
28
36
  'Employee'
29
37
  end
@@ -1,6 +1,8 @@
1
1
  module NetSuite
2
2
  module Records
3
- class File < NetSuite::Support::Base
3
+ class File
4
+ include Support::Records
5
+ include Support::Fields
4
6
  include Support::RecordRefs
5
7
  include Support::Actions
6
8
  include Namespaces::FileCabinet
@@ -9,7 +11,7 @@ module NetSuite
9
11
 
10
12
  actions :get, :add, :delete, :search, :get_list
11
13
 
12
- fields :content, :description, :name, :media_type_name, :file_type, :text_file_encoding
14
+ fields :content, :description, :name, :media_type_name, :file_type, :text_file_encoding, :created_date, :last_modified_date
13
15
 
14
16
  record_refs :folder, :klass
15
17
 
@@ -17,7 +19,13 @@ module NetSuite
17
19
 
18
20
  attr_reader :internal_id
19
21
  attr_accessor :external_id
22
+
23
+ def initialize(attributes = {})
24
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
25
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
26
+ initialize_from_attributes_hash(attributes)
27
+ end
28
+
20
29
  end
21
30
  end
22
31
  end
23
-
@@ -3,6 +3,7 @@ module NetSuite
3
3
  class PaymentMethod
4
4
  include Support::Fields
5
5
  include Support::RecordRefs
6
+ include Support::Records
6
7
  include Support::Actions
7
8
  include Namespaces::ListAcct
8
9
 
@@ -1,10 +1,17 @@
1
1
  module NetSuite
2
2
  module Records
3
- class Roles < NetSuite::Support::Base
3
+ class Roles
4
+ include Support::Records
5
+ include Support::Fields
4
6
  include Support::RecordRefs
5
7
  include Namespaces::ListEmp
6
8
 
7
9
  record_refs :selected_role
10
+
11
+ def initialize(attributes = {})
12
+ initialize_from_attributes_hash(attributes)
13
+ end
14
+
8
15
  end
9
16
  end
10
17
  end
@@ -60,13 +60,6 @@ module NetSuite
60
60
  read_only_fields << name_sym
61
61
  field name
62
62
  end
63
-
64
- # a bit of trickery: this is for classes which inherit from other classes
65
- # i.e. the AssemblyItem, KitItem, etc; this copies the superclass's fields over
66
- def inherited(klass)
67
- klass.instance_variable_set("@fields", self.fields)
68
- klass.instance_variable_set("@read_only_fields", self.read_only_fields)
69
- end
70
63
  end
71
64
 
72
65
  end
@@ -3,6 +3,12 @@ module NetSuite
3
3
  class Sublist
4
4
  include Support::Fields
5
5
 
6
+ def self.inherited(subclass)
7
+ subclass.class_eval do
8
+ field :replace_all
9
+ end
10
+ end
11
+
6
12
  class << self
7
13
 
8
14
  def sublist(key, klass)
@@ -24,8 +30,6 @@ module NetSuite
24
30
 
25
31
  end
26
32
 
27
- field :replace_all
28
-
29
33
  def initialize(attributes = {})
30
34
  initialize_from_attributes_hash(attributes)
31
35
  end
@@ -1,3 +1,3 @@
1
1
  module Netsuite
2
- VERSION = '0.6.1'
2
+ VERSION = '0.6.2'
3
3
  end
@@ -24,6 +24,7 @@ describe 'basic records' do
24
24
  NetSuite::Records::TaxGroup,
25
25
  NetSuite::Records::Folder,
26
26
  NetSuite::Records::CustomerCategory,
27
+ NetSuite::Records::File,
27
28
  ]
28
29
  }
29
30
 
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.6.1
4
+ version: 0.6.2
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-05-06 00:00:00.000000000 Z
13
+ date: 2016-05-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: savon
@@ -245,7 +245,6 @@ files:
245
245
  - lib/netsuite/response.rb
246
246
  - lib/netsuite/support/actions.rb
247
247
  - lib/netsuite/support/attributes.rb
248
- - lib/netsuite/support/base.rb
249
248
  - lib/netsuite/support/country.rb
250
249
  - lib/netsuite/support/fields.rb
251
250
  - lib/netsuite/support/record_refs.rb
@@ -1,21 +0,0 @@
1
- # https://github.com/NetSweet/netsuite/pull/129#discussion_r19126261
2
-
3
- module NetSuite
4
- module Support
5
-
6
- class Base
7
- include Support::Records
8
- include Support::Fields
9
-
10
- def initialize(attributes = {})
11
- # not all records have external/internal ID
12
- # we extract them here, but it's up to the subclass to create the accessors
13
-
14
- @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
15
- @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
16
- initialize_from_attributes_hash(attributes)
17
- end
18
- end
19
-
20
- end
21
- end