ns_connector 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. data/Gemfile +13 -0
  2. data/Gemfile.lock +80 -0
  3. data/Guardfile +9 -0
  4. data/HACKING +31 -0
  5. data/LICENSE.txt +7 -0
  6. data/README.rdoc +191 -0
  7. data/Rakefile +45 -0
  8. data/VERSION +1 -0
  9. data/lib/ns_connector.rb +4 -0
  10. data/lib/ns_connector/attaching.rb +42 -0
  11. data/lib/ns_connector/chunked_searching.rb +111 -0
  12. data/lib/ns_connector/config.rb +66 -0
  13. data/lib/ns_connector/errors.rb +79 -0
  14. data/lib/ns_connector/field_store.rb +19 -0
  15. data/lib/ns_connector/hash.rb +11 -0
  16. data/lib/ns_connector/resource.rb +288 -0
  17. data/lib/ns_connector/resources.rb +3 -0
  18. data/lib/ns_connector/resources/contact.rb +279 -0
  19. data/lib/ns_connector/resources/customer.rb +355 -0
  20. data/lib/ns_connector/resources/invoice.rb +466 -0
  21. data/lib/ns_connector/restlet.rb +137 -0
  22. data/lib/ns_connector/sublist.rb +21 -0
  23. data/lib/ns_connector/sublist_item.rb +25 -0
  24. data/misc/failed_sublist_saving_patch +547 -0
  25. data/scripts/run_restlet +25 -0
  26. data/scripts/test_shell +21 -0
  27. data/spec/attaching_spec.rb +48 -0
  28. data/spec/chunked_searching_spec.rb +75 -0
  29. data/spec/config_spec.rb +43 -0
  30. data/spec/resource_spec.rb +340 -0
  31. data/spec/resources/contact_spec.rb +8 -0
  32. data/spec/resources/customer_spec.rb +8 -0
  33. data/spec/resources/invoice_spec.rb +20 -0
  34. data/spec/restlet_spec.rb +135 -0
  35. data/spec/spec_helper.rb +16 -0
  36. data/spec/sublist_item_spec.rb +25 -0
  37. data/spec/sublist_spec.rb +45 -0
  38. data/spec/support/mock_data.rb +10 -0
  39. data/support/read_only_test +63 -0
  40. data/support/restlet.js +384 -0
  41. data/support/super_dangerous_write_test +85 -0
  42. metadata +221 -0
