Skip to content

zaikio/zaikio-mission_control-ruby

Repository files navigation

Zaikio::MissionControl

Ruby API Client for Zaikio Mission Control.

Installation

1. Add this line to your application's Gemfile:

gem 'zaikio-mission_control'

And then execute:

$ bundle

Or install it yourself as:

$ gem install zaikio-mission_control

2. Configure the gem:

# config/initializers/zaikio_mission_control.rb

Zaikio::MissionControl.configure do |config|
  config.environment = :production # sandbox or production
end

Usage

Specifications

This gem contains helper methods to list jobs and parts and to understand which parts a job consists of.

Zaikio::MissionControl.jobs => #[:booklet, :box, ...]
Zaikio::MissionControl.parts => #[:back, :base, ...]
Zaikio::MissionControl.finishings => #[:comb_binding, :embossing, ...]

Zaikio::MissionControl.job_klasses => # [Zaikio::MissionControl::Jobs::Booklet, Zaikio::MissionControl::Jobs::Box, ...]
Zaikio::MissionControl.part_klasses => # [Zaikio::MissionControl::Parts::Back, Zaikio::MissionControl::Parts::Base, ...]
Zaikio::MissionControl.finishing_klasses => # [Zaikio::MissionControl::Finishings::CombBinding, Zaikio::MissionControl::Finishings::Embossing, ...]

# Localize models
I18n.with_locale(:de) do
  Zaikio::MissionControl::Jobs::Booklet.model_name.human # => Heft
end

Per job you can fetch the parts and their configuration:

Zaikio::MissionControl::Jobs::Booklet.parts # => [:content, :cover, :insert, :outsert]
Zaikio::MissionControl::Jobs::Booklet.part_klasses # => [Zaikio::MissionControl::Parts::Content, ...]

Zaikio::MissionControl::Jobs::Booklet.multiples?(:content) # => true
Zaikio::MissionControl::Jobs::Booklet.multiples?(Zaikio::MissionControl::Parts::Content) # => true
Zaikio::MissionControl::Jobs::Booklet.required?(:content) # => true
Zaikio::MissionControl::Jobs::Booklet.required?(Zaikio::MissionControl::Parts::Content) # => true