Class: Intacct::Request
- Inherits:
-
Object
- Object
- Intacct::Request
- Defined in:
- lib/intacct/request.rb
Instance Method Summary collapse
- #add_function(function, control_id) ⇒ Object
-
#initialize(transaction_operation: false) ⇒ Request
constructor
A new instance of Request.
- #to_xml(control_config) ⇒ Object
- #use_credentials_authentication(user_id:, company_id:, user_password:) ⇒ Object
- #use_session_authentication(session_token) ⇒ Object
Constructor Details
#initialize(transaction_operation: false) ⇒ Request
Returns a new instance of Request.
7 8 9 10 11 |
# File 'lib/intacct/request.rb', line 7 def initialize(transaction_operation: false) @functions = [] @authentication = nil @transaction_operation = transaction_operation end |
Instance Method Details
#add_function(function, control_id) ⇒ Object
13 14 15 |
# File 'lib/intacct/request.rb', line 13 def add_function(function, control_id) @functions << { function:, control_id: } end |
#to_xml(control_config) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/intacct/request.rb', line 27 def to_xml(control_config) raise MissingAuthenticationException unless @authentication builder = Builder::XmlMarkup.new builder.instruct! builder.request do add_control_block(builder, control_config) add_operation_block(builder) end end |
#use_credentials_authentication(user_id:, company_id:, user_password:) ⇒ Object
17 18 19 20 21 |
# File 'lib/intacct/request.rb', line 17 def use_credentials_authentication(user_id:, company_id:, user_password:) @authentication = Intacct::AuthenticationMethods::Credentials.new( user_id:, company_id:, password: user_password ) end |
#use_session_authentication(session_token) ⇒ Object
23 24 25 |
# File 'lib/intacct/request.rb', line 23 def use_session_authentication(session_token) @authentication = Intacct::AuthenticationMethods::Session.new(session_token) end |