netsuite 0.5.2 → 0.5.3

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDZjNmUwOTA5NzlmODQ4YWE0ZTk2ZmQzNDJmYTg1ZDI5ZjVhMjY3MA==
4
+ NzExNzFiYjM5YWZhODMxNjFhNGM0NmQ3MDFlZjM1OTgxN2YwYTcwMQ==
5
5
  data.tar.gz: !binary |-
6
- MThmZWIzZjgzNjdhNmJiMDgzY2FhZjAwOGY0M2Q3ZjZiNzQ0YTZkNQ==
6
+ YmYyZTc4MWI3YmQxNzdhZTdlZGY3NjZiNmQ1Zjk5M2RmMGI5MGM1ZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Y2JkOThlMGJlNGQ5Mzg4OTVlMTcyYmQwOGY5NjJmYWZjMGM1MmI0ZDQwMTdm
10
- YzU1YzY0OGRmNDg4OWYzNTIyODA0MTZhMTlkNzA3MzY3NTBmMzcxYWFmMzkz
11
- NzU2NzY4YTRlMDBjMTZlZTBkMDY2NzVjZThlNjRmODY0NjFiMzg=
9
+ MmE2YzUwNWUzYjJlMTI5NmYxMDQwODE3MmMxNTdmNTIzMDU5MTQ3YWMwNzg3
10
+ NjEzMjkzYzJkMTdjNjVlYTA5NDFhODRjYWZmZjgwNTlmZmM4ZWJkNzE3OTFi
11
+ NDljNTA3M2JiYjFiN2MzM2JlN2NlNzdkMjMwNGMwZmI4NDY4MzM=
12
12
  data.tar.gz: !binary |-
