Class: NetSuite::Actions::Initialize
- Inherits:
-
Object
- Object
- NetSuite::Actions::Initialize
- Includes:
- Support::Requests
- Defined in:
- lib/netsuite/actions/initialize.rb
Defined Under Namespace
Modules: Support
Instance Method Summary collapse
-
#initialize(klass, object) ⇒ Initialize
constructor
A new instance of Initialize.
- #request(credentials = {}) ⇒ Object
-
#request_body ⇒ Object
<platformMsgs:initializeRecord> <platformCore:type>invoice</platformCore:type> <platformCore:reference internalId=“1513” type=“salesOrder”> <platformCore:name>1511</platformCore:name> </platformCore:reference> </platformMsgs:initializeRecord>.
- #response_body ⇒ Object
- #response_hash ⇒ Object
- #success? ⇒ Boolean
Methods included from Support::Requests
Constructor Details
#initialize(klass, object) ⇒ Initialize
Returns a new instance of Initialize.
7 8 9 10 |
# File 'lib/netsuite/actions/initialize.rb', line 7 def initialize(klass, object) @klass = klass @object = object end |
Instance Method Details
#request(credentials = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/netsuite/actions/initialize.rb', line 12 def request(credentials={}) NetSuite::Configuration.connection( {namespaces: { 'xmlns:platformMsgs' => "urn:messages_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com", 'xmlns:platformCore' => "urn:core_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com", 'xmlns:platformCoreTyp' => "urn:types.core_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com", }}, credentials ).call :initialize, :message => request_body end |
#request_body ⇒ Object
<platformMsgs:initializeRecord>
<platformCore:type>invoice</platformCore:type>
<platformCore:reference internalId="1513" type="salesOrder">
<platformCore:name>1511</platformCore:name>
</platformCore:reference>
</platformMsgs:initializeRecord>
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/netsuite/actions/initialize.rb', line 28 def request_body { 'platformMsgs:initializeRecord' => { 'platformCore:type' => @klass.to_s.split('::').last.lower_camelcase, 'platformCore:reference' => {}, :attributes! => { 'platformCore:reference' => { 'internalId' => @object.internal_id, :type => @object.class.to_s.split('::').last.lower_camelcase } } } } end |
#response_body ⇒ Object
51 52 53 |
# File 'lib/netsuite/actions/initialize.rb', line 51 def response_body @response_body ||= response_hash[:record] end |
#response_hash ⇒ Object
43 44 45 |
# File 'lib/netsuite/actions/initialize.rb', line 43 def response_hash @response_hash ||= @response.to_hash[:initialize_response][:read_response] end |
#success? ⇒ Boolean
47 48 49 |
# File 'lib/netsuite/actions/initialize.rb', line 47 def success? @success ||= response_hash[:status][:@is_success] == 'true' end |