Class: RogIQ::Commands::Sync
- Defined in:
- lib/rogiq/commands/sync.rb
Instance Method Summary collapse
- #integrations(identifier) ⇒ Object
- #postman ⇒ Object
- #stripe ⇒ Object
- #wordpress(identifier) ⇒ Object
Instance Method Details
#integrations(identifier) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/rogiq/commands/sync.rb', line 41 def integrations(identifier) RogIQ.load_rails! client = RogIQ::Helpers.resolve_client(identifier) unless client fmt.error_msg("Client not found") exit 1 end ids = client.integrations.pluck(:id) if ids.empty? fmt.warn_msg("No integrations linked to this client.") return end ids.each { |iid| ::Integrations::SyncJob.perform_later(iid) } fmt.success("Enqueued #{ids.size} Integrations::SyncJob(s).") end |
#postman ⇒ Object
7 8 9 10 11 |
# File 'lib/rogiq/commands/sync.rb', line 7 def postman RogIQ.load_rails! Rails.application.load_tasks Rake::Task["postman:sync"].invoke end |
#stripe ⇒ Object
14 15 16 17 18 |
# File 'lib/rogiq/commands/sync.rb', line 14 def stripe RogIQ.load_rails! Rails.application.load_tasks Rake::Task["stripe:ensure_subscription_prices"].invoke end |
#wordpress(identifier) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/rogiq/commands/sync.rb', line 21 def wordpress(identifier) RogIQ.load_rails! client = RogIQ::Helpers.resolve_client(identifier) unless client fmt.error_msg("Client not found") exit 1 end ::Integrations::SyncWordpressTaxonomiesJob.perform_later( account_id: client.account_id, client_id: client.id ) ::Integrations::SyncWordpressAuthorsJob.perform_later( account_id: client.account_id, client_id: client.id ) fmt.success("WordPress sync jobs enqueued for client #{client.id}.") end |