13
- MjM5NWFiMzRlMjRjNWFiNTExMzFkYzE5OGRmYWJlM2ViMGE1N2RlNGZkNjky
14
- NzE3ZWI2MDQ5ZTljZTlkNGVkZGI5ZDRmMzU4ZjVlYWM2ODdhZGU0NWMzYzdj
15
- NWI0ZGJhMjJmYzFmOWFjMGMzMGUwZjgwMzY3YjYwY2YwZDdhOTk=
13
+ YWJhMTVjNmE3NGYxYWZjNjVhYmI2ZmJjYzhiMmRiOGZkMmI0NjNjMmVlYjhj
14
+ NTUwMzhlNjlmMzI4YWZkMDEyZTVhM2M2MWUyYzMzYmQzNzZhMWI5NjBhOGI2
15
+ YzI5NTBhOTQzZTk5ZDQzNWJkYWVkNzRkZTA3ODQyNjYwYmM0Yzk=
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  [![Circle CI](https://circleci.com/gh/NetSweet/netsuite/tree/master.svg?style=svg)](https://circleci.com/gh/NetSweet/netsuite/tree/master)
2
+ [![Slack Status](https://opensuite-slackin.herokuapp.com/badge.svg)](http://opensuite-slackin.herokuapp.com)
2
3
 
3
4
  # NetSuite Ruby SuiteTalk Gem
4
5
 
@@ -428,4 +429,4 @@ NetSuite::Configuration.soap_header = {
428
429
  'platformMsgs:applicationId' => 'your-netsuite-app-id'
429
430
  }
430
431
  }
431
- ```
432
+ ```
@@ -115,6 +115,7 @@ module NetSuite
115
115
  autoload :ContactAccessRoles, 'netsuite/records/contact_access_roles'
116
116
  autoload :ContactAccessRolesList, 'netsuite/records/contact_access_roles_list'
117
117
  autoload :Currency, 'netsuite/records/currency'
118
+ autoload :CurrencyRate, 'netsuite/records/currency_rate'
118
119
  autoload :Department, 'netsuite/records/department'
119
120
  autoload :Deposit, 'netsuite/records/deposit'
120
121
  autoload :DepositPayment, 'netsuite/records/deposit_payment'
@@ -78,7 +78,11 @@ module NetSuite
78
78
  self.wsdl_domain = wsdl_domain
79
79
  else
80
80
  # if sandbox, this parameter is ignored
81
- attributes[:wsdl_domain] ||= 'webservices.netsuite.com'
81
+ if sandbox
82
+ 'webservices.sandbox.netsuite.com'
83
+ else
84
+ attributes[:wsdl_domain] ||= 'webservices.netsuite.com'
85
+ end
82
86
  end
83
87
  end
84
88
 
@@ -0,0 +1,34 @@
1
+ module NetSuite
2
+ module Records
3
+ class CurrencyRate
4
+ include Support::Records
5
+ include Support::Fields
6
+
7
+ include Support::Actions
8
+ include Support::RecordRefs
9
+ include Namespaces::ListAcct
10
+
11
+ # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/record/currencyrate.html
12
+
13
+ actions :get, :get_list, :search
14
+
15
+ fields :base_currency, :effective_date, :exchange_rate, :transaction_currency
16
+
17
+ record_refs :base_currency, :transaction_currency
18
+
19
+ #field :base_currency, Currency
20
+ #field :transaction_currency, Currency
21
+
22
+ attr_reader :internal_id
23
+ attr_accessor :external_id
24
+
25
+ def initialize(attributes = {})
26
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
27
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
28
+
29
+ initialize_from_attributes_hash(attributes)
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -1,3 +1,3 @@
1
1
  module Netsuite
2
- VERSION = '0.5.2'
2
+ VERSION = '0.5.3'
3
3
  end
@@ -204,4 +204,14 @@ describe NetSuite::Configuration do
204
204
  end
205
205
  end
206
206
 
207
+ it '#wsdl_domain' do
208
+ expect(config.wsdl_domain).to eq('webservices.netsuite.com')
209
+
210
+ config.wsdl_domain = 'custom.domain.com'
211
+ expect(config.wsdl_domain).to eq('custom.domain.com')
212
+
213
+ config.sandbox = true
214
+ expect(config.wsdl_domain).to eq('webservices.sandbox.netsuite.com')
215
+ end
216
+
207
217
  end
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::CurrencyRate do
4
+ let(:currency_rate) { NetSuite::Records::CurrencyRate.new }
5
+
6
+ it 'has all the right fields' do
7
+ [
8
+ :effective_date, :exchange_rate
9
+ ].each do |field|
10
+ expect(currency_rate).to have_field(field)
11
+ end
12
+ end
13
+
14
+ it 'has the right record_refs' do
15
+ [
16
+ :base_currency, :transaction_currency
17
+ ].each do |record_ref|
18
+ expect(currency_rate).to have_record_ref(record_ref)
19
+ end
20
+ end
21
+
22
+ describe '.get' do
23
+ context 'when the response is successful' do
24
+ let(:response) { NetSuite::Response.new(:success => true, :body => { :exchange_rate => '1.0', :effective_date => DateTime.now }) }
25
+
26
+ it 'returns an Invoice instance populated with the data from the response object' do
27
+ expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::CurrencyRate, {:internal_id => 1}], {}).and_return(response)
28
+ currency_rate = NetSuite::Records::CurrencyRate.get(:internal_id => 1)
29
+ expect(currency_rate).to be_kind_of(NetSuite::Records::CurrencyRate)
30
+ end
31
+ end
32
+
33
+ context 'when the response is unsuccessful' do
34
+ let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
35
+
36
+ it 'raises a RecordNotFound exception' do
37
+ expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::CurrencyRate, {:internal_id => 1}], {}).and_return(response)
38
+ expect {
39
+ NetSuite::Records::CurrencyRate.get(:internal_id => 1)
40
+ }.to raise_error(NetSuite::RecordNotFound,
41
+ /NetSuite::Records::CurrencyRate with OPTIONS=(.*) could not be found/)
42
+ end
43
+ end
44
+ end
45
+ end
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.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Moran
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-16 00:00:00.000000000 Z
12
+ date: 2016-01-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: savon
@@ -120,6 +120,7 @@ files:
120
120
  - lib/netsuite/records/credit_memo_item.rb
121
121
  - lib/netsuite/records/credit_memo_item_list.rb
122
122
  - lib/netsuite/records/currency.rb
123
+ - lib/netsuite/records/currency_rate.rb
123
124
  - lib/netsuite/records/custom_field.rb
124
125
  - lib/netsuite/records/custom_field_list.rb
125
126
  - lib/netsuite/records/custom_list.rb
@@ -279,6 +280,7 @@ files:
279
280
  - spec/netsuite/records/credit_memo_item_list_spec.rb
280
281
  - spec/netsuite/records/credit_memo_item_spec.rb
281
282
  - spec/netsuite/records/credit_memo_spec.rb
283
+ - spec/netsuite/records/currency_rate_spec.rb
282
284
  - spec/netsuite/records/custom_field_list_spec.rb
283
285
  - spec/netsuite/records/custom_field_spec.rb
284
286
  - spec/netsuite/records/custom_list_spec.rb
@@ -452,6 +454,7 @@ test_files:
452
454
  - spec/netsuite/records/credit_memo_item_list_spec.rb
453
455
  - spec/netsuite/records/credit_memo_item_spec.rb
454
456
  - spec/netsuite/records/credit_memo_spec.rb
457
+ - spec/netsuite/records/currency_rate_spec.rb
455
458
  - spec/netsuite/records/custom_field_list_spec.rb
456
459
  - spec/netsuite/records/custom_field_spec.rb
457
460
  - spec/netsuite/records/custom_list_spec.rb