Module: Zaikio::MissionControl

Defined in:
lib/zaikio/mission_control.rb,
lib/zaikio/mission_control/job.rb,
lib/zaikio/mission_control/base.rb,
lib/zaikio/mission_control/part.rb,
lib/zaikio/mission_control/slot.rb,
lib/zaikio/mission_control/color.rb,
lib/zaikio/mission_control/order.rb,
lib/zaikio/mission_control/contact.rb,
lib/zaikio/mission_control/machine.rb,
lib/zaikio/mission_control/version.rb,
lib/zaikio/mission_control/customer.rb,
lib/zaikio/mission_control/jobs/box.rb,
lib/zaikio/mission_control/jobs/map.rb,
lib/zaikio/mission_control/workstep.rb,
lib/zaikio/mission_control/execution.rb,
lib/zaikio/mission_control/finishing.rb,
lib/zaikio/mission_control/jobs/base.rb,
lib/zaikio/mission_control/jobs/card.rb,
lib/zaikio/mission_control/parts/lid.rb,
lib/zaikio/mission_control/jobs/flyer.rb,
lib/zaikio/mission_control/jobs/label.rb,
lib/zaikio/mission_control/jobs/sheet.rb,
lib/zaikio/mission_control/parts/back.rb,
lib/zaikio/mission_control/parts/base.rb,
lib/zaikio/mission_control/parts/card.rb,
lib/zaikio/mission_control/parts/case.rb,
lib/zaikio/mission_control/jobs/carton.rb,
lib/zaikio/mission_control/jobs/folder.rb,
lib/zaikio/mission_control/jobs/poster.rb,
lib/zaikio/mission_control/parts/cover.rb,
lib/zaikio/mission_control/parts/flyer.rb,
lib/zaikio/mission_control/parts/label.rb,
lib/zaikio/mission_control/parts/sheet.rb,
lib/zaikio/mission_control/jobs/booklet.rb,
lib/zaikio/mission_control/jobs/leaflet.rb,
lib/zaikio/mission_control/jobs/ncr_pad.rb,
lib/zaikio/mission_control/parts/carton.rb,
lib/zaikio/mission_control/parts/folder.rb,
lib/zaikio/mission_control/parts/insert.rb,
lib/zaikio/mission_control/parts/jacket.rb,
lib/zaikio/mission_control/parts/poster.rb,
lib/zaikio/mission_control/configuration.rb,
lib/zaikio/mission_control/jobs/brochure.rb,
lib/zaikio/mission_control/jobs/envelope.rb,
lib/zaikio/mission_control/jobs/magazine.rb,
lib/zaikio/mission_control/jobs/notebook.rb,
lib/zaikio/mission_control/jobs/postcard.rb,
lib/zaikio/mission_control/parts/content.rb,
lib/zaikio/mission_control/parts/leaflet.rb,
lib/zaikio/mission_control/parts/outsert.rb,
lib/zaikio/mission_control/file_reference.rb,
lib/zaikio/mission_control/jobs/newspaper.rb,
lib/zaikio/mission_control/parts/endpaper.rb,
lib/zaikio/mission_control/parts/envelope.rb,
lib/zaikio/mission_control/parts/postcard.rb,
lib/zaikio/mission_control/finishings/base.rb,
lib/zaikio/mission_control/finishings/glue.rb,
lib/zaikio/mission_control/finishings/hole.rb,
lib/zaikio/mission_control/order_line_item.rb,
lib/zaikio/mission_control/parts/map_sheet.rb,
lib/zaikio/mission_control/shipping_option.rb,
lib/zaikio/mission_control/jobs/letter_head.rb,
lib/zaikio/mission_control/jobs/self_mailer.rb,
lib/zaikio/mission_control/production_frame.rb,
lib/zaikio/mission_control/desired_substrate.rb,
lib/zaikio/mission_control/jobs/cover_letter.rb,
lib/zaikio/mission_control/jobs/folding_card.rb,
lib/zaikio/mission_control/parts/letter_head.rb,
lib/zaikio/mission_control/parts/self_mailer.rb,
lib/zaikio/mission_control/jobs/business_card.rb,
lib/zaikio/mission_control/parts/cover_letter.rb,
lib/zaikio/mission_control/parts/folding_card.rb,
lib/zaikio/mission_control/jobs/hardcover_book.rb,
lib/zaikio/mission_control/jobs/softcover_book.rb,
lib/zaikio/mission_control/parts/business_card.rb,
lib/zaikio/mission_control/finishings/embossing.rb,
lib/zaikio/mission_control/finishings/head_band.rb,
lib/zaikio/mission_control/intermediate_product.rb,
lib/zaikio/mission_control/jobs/compliment_slip.rb,
lib/zaikio/mission_control/finishing_application.rb,
lib/zaikio/mission_control/finishings/foil_stamp.rb,
lib/zaikio/mission_control/finishings/lamination.rb,
lib/zaikio/mission_control/jobs/carton_two_piece.rb,
lib/zaikio/mission_control/parts/compliment_slip.rb,
lib/zaikio/mission_control/finishings/perforation.rb,
lib/zaikio/mission_control/finishings/comb_binding.rb,
lib/zaikio/mission_control/finishings/ring_binding.rb,
lib/zaikio/mission_control/jobs/continuation_sheet.rb,
lib/zaikio/mission_control/finishings/saddle_stitch.rb,
lib/zaikio/mission_control/finishings/strip_binding.rb,
lib/zaikio/mission_control/finishings/thread_sewing.rb,
lib/zaikio/mission_control/parts/continuation_sheet.rb,
lib/zaikio/mission_control/finishings/spiral_binding.rb,
lib/zaikio/mission_control/finishings/perfect_binding.rb

