Module: Zaikio::Hub::Asset

Extended by:
ActiveSupport::Concern
Included in:
Machine, Specialist
Defined in:
lib/zaikio/hub/asset.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.capabilitiesObject

Constants



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/zaikio/hub/asset.rb', line 7

def self.capabilities
  %w[
    ctp digital_printing digital_web_printing inkjet_printing inkjet_web_printing
    offset_printing offset_uv_printing offset_uvle_printing offset_web_printing
    offset_web_uv_printing offset_web_uvle_printing flexo_printing letterpress_printing
    pad_printing pre_cutting cutting intermediate_cutting folding laminating perfect_binding
    hole_drilling comb_binding embossing engraving foil_stamping gluing head_banding
    perforating ring_binding saddle_stitching spiral_binding strip_binding thread_sewing
    envelope_stuffing counting wrapping boxing shrink_wrapping addressing franking
  ].freeze
end

Instance Method Details

#destroyObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/zaikio/hub/asset.rb', line 35

def destroy
  if Zaikio::Hub.current_token_data.subject_type == "Organization"
    self.class.request(:delete,
                       "#{collection_name}/#{id}/#{singular_name}_ownership")
  else
    org_path = "person/organizations/#{owner_id || organization_id}"
    self.class.request(:delete,
                       "#{org_path}/#{collection_name}/#{id}/#{singular_name}_ownership")
  end
end

#make_organization_ownerObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/zaikio/hub/asset.rb', line 24

def make_organization_owner
  if Zaikio::Hub.current_token_data.subject_type == "Organization"
    self.class.request(:post,
                       "#{collection_name}/#{id}/#{singular_name}_ownership")
  else
    org_path = "person/organizations/#{organization_id}"
    self.class.request(:post,
                       "#{org_path}/#{collection_name}/#{id}/#{singular_name}_ownership")
  end
end