Class: HmxClient::Command::Type
Overview
Display and manage type information in hmx
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#clone ⇒ Object
type:clone-ent.
-
#create ⇒ Object
type:create.
-
#index ⇒ Object
type.
Methods inherited from Base
#hmx, #initialize, #loadConfig!, namespace, #removeConfig, #storeConfig, #writeConfig
Methods included from Helpers
#display, #display_row, #display_tab, #display_table, #error, #getFromUser, #longest
Constructor Details
This class inherits a constructor from HmxClient::Command::Base
Instance Method Details
#clone ⇒ Object
type:clone-ent
Clone the entitlements from one type to another
<srcType> <targType>
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/hmx/command/type.rb', line 31 def clone # We basically load the documents for sys.ent/type/[source]/query and sys.ent/type/[source]/query and copy them to the target sourceType = args.shift targetType = args.shift arr = JSON.parse(hmx.doGetContent(["sys.ent/type/#{ sourceType }/get"])) arr["MXEntitlement"]["entitlementPath"] = "type/#{ targetType }/get" hmx.doPutSimpleData([ "sys.ent/type/#{ targetType}/get", JSON.generate(arr)]) arr = JSON.parse(hmx.doGetContent(["sys.ent/type/#{ sourceType }/query"])) arr["MXEntitlement"]["entitlementPath"] = "type/#{ targetType }/query" hmx.doPutSimpleData([ "sys.ent/type/#{ targetType}/query", JSON.generate(arr)]) puts "Done..." end |
#create ⇒ Object
type:create
Create a type with default settings - no triggers, no entitlements
20 21 22 23 24 |
# File 'lib/hmx/command/type.rb', line 20 def create typeInfo = { "name" => args.shift, "triggers" => [], "typeNature" => "CONTENT", "typeIndexScript" => "" } hmx.doUpdateType([typeInfo]) puts "Done..." end |
#index ⇒ Object
type
Display information about a HMX type
13 14 15 |
# File 'lib/hmx/command/type.rb', line 13 def index puts JSON.pretty_generate(hmx.doGetType(args)) end |