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.
9 10 11 12 13 |
# File 'lib/intacct/request.rb', line 9 def initialize(transaction_operation: false) @functions = [] @authentication = nil @transaction_operation = transaction_operation end |
Instance Method Details
#add_function(function, control_id) ⇒ Object
15 16 17 |
# File 'lib/intacct/request.rb', line 15 def add_function(function, control_id) @functions << { function:, control_id: } end |
#to_xml(control_config) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/intacct/request.rb', line 29 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
19 20 21 22 23 |
# File 'lib/intacct/request.rb', line 19 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
25 26 27 |
# File 'lib/intacct/request.rb', line 25 def use_session_authentication(session_token) @authentication = Intacct::AuthenticationMethods::Session.new(session_token) end |