Defined Under Namespace

Modules: Finishings, Jobs, Parts Classes: Base, Color, Configuration, Contact, Customer, DesiredSubstrate, Execution, FileReference, Finishing, FinishingApplication, IntermediateProduct, Job, Machine, Order, OrderLineItem, Part, ProductionFrame, ShippingOption, Slot, Workstep

Constant Summary collapse

VERSION =
"0.5.1".freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



108
109
110
# File 'lib/zaikio/mission_control.rb', line 108

def configuration
  @configuration
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



112
113
114
115
116
117
118
119
# File 'lib/zaikio/mission_control.rb', line 112

def configure
  self.connection = nil
  self.configuration ||= Configuration.new
  yield(configuration)

  Base.connection = create_connection
  I18n.load_path += Dir["#{File.expand_path('../../config/locales', __dir__)}/*.yml"]
end

.create_connectionObject



125
126
127
# File 'lib/zaikio/mission_control.rb', line 125

def create_connection
  self.connection = Zaikio::Client.create_connection(configuration)
end

.finishing_klassesObject



142
143
144
145
146
147
# File 'lib/zaikio/mission_control.rb', line 142

def finishing_klasses
  @finishing_klasses ||= Zaikio::MissionControl::Finishings
                         .constants.sort
                         .map { |c| Zaikio::MissionControl::Finishings.const_get(c) }
                         .select { |c| c.is_a?(Class) } - [Zaikio::MissionControl::Finishings::Base]
end

.finishingsObject



157
158
159
# File 'lib/zaikio/mission_control.rb', line 157

def finishings
  @finishings ||= finishing_klasses.map { |k| k.name.demodulize.underscore.to_sym }
end

.job_klassesObject



129
130
131
132
133
134
# File 'lib/zaikio/mission_control.rb', line 129

def job_klasses
  @job_klasses ||= Zaikio::MissionControl::Jobs
                   .constants.sort
                   .map { |c| Zaikio::MissionControl::Jobs.const_get(c) }
                   .select { |c| c.is_a?(Class) && !(c < ActiveSupport::TestCase) } - [Zaikio::MissionControl::Jobs::Base]
end

.jobsObject



149
150
151
# File 'lib/zaikio/mission_control.rb', line 149

def jobs
  @jobs ||= job_klasses.map { |k| k.name.demodulize.underscore.to_sym }
end

.part_klassesObject



136
137
138
139
140
# File 'lib/zaikio/mission_control.rb', line 136

def part_klasses
  @part_klasses ||= Zaikio::MissionControl::Parts.constants.sort
                                                 .map { |c| Zaikio::MissionControl::Parts.const_get(c) }
                                                 .select { |c| c.is_a?(Class) } - [Zaikio::MissionControl::Parts::Base]
end

.partsObject



153
154
155
# File 'lib/zaikio/mission_control.rb', line 153

def parts
  @parts ||= part_klasses.map { |k| k.name.demodulize.underscore.to_sym }
end

.with_token(token, &block) ⇒ Object



121
122
123
# File 'lib/zaikio/mission_control.rb', line 121

def with_token(token, &block)
  Zaikio::Client.with_token(token, &block)
end