netsuite_api 0.1.3 → 0.1.4
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.
- checksums.yaml +4 -4
- data/README.md +104 -4
- data/lib/netsuite_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a19005bb2dadcffb65d996a094dbf0f55c866531b46a4cf1201b1acc05e84699
|
4
|
+
data.tar.gz: abff7e2b360b63df02b2ebb9edb800d6ec7293d3337fa02c366623a8d98e4171
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d64199bf0624819643df0ac0b56f61da172274a96ebaa1b81b2713a97cfc99f8005fc5ab4d5d40ec07567b468f6cdf5df01ebbc01051556033643ea093b9ba5e
|
7
|
+
data.tar.gz: fb661b28e3c79df42d0116f7256d78bfba4f7e000c1b97256fd7ec9b43a847fa2ec1a7ef0f685c6d9c778d9c0c2531d7acf3892c9a87f378ac89c20697fcb573
|
data/README.md
CHANGED
@@ -1,14 +1,17 @@
|
|
1
1
|
# NetsuiteApi
|
2
2
|
|
3
3
|
This library is designed to help ruby/rails based applications communicate with the publicly available REST API for NetSuite.
|
4
|
+
|
4
5
|
If you are unfamiliar with the NetSuite REST API, you should first read the documentation located at [SuiteTalk REST Web Services API Guide](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/book_1559132836.html).
|
5
6
|
|
7
|
+
The NetSuite REST API document could be found at [NetSuite REST API Browser: Record API v1](https://system.netsuite.com/help/helpcenter/en_US/APIs/REST_API_Browser/record/v1/2024.1/index.html#tag-account)
|
8
|
+
|
6
9
|
## Installation
|
7
10
|
|
8
11
|
Add this line to your application's Gemfile:
|
9
12
|
|
10
13
|
```ruby
|
11
|
-
gem 'netsuite_api'
|
14
|
+
gem 'netsuite_api', '0.1.4'
|
12
15
|
```
|
13
16
|
|
14
17
|
And then execute:
|
@@ -19,9 +22,106 @@ Or install it yourself as:
|
|
19
22
|
|
20
23
|
$ gem install netsuite_api
|
21
24
|
|
22
|
-
## Usage
|
25
|
+
## Basic Usage
|
26
|
+
|
27
|
+
### Setup Credential Information
|
28
|
+
|
29
|
+
Set All the credential information in your project .env file
|
30
|
+
```
|
31
|
+
NETSUITE_HOST = ""
|
32
|
+
NETSUITE_ACCOUNT_ID = ""
|
33
|
+
NETSUITE_CONSUMER_KEY = ""
|
34
|
+
NETSUITE_CONSUMER_SECRET = ""
|
35
|
+
NETSUITE_TOKEN = ""
|
36
|
+
NETSUITE_TOKEN_SECRET = ""
|
37
|
+
NETSUITE_PDF_HOST =
|
38
|
+
```
|
39
|
+
|
40
|
+
or pass those information when initialize NetsuiteApi instance, for example, initializing NetsuiteApi::Invoice
|
41
|
+
```
|
42
|
+
NetsuiteApi::Invoice.new(netsuite_host: "", netsuite_pdf_host: "", account_id: "", consumer_key: "", token: "", token_secret: "", consumer_secret: "")
|
43
|
+
```
|
44
|
+
|
45
|
+
## NetsuiteApi Object Usage
|
46
|
+
|
47
|
+
There are 7 objects could be used: `NetsuiteApi::Invoice`, `NetsuiteApi::CreditMemo`, `NetsuiteApi::Payment`, `NetsuiteApi::Customer`, `NetsuiteApi::Contact`, `NetsuiteApi::Vendor`, `NetsuiteApi::VendorBill`.
|
48
|
+
|
49
|
+
More information about the objects could be found in `lib/netsuite_api`.
|
50
|
+
|
51
|
+
All the objects have method to get record, create data, update data, delete data in NetSuite through Netsuite REST API.
|
52
|
+
|
53
|
+
Following section shows an example of using `NetsuiteApi::Invoice`. The way to use other objects is similar.
|
54
|
+
|
55
|
+
### Get data
|
56
|
+
|
57
|
+
* Get a specific invoice data.
|
58
|
+
```
|
59
|
+
service = NetsuiteApi::Invoice.new
|
60
|
+
service.get(netsuite_invoice_id)
|
61
|
+
```
|
62
|
+
|
63
|
+
* Query some invoice data.
|
64
|
+
```
|
65
|
+
# query invoices which entity is 12
|
66
|
+
|
67
|
+
service = NetsuiteApi::Invoice.new
|
68
|
+
query_params = { "q" => "entity EQUAL 12" }
|
69
|
+
service.query(query_params)
|
70
|
+
```
|
71
|
+
More information about the query parameters could be found in [Record Collection Filtering](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_1545222128.html#Record-Collection-Filtering)
|
72
|
+
|
73
|
+
|
74
|
+
### Create data
|
75
|
+
|
76
|
+
* Create an invoice
|
77
|
+
```
|
78
|
+
service = NetsuiteApi::Invoice.new
|
79
|
+
params = {
|
80
|
+
"entity" => {
|
81
|
+
"id" => "12"
|
82
|
+
},
|
83
|
+
"postingperiod" => "121",
|
84
|
+
"item" => {
|
85
|
+
"items" => [
|
86
|
+
{
|
87
|
+
"amount" => 100.0,
|
88
|
+
"item" => {
|
89
|
+
"id" => "26"
|
90
|
+
}
|
91
|
+
}
|
92
|
+
]
|
93
|
+
},
|
94
|
+
"subsidiary" => {
|
95
|
+
"id" => "8"
|
96
|
+
},
|
97
|
+
"currency" => {
|
98
|
+
"id": "2"
|
99
|
+
}
|
100
|
+
}
|
101
|
+
service.create(invoice_params)
|
102
|
+
```
|
103
|
+
|
104
|
+
|
105
|
+
### Update data
|
106
|
+
|
107
|
+
* Update an invoice
|
108
|
+
```
|
109
|
+
service = NetsuiteApi::Invoice.new
|
110
|
+
update_params = { "otherRefNum": "1234" }
|
111
|
+
invoice_id = 1
|
112
|
+
service.update(invoice_id, update_params)
|
113
|
+
```
|
114
|
+
|
115
|
+
|
116
|
+
### Delete data
|
117
|
+
|
118
|
+
* Delete an invoice
|
119
|
+
```
|
120
|
+
service = NetsuiteApi::Invoice.new
|
121
|
+
invoice_id = 1
|
122
|
+
service.delete(invoice_id)
|
123
|
+
```
|
23
124
|
|
24
|
-
TODO: Write usage instructions here
|
25
125
|
|
26
126
|
## Development
|
27
127
|
|
@@ -31,7 +131,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
31
131
|
|
32
132
|
## Contributing
|
33
133
|
|
34
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
134
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/iceland101113/netsuite_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
35
135
|
|
36
136
|
## License
|
37
137
|
|
data/lib/netsuite_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netsuite_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HueiYi Lucy Cheng
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|