netsuite_rails 0.2.2 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +4 -2
- data/README.md +186 -10
- data/circle.yml +3 -0
- data/lib/netsuite_rails/configuration.rb +7 -5
- data/lib/netsuite_rails/netsuite_rails.rb +24 -4
- data/lib/netsuite_rails/poll_trigger.rb +10 -9
- data/lib/netsuite_rails/record_sync/poll_manager.rb +23 -11
- data/lib/netsuite_rails/record_sync/pull_manager.rb +2 -0
- data/lib/netsuite_rails/record_sync/push_manager.rb +76 -38
- data/lib/netsuite_rails/record_sync.rb +28 -11
- data/lib/netsuite_rails/routines/company_contact_match.rb +98 -0
- data/lib/netsuite_rails/spec/disabler.rb +27 -0
- data/lib/netsuite_rails/spec/query_helpers.rb +93 -0
- data/lib/netsuite_rails/spec/spec_helper.rb +2 -79
- data/lib/netsuite_rails/sync_trigger.rb +40 -17
- data/lib/netsuite_rails/tasks/netsuite.rb +33 -4
- data/lib/netsuite_rails/transformations.rb +59 -19
- data/lib/netsuite_rails/url_helper.rb +45 -12
- data/netsuite_rails.gemspec +2 -2
- data/spec/models/configuration_spec.rb +11 -0
- data/spec/models/poll_manager_spec.rb +11 -2
- data/spec/models/poll_trigger_spec.rb +31 -11
- data/spec/models/record_sync/push_manager_spec.rb +51 -0
- data/spec/models/record_sync_spec.rb +16 -0
- data/spec/models/spec_helper_spec.rb +1 -2
- data/spec/models/transformations_spec.rb +62 -0
- data/spec/models/url_helper_spec.rb +20 -9
- data/spec/spec_helper.rb +19 -0
- data/spec/support/example_models.rb +33 -1
- metadata +19 -25
- data/.travis.yml +0 -3
- data/lib/netsuite_rails/netsuite_configure.rb +0 -14
- data/spec/support/netsuite_rails.rb +0 -1
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# https://circleci.com/docs/code-coverage
|
2
|
+
if ENV['CIRCLE_ARTIFACTS']
|
3
|
+
require 'simplecov'
|
4
|
+
dir = File.join("../../../..", ENV['CIRCLE_ARTIFACTS'], "coverage")
|
5
|
+
SimpleCov.coverage_dir(dir)
|
6
|
+
SimpleCov.start
|
7
|
+
end
|
8
|
+
|
1
9
|
require 'rails/all'
|
2
10
|
|
3
11
|
require 'shoulda/matchers'
|
@@ -10,6 +18,8 @@ require 'netsuite_rails'
|
|
10
18
|
Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each {|f| require f }
|
11
19
|
|
12
20
|
TestApplication::Application.initialize!
|
21
|
+
|
22
|
+
# TODO use DB cleaner instead
|
13
23
|
NetSuiteRails::PollTimestamp.delete_all
|
14
24
|
|
15
25
|
RSpec.configure do |config|
|
@@ -22,4 +32,13 @@ RSpec.configure do |config|
|
|
22
32
|
config.mock_with :rspec do |mocks|
|
23
33
|
mocks.verify_partial_doubles = true
|
24
34
|
end
|
35
|
+
|
36
|
+
config.before do
|
37
|
+
NetSuiteRails.configure do
|
38
|
+
reset!
|
39
|
+
netsuite_sync_mode :sync
|
40
|
+
end
|
41
|
+
|
42
|
+
NetSuite::Configuration.reset!
|
43
|
+
end
|
25
44
|
end
|
@@ -10,7 +10,26 @@ module ExampleModels
|
|
10
10
|
netsuite_record_class NetSuite::Records::Customer
|
11
11
|
netsuite_sync :read_write
|
12
12
|
netsuite_field_map({
|
13
|
-
:phone => :phone
|
13
|
+
:phone => :phone,
|
14
|
+
:company => Proc.new do |local, netsuite, direction|
|
15
|
+
if direction == :push
|
16
|
+
|
17
|
+
else
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
})
|
22
|
+
end
|
23
|
+
|
24
|
+
define_model :custom_record, netsuite_id: :integer, value: :string do
|
25
|
+
include NetSuiteRails::RecordSync
|
26
|
+
|
27
|
+
netsuite_record_class NetSuite::Records::CustomRecord, 123
|
28
|
+
netsuite_sync :read_write
|
29
|
+
netsuite_field_map({
|
30
|
+
:custom_field_list => {
|
31
|
+
:value => :custrecord_another_value
|
32
|
+
}
|
14
33
|
})
|
15
34
|
end
|
16
35
|
|
@@ -19,6 +38,19 @@ module ExampleModels
|
|
19
38
|
netsuite_list_id 86
|
20
39
|
end
|
21
40
|
|
41
|
+
define_model :external_id_record, netsuite_id: :integer, phone: :string do
|
42
|
+
include NetSuiteRails::RecordSync
|
43
|
+
|
44
|
+
netsuite_record_class NetSuite::Records::Customer
|
45
|
+
netsuite_sync :read_write
|
46
|
+
netsuite_field_map({
|
47
|
+
:phone => :phone
|
48
|
+
})
|
49
|
+
|
50
|
+
def netsuite_external_id
|
51
|
+
"phone-#{self.phone}"
|
52
|
+
end
|
53
|
+
end
|
22
54
|
end
|
23
55
|
|
24
56
|
after do
|
metadata
CHANGED
@@ -1,36 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netsuite_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Michael Bianco
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2016-02-11 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: netsuite
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ! '>'
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
19
|
+
version: 0.5.2
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ! '>'
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
26
|
+
version: 0.5.2
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rails
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: bundler
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rake
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ! '>='
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ! '>='
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -78,7 +69,6 @@ dependencies:
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: rspec
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ~>
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,7 +76,6 @@ dependencies:
|
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ~>
|
92
81
|
- !ruby/object:Gem::Version
|
@@ -99,18 +88,17 @@ extensions: []
|
|
99
88
|
extra_rdoc_files: []
|
100
89
|
files:
|
101
90
|
- .gitignore
|
102
|
-
- .travis.yml
|
103
91
|
- Gemfile
|
104
92
|
- LICENSE.txt
|
105
93
|
- README.md
|
106
94
|
- Rakefile
|
95
|
+
- circle.yml
|
107
96
|
- lib/generators/netsuite_rails/install_generator.rb
|
108
97
|
- lib/generators/netsuite_rails/templates/create_netsuite_poll_timestamps.rb
|
109
98
|
- lib/netsuite_rails.rb
|
110
99
|
- lib/netsuite_rails/configuration.rb
|
111
100
|
- lib/netsuite_rails/list_sync.rb
|
112
101
|
- lib/netsuite_rails/list_sync/poll_manager.rb
|
113
|
-
- lib/netsuite_rails/netsuite_configure.rb
|
114
102
|
- lib/netsuite_rails/netsuite_rails.rb
|
115
103
|
- lib/netsuite_rails/poll_timestamp.rb
|
116
104
|
- lib/netsuite_rails/poll_trigger.rb
|
@@ -118,6 +106,9 @@ files:
|
|
118
106
|
- lib/netsuite_rails/record_sync/poll_manager.rb
|
119
107
|
- lib/netsuite_rails/record_sync/pull_manager.rb
|
120
108
|
- lib/netsuite_rails/record_sync/push_manager.rb
|
109
|
+
- lib/netsuite_rails/routines/company_contact_match.rb
|
110
|
+
- lib/netsuite_rails/spec/disabler.rb
|
111
|
+
- lib/netsuite_rails/spec/query_helpers.rb
|
121
112
|
- lib/netsuite_rails/spec/spec_helper.rb
|
122
113
|
- lib/netsuite_rails/sub_list_sync.rb
|
123
114
|
- lib/netsuite_rails/sync_trigger.rb
|
@@ -125,55 +116,58 @@ files:
|
|
125
116
|
- lib/netsuite_rails/transformations.rb
|
126
117
|
- lib/netsuite_rails/url_helper.rb
|
127
118
|
- netsuite_rails.gemspec
|
119
|
+
- spec/models/configuration_spec.rb
|
128
120
|
- spec/models/poll_manager_spec.rb
|
129
121
|
- spec/models/poll_trigger_spec.rb
|
130
122
|
- spec/models/record_sync/push_manager_spec.rb
|
123
|
+
- spec/models/record_sync_spec.rb
|
131
124
|
- spec/models/spec_helper_spec.rb
|
132
125
|
- spec/models/sync_trigger_spec.rb
|
126
|
+
- spec/models/transformations_spec.rb
|
133
127
|
- spec/models/url_helper_spec.rb
|
134
128
|
- spec/spec_helper.rb
|
135
129
|
- spec/support/config/database.yml
|
136
130
|
- spec/support/dynamic_models/class_builder.rb
|
137
131
|
- spec/support/dynamic_models/model_builder.rb
|
138
132
|
- spec/support/example_models.rb
|
139
|
-
- spec/support/netsuite_rails.rb
|
140
133
|
- spec/support/test_application.rb
|
141
134
|
homepage: http://github.com/netsweet/netsuite_rails
|
142
135
|
licenses:
|
143
136
|
- MIT
|
137
|
+
metadata: {}
|
144
138
|
post_install_message:
|
145
139
|
rdoc_options: []
|
146
140
|
require_paths:
|
147
141
|
- lib
|
148
142
|
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
-
none: false
|
150
143
|
requirements:
|
151
144
|
- - ! '>='
|
152
145
|
- !ruby/object:Gem::Version
|
153
146
|
version: '0'
|
154
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
-
none: false
|
156
148
|
requirements:
|
157
149
|
- - ! '>='
|
158
150
|
- !ruby/object:Gem::Version
|
159
151
|
version: '0'
|
160
152
|
requirements: []
|
161
153
|
rubyforge_project:
|
162
|
-
rubygems_version:
|
154
|
+
rubygems_version: 2.4.6
|
163
155
|
signing_key:
|
164
|
-
specification_version:
|
156
|
+
specification_version: 4
|
165
157
|
summary: Write Rails applications that integrate with NetSuite
|
166
158
|
test_files:
|
159
|
+
- spec/models/configuration_spec.rb
|
167
160
|
- spec/models/poll_manager_spec.rb
|
168
161
|
- spec/models/poll_trigger_spec.rb
|
169
162
|
- spec/models/record_sync/push_manager_spec.rb
|
163
|
+
- spec/models/record_sync_spec.rb
|
170
164
|
- spec/models/spec_helper_spec.rb
|
171
165
|
- spec/models/sync_trigger_spec.rb
|
166
|
+
- spec/models/transformations_spec.rb
|
172
167
|
- spec/models/url_helper_spec.rb
|
173
168
|
- spec/spec_helper.rb
|
174
169
|
- spec/support/config/database.yml
|
175
170
|
- spec/support/dynamic_models/class_builder.rb
|
176
171
|
- spec/support/dynamic_models/model_builder.rb
|
177
172
|
- spec/support/example_models.rb
|
178
|
-
- spec/support/netsuite_rails.rb
|
179
173
|
- spec/support/test_application.rb
|
data/.travis.yml
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# opinionated configuration
|
2
|
-
|
3
|
-
NetSuite.configure do
|
4
|
-
reset!
|
5
|
-
|
6
|
-
email ENV['NETSUITE_EMAIL'] if ENV['NETSUITE_EMAIL'].present?
|
7
|
-
password ENV['NETSUITE_PASSWORD'] if ENV['NETSUITE_PASSWORD'].present?
|
8
|
-
account ENV['NETSUITE_ACCOUNT'] if ENV['NETSUITE_ACCOUNT'].present?
|
9
|
-
role ENV['NETSUITE_ROLE'] if ENV['NETSUITE_ROLE'].present?
|
10
|
-
api_version ENV['NETSUITE_API'] if ENV['NETSUITE_API'].present?
|
11
|
-
sandbox (ENV['NETSUITE_PRODUCTION'].blank? || ENV['NETSUITE_PRODUCTION'] != 'true')
|
12
|
-
|
13
|
-
read_timeout 100000
|
14
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
NetSuiteRails::Configuration.netsuite_sync_mode(:sync)
|