@@ -0,0 +1,3 @@
1
+ require 'ns_connector/resources/contact'
2
+ require 'ns_connector/resources/customer'
3
+ require 'ns_connector/resources/invoice'
@@ -0,0 +1,279 @@
1
+ require 'ns_connector/resource'
2
+
3
+ # == Contact resource
4
+ # === Fields
5
+ # * id
6
+ # * role
7
+ # * accessrole
8
+ # * accountnumber
9
+ # * altemail
10
+ # * altphone
11
+ # * autoname
12
+ # * balance
13
+ # * billaddr1
14
+ # * billaddr2
15
+ # * billaddr3
16
+ # * billcity
17
+ # * billcountry
18
+ # * billpay
19
+ # * billstate
20
+ # * billzip
21
+ # * buyingreason
22
+ # * buyingtimeframe
23
+ # * campaigncategory
24
+ # * category
25
+ # * clickstream
26
+ # * comments
27
+ # * companyname
28
+ # * consolbalance
29
+ # * consoldaysoverdue
30
+ # * consoldepositbalance
31
+ # * consoloverduebalance
32
+ # * consolunbilledorders
33
+ # * contact
34
+ # * creditholdoverride
35
+ # * creditlimit
36
+ # * currency
37
+ # * currencyprecision
38
+ # * customform
39
+ # * datecreated
40
+ # * daysoverdue
41
+ # * defaultaddress
42
+ # * defaultbankaccount
43
+ # * depositbalance
44
+ # * draccount
45
+ # * email
46
+ # * emailpreference
47
+ # * emailtransactions
48
+ # * enddate
49
+ # * entityid
50
+ # * entitystatus
51
+ # * estimatedbudget
52
+ # * externalid
53
+ # * fax
54
+ # * faxtransactions
55
+ # * firstname
56
+ # * firstvisit
57
+ # * fxaccount
58
+ # * giveaccess
59
+ # * globalsubscriptionstatus
60
+ # * homephone
61
+ # * image
62
+ # * isbudgetapproved
63
+ # * isinactive
64
+ # * isjob
65
+ # * isperson
66
+ # * keywords
67
+ # * language
68
+ # * lastmodifieddate
69
+ # * lastname
70
+ # * lastpagevisited
71
+ # * lastvisit
72
+ # * leadsource
73
+ # * middlename
74
+ # * mobilephone
75
+ # * monthlyclosing
76
+ # * negativenumberformat
77
+ # * numberformat
78
+ # * openingbalance
79
+ # * openingbalanceaccount
80
+ # * openingbalancedate
81
+ # * overduebalance
82
+ # * parent
83
+ # * partner
84
+ # * phone
85
+ # * phoneticname
86
+ # * prefccprocessor
87
+ # * pricelevel
88
+ # * printoncheckas
89
+ # * printtransactions
90
+ # * receivablesaccount
91
+ # * referrer
92
+ # * reminderdays
93
+ # * representingsubsidiary
94
+ # * resalenumber
95
+ # * salesgroup
96
+ # * salesreadiness
97
+ # * salesrep
98
+ # * salutation
99
+ # * sendemail
100
+ # * shipcomplete
101
+ # * shippingcarrier
102
+ # * shippingitem
103
+ # * stage
104
+ # * startdate
105
+ # * strength
106
+ # * subsidiary
107
+ # * syncpartnerteams
108
+ # * syncsalesteams
109
+ # * taxable
110
+ # * taxexempt
111
+ # * taxfractionunit
112
+ # * taxitem
113
+ # * taxrounding
114
+ # * terms
115
+ # * territory
116
+ # * thirdpartyacct
117
+ # * thirdpartycarrier
118
+ # * thirdpartycountry
119
+ # * thirdpartyzipcode
120
+ # * title
121
+ # * unbilledorders
122
+ # * unsubscribe
123
+ # * url
124
+ # * vatregnumber
125
+ # * visits
126
+ # * weblead
127
+ #
128
+ # === SubLists
129
+ # * addressbook
130
+ class NSConnector::Contact < NSConnector::Resource
131
+ @type_id = 'contact'
132
+ @fields = [
133
+ :id,
134
+ :role, # for join on customers
135
+ :accessrole,
136
+ :accountnumber,
137
+ :altemail,
138
+ :altphone,
139
+ :autoname,
140
+ :balance,
141
+ :billaddr1,
142
+ :billaddr2,
143
+ :billaddr3,
144
+ :billcity,
145
+ :billcountry,
146
+ :billpay,
147
+ :billstate,
148
+ :billzip,
149
+ :buyingreason,
150
+ :buyingtimeframe,
151
+ :campaigncategory,
152
+ :category,
153
+ :clickstream,
154
+ :comments,
155
+ :companyname,
156
+ :consolbalance,
157
+ :consoldaysoverdue,
158
+ :consoldepositbalance,
159
+ :consoloverduebalance,
160
+ :consolunbilledorders,
161
+ :contact,
162
+ :creditholdoverride,
163
+ :creditlimit,
164
+ :currency,
165
+ :currencyprecision,
166
+ :customform,
167
+ :datecreated,
168
+ :daysoverdue,
169
+ :defaultaddress,
170
+ :defaultbankaccount,
171
+ :depositbalance,
172
+ :draccount,
173
+ :email,
174
+ :emailpreference,
175
+ :emailtransactions,
176
+ :enddate,
177
+ :entityid,
178
+ :entitystatus,
179
+ :estimatedbudget,
180
+ :externalid,
181
+ :fax,
182
+ :faxtransactions,
183
+ :firstname,
184
+ :firstvisit,
185
+ :fxaccount,
186
+ :giveaccess,
187
+ :globalsubscriptionstatus,
188
+ :homephone,
189
+ :image,
190
+ :isbudgetapproved,
191
+ :isinactive,
192
+ :isjob,
193
+ :isperson,
194
+ :keywords,
195
+ :language,
196
+ :lastmodifieddate,
197
+ :lastname,
198
+ :lastpagevisited,
199
+ :lastvisit,
200
+ :leadsource,
201
+ :middlename,
202
+ :mobilephone,
203
+ :monthlyclosing,
204
+ :negativenumberformat,
205
+ :numberformat,
206
+ :openingbalance,
207
+ :openingbalanceaccount,
208
+ :openingbalancedate,
209
+ :overduebalance,
210
+ :parent,
211
+ :partner,
212
+ :phone,
213
+ :phoneticname,
214
+ :prefccprocessor,
215
+ :pricelevel,
216
+ :printoncheckas,
217
+ :printtransactions,
218
+ :receivablesaccount,
219
+ :referrer,
220
+ :reminderdays,
221
+ :representingsubsidiary,
222
+ :resalenumber,
223
+ :salesgroup,
224
+ :salesreadiness,
225
+ :salesrep,
226
+ :salutation,
227
+ :sendemail,
228
+ :shipcomplete,
229
+ :shippingcarrier,
230
+ :shippingitem,
231
+ :stage,
232
+ :startdate,
233
+ :strength,
234
+ :subsidiary,
235
+ :syncpartnerteams,
236
+ :syncsalesteams,
237
+ :taxable,
238
+ :taxexempt,
239
+ :taxfractionunit,
240
+ :taxitem,
241
+ :taxrounding,
242
+ :terms,
243
+ :territory,
244
+ :thirdpartyacct,
245
+ :thirdpartycarrier,
246
+ :thirdpartycountry,
247
+ :thirdpartyzipcode,
248
+ :title,
249
+ :unbilledorders,
250
+ :unsubscribe,
251
+ :url,
252
+ :vatregnumber,
253
+ :visits,
254
+ :weblead,
255
+ ]
256
+ @sublists = {
257
+ :addressbook => [
258
+ :addr1,
259
+ :addr2,
260
+ :addr3,
261
+ :addressee,
262
+ :addressid,
263
+ :addrtext,
264
+ :attention,
265
+ :city,
266
+ :country,
267
+ :defaultbilling,
268
+ :defaultshipping,
269
+ :displaystate,
270
+ :id,
271
+ :internalid,
272
+ :label,
273
+ :override,
274
+ :phone,
275
+ :state,
276
+ :zip,
277
+ ]
278
+ }
279
+ end
@@ -0,0 +1,355 @@
1
+ require 'ns_connector/resource'
2
+
3
+ # == Customer resource
4
+ # === Fields
5
+ # * id
6
+ # * accessrole
7
+ # * accountnumber
8
+ # * altemail
9
+ # * altphone
10
+ # * autoname
11
+ # * balance
12
+ # * billaddr1
13
+ # * billaddr2
14
+ # * billaddr3
15
+ # * billcity
16
+ # * billcountry
17
+ # * billpay
18
+ # * billstate
19
+ # * billzip
20
+ # * buyingreason
21
+ # * buyingtimeframe
22
+ # * campaigncategory
23
+ # * category
24
+ # * clickstream
25
+ # * comments
26
+ # * companyname
27
+ # * consolbalance
28
+ # * consoldaysoverdue
29
+ # * consoldepositbalance
30
+ # * consoloverduebalance
31
+ # * consolunbilledorders
32
+ # * contact
33
+ # * creditholdoverride
34
+ # * creditlimit
35
+ # * currency
36
+ # * currencyprecision
37
+ # * customform
38
+ # * datecreated
39
+ # * daysoverdue
40
+ # * defaultaddress
41
+ # * defaultbankaccount
42
+ # * depositbalance
43
+ # * draccount
44
+ # * email
45
+ # * emailpreference
46
+ # * emailtransactions
47
+ # * enddate
48
+ # * entityid
49
+ # * entitystatus
50
+ # * estimatedbudget
51
+ # * externalid
52
+ # * fax
53
+ # * faxtransactions
54
+ # * firstname
55
+ # * firstvisit
56
+ # * fxaccount
57
+ # * giveaccess
58
+ # * globalsubscriptionstatus
59
+ # * homephone
60
+ # * image
61
+ # * isbudgetapproved
62
+ # * isinactive
63
+ # * isjob
64
+ # * isperson
65
+ # * keywords
66
+ # * language
67
+ # * lastmodifieddate
68
+ # * lastname
69
+ # * lastpagevisited
70
+ # * lastvisit
71
+ # * leadsource
72
+ # * middlename
73
+ # * mobilephone
74
+ # * monthlyclosing
75
+ # * negativenumberformat
76
+ # * numberformat
77
+ # * openingbalance
78
+ # * openingbalanceaccount
79
+ # * openingbalancedate
80
+ # * overduebalance
81
+ # * parent
82
+ # * partner
83
+ # * phone
84
+ # * phoneticname
85
+ # * prefccprocessor
86
+ # * pricelevel
87
+ # * printoncheckas
88
+ # * printtransactions
89
+ # * receivablesaccount
90
+ # * referrer
91
+ # * reminderdays
92
+ # * representingsubsidiary
93
+ # * resalenumber
94
+ # * salesgroup
95
+ # * salesreadiness
96
+ # * salesrep
97
+ # * salutation
98
+ # * sendemail
99
+ # * shipcomplete
100
+ # * shippingcarrier
101
+ # * shippingitem
102
+ # * stage
103
+ # * startdate
104
+ # * strength
105
+ # * subsidiary
106
+ # * syncpartnerteams
107
+ # * syncsalesteams
108
+ # * taxable
109
+ # * taxexempt
110
+ # * taxfractionunit
111
+ # * taxitem
112
+ # * taxrounding
113
+ # * terms
114
+ # * territory
115
+ # * thirdpartyacct
116
+ # * thirdpartycarrier
117
+ # * thirdpartycountry
118
+ # * thirdpartyzipcode
119
+ # * title
120
+ # * unbilledorders
121
+ # * unsubscribe
122
+ # * url
123
+ # * vatregnumber
124
+ # * visits
125
+ # * weblead
126
+ # === Sublists
127
+ # * addressbook
128
+ # * contactroles
129
+ # * creditcards
130
+ # * currency
131
+ # * download
132
+ # * grouppricing
133
+ # * itempricing
134
+ # * partners
135
+ # * salesteam
136
+
137
+ class NSConnector::Customer < NSConnector::Resource
138
+ @type_id = 'customer'
139
+ @fields = [
140
+ :id,
141
+ :accessrole,
142
+ :accountnumber,
143
+ :altemail,
144
+ :altphone,
145
+ :autoname,
146
+ :balance,
147
+ :billaddr1,
148
+ :billaddr2,
149
+ :billaddr3,
150
+ :billcity,
151
+ :billcountry,
152
+ :billpay,
153
+ :billstate,
154
+ :billzip,
155
+ :buyingreason,
156
+ :buyingtimeframe,
157
+ :campaigncategory,
158
+ :category,
159
+ :clickstream,
160
+ :comments,
161
+ :companyname,
162
+ :consolbalance,
163
+ :consoldaysoverdue,
164
+ :consoldepositbalance,
165
+ :consoloverduebalance,
166
+ :consolunbilledorders,
167
+ :contact,
168
+ :creditholdoverride,
169
+ :creditlimit,
170
+ :currency,
171
+ :currencyprecision,
172
+ :customform,
173
+ :datecreated,
174
+ :daysoverdue,
175
+ :defaultaddress,
176
+ :defaultbankaccount,
177
+ :depositbalance,
178
+ :draccount,
179
+ :email,
180
+ :emailpreference,
181
+ :emailtransactions,
182
+ :enddate,
183
+ :entityid,
184
+ :entitystatus,
185
+ :estimatedbudget,
186
+ :externalid,
187
+ :fax,
188
+ :faxtransactions,
189
+ :firstname,
190
+ :firstvisit,
191
+ :fxaccount,
192
+ :giveaccess,
193
+ :globalsubscriptionstatus,
194
+ :homephone,
195
+ :image,
196
+ :isbudgetapproved,
197
+ :isinactive,
198
+ :isjob,
199
+ :isperson,
200
+ :keywords,
201
+ :language,
202
+ :lastmodifieddate,
203
+ :lastname,
204
+ :lastpagevisited,
205
+ :lastvisit,
206
+ :leadsource,
207
+ :middlename,
208
+ :mobilephone,
209
+ :monthlyclosing,
210
+ :negativenumberformat,
211
+ :numberformat,
212
+ :openingbalance,
213
+ :openingbalanceaccount,
214
+ :openingbalancedate,
215
+ :overduebalance,
216
+ :parent,
217
+ :partner,
218
+ :phone,
219
+ :phoneticname,
220
+ :prefccprocessor,
221
+ :pricelevel,
222
+ :printoncheckas,
223
+ :printtransactions,
224
+ :receivablesaccount,
225
+ :referrer,
226
+ :reminderdays,
227
+ :representingsubsidiary,
228
+ :resalenumber,
229
+ :salesgroup,
230
+ :salesreadiness,
231
+ :salesrep,
232
+ :salutation,
233
+ :sendemail,
234
+ :shipcomplete,
235
+ :shippingcarrier,
236
+ :shippingitem,
237
+ :stage,
238
+ :startdate,
239
+ :strength,
240
+ :subsidiary,
241
+ :syncpartnerteams,
242
+ :syncsalesteams,
243
+ :taxable,
244
+ :taxexempt,
245
+ :taxfractionunit,
246
+ :taxitem,
247
+ :taxrounding,
248
+ :terms,
249
+ :territory,
250
+ :thirdpartyacct,
251
+ :thirdpartycarrier,
252
+ :thirdpartycountry,
253
+ :thirdpartyzipcode,
254
+ :title,
255
+ :unbilledorders,
256
+ :unsubscribe,
257
+ :url,
258
+ :vatregnumber,
259
+ :visits,
260
+ :weblead,
261
+ ]
262
+ @sublists = {
263
+ :addressbook => [
264
+ :addr1,
265
+ :addr2,
266
+ :addr3,
267
+ :addressee,
268
+ :addressid,
269
+ :addrtext,
270
+ :attention,
271
+ :city,
272
+ :country,
273
+ :defaultbilling,
274
+ :defaultshipping,
275
+ :displaystate,
276
+ :id,
277
+ :internalid,
278
+ :isresidential,
279
+ :label,
280
+ :override,
281
+ :phone,
282
+ :state,
283
+ :zip,
284
+ ],
285
+ :contactroles => [
286
+ :contact,
287
+ :email,
288
+ :giveaccess,
289
+ :passwordconfirm,
290
+ :role,
291
+ :sendemail,
292
+ :strength,
293
+ ],
294
+ :creditcards => [
295
+ :ccdefault,
296
+ :ccexpiredate,
297
+ :ccmemo,
298
+ :ccname,
299
+ :ccnumber,
300
+ :customercode,
301
+ :debitcardissueno,
302
+ :internalid,
303
+ :paymentmethod,
304
+ :validfrom,
305
+ ],
306
+ :currency => [
307
+ :balance,
308
+ :consolbalance,
309
+ :consoldepositbalance,
310
+ :consoloverduebalance,
311
+ :consolunbilledorders,
312
+ :currency,
313
+ :currencyformatsample,
314
+ :depositbalance,
315
+ :displaysymbol,
316
+ :overduebalance,
317
+ :overridecurrencyformat,
318
+ :symbolplacement,
319
+ :unbilledorders,
320
+ ],
321
+ :download => [
322
+ :expiration,
323
+ :file,
324
+ :licensecode,
325
+ :remainingdownloads,
326
+ ],
327
+ :grouppricing => [
328
+ :group,
329
+ :level
330
+ ],
331
+ :itempricing => [
332
+ :currency,
333
+ :item,
334
+ :level,
335
+ :price,
336
+ ],
337
+ :partners => [
338
+ :contribution,
339
+ :customer,
340
+ :id,
341
+ :isprimary,
342
+ :partner,
343
+ :partnerrole,
344
+ ],
345
+ :salesteam => [
346
+ :contribution,
347
+ :customer,
348
+ :employee,
349
+ :id,
350
+ :isprimary,
351
+ :issalesrep,
352
+ :salesrole,
353
+ ],
354
+ }
355
+ end