Open
Conversation
be56426 to
266833f
Compare
266833f to
d735007
Compare
Member
|
@prburke could you add the usage example to the readme? Thanks for the PR! |
7185ffc to
df796ee
Compare
Member
|
@prburke would love to get this (and any other PRs you have) merged—could you update the readme with some examples of how to use this? |
|
Hey @iloveitaly how is it going? I did something like this: module Commerce
module NetSuite
class AsyncJobStatus < ::Commerce::BaseJob
queue_as :low
def perform(job_id, transaction_type_class_name)
job_status = ::NetSuite::Async::Status.get(job_id: job_id)
if job_status.finished?
response = ::NetSuite::Async::WriteResponseList.get(job_id: job_id)
if response.list&.first&.status&.is_success
transaction_type_class_name.constantize.new.audit
else
::Raven.capture_message(
"Failed sending #{transaction_type_class_name} report",
extra: { message: response.list&.first&.status&.details&.first&.message }
)
end
else
::Commerce::NetSuite::AsyncJobStatus.set(wait: 10.minutes).perform_later(job_id, transaction_type_class_name)
end
end
end
end
endand I enqueue this job after send the record: def async_add_record_object
return unless first_row
job_status = record_object.class.async_add_list([record_object])
::Commerce::NetSuite::AsyncJobStatus.set(wait: 10.minutes).perform_later(job_status.job_id, self.class.name)
end |
Member
|
@diegopolido could you collaborate on this PR and add some examples to the readme? Would be great to get a simplified version of what you posted above in the core readme. |
|
I would need @prburke permissions to add code on this PR, right? I can do on a separated PR, what do you think? |
Member
|
@diegopolido if he didn't allow collaborators to add to this PR, then that would be true. A separate PR is fine—let's just link it to this one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added AsyncAddList action to Invoice. Also added basic infrastructure that can be extended to support other asynchronous requests (e.g. NetSuite::Async::Status, NetSuite::Async::WriteResponseList, etc.)
Here is a simplified example of how it can be used: