Class: Etna::Clients::Magma
- Inherits:
-
BaseClient
- Object
- BaseClient
- Etna::Clients::Magma
- Defined in:
- lib/etna/clients/magma/client.rb,
lib/etna/clients/magma/models.rb,
lib/etna/clients/magma/formatting/models_csv.rb,
lib/etna/clients/magma/workflows/crud_workflow.rb,
lib/etna/clients/magma/formatting/models_odm_xml.rb,
lib/etna/clients/magma/formatting/models_odm_xml.rb,
lib/etna/clients/magma/workflows/json_converters.rb,
lib/etna/clients/magma/workflows/json_validators.rb,
lib/etna/clients/magma/workflows/file_linking_workflow.rb,
lib/etna/clients/magma/workflows/create_project_workflow.rb,
lib/etna/clients/magma/workflows/walk_model_tree_workflow.rb,
lib/etna/clients/magma/workflows/add_project_models_workflow.rb,
lib/etna/clients/magma/workflows/file_attributes_blank_workflow.rb,
lib/etna/clients/magma/workflows/model_synchronization_workflow.rb,
lib/etna/clients/magma/workflows/record_synchronization_workflow.rb,
lib/etna/clients/magma/workflows/ensure_containing_record_workflow.rb,
lib/etna/clients/magma/workflows/update_attributes_from_csv_workflow.rb,
lib/etna/clients/magma/workflows/attribute_actions_from_json_workflow.rb,
lib/etna/clients/magma/workflows/materialize_magma_record_files_workflow.rb
Defined Under Namespace
Modules: ModelsCsv, ModelsOdmXml Classes: AddAttributeAction, AddAttributeActionValidator, AddLinkAction, AddLinkActionValidator, AddLinkDefinition, AddModelAction, AddModelValidator, AddProjectAction, AddProjectModelsWorkflow, Attribute, AttributeActionValidatorBase, AttributeActionsConverter, AttributeActionsFromJsonWorkflow, AttributeActionsValidator, AttributeType, AttributeValidation, AttributeValidationType, AttributeValidator, Attributes, ConverterBase, CreateProjectWorkflow, Dictionary, Documents, EnsureContainingRecordWorkflow, FileAttributesBlankWorkflow, FileLinkingWorkflow, MagmaCrudWorkflow, MaterializeDataWorkflow, Model, ModelSynchronizationWorkflow, Models, ParentLinkType, Project, ProjectValidator, QueryRequest, QueryResponse, RecordSynchronizationWorkflow, RenameAttributeAction, RenameAttributeActionValidator, RenamesValidator, RetrievalRequest, RetrievalResponse, RowBase, SimpleFileLinkingWorkflow, Template, UpdateAttributeAction, UpdateAttributeActionValidator, UpdateAttributesFromCsvWorkflowBase, UpdateAttributesFromCsvWorkflowMultiModel, UpdateAttributesFromCsvWorkflowSingleModel, UpdateModelRequest, UpdateModelResponse, UpdateRequest, UpdateResponse, ValidatorBase, WalkModelTreeWorkflow
Instance Attribute Summary
Attributes inherited from BaseClient
Instance Method Summary collapse
-
#query(query_request = QueryRequest.new) ⇒ Object
This ‘query’ end point is used to fetch data by graph query See question.rb for more detail.
-
#retrieve(retrieval_request = RetrievalRequest.new) ⇒ Object
This endpoint returns models and records by name: e.g.
- #update(update_request = UpdateRequest.new) ⇒ Object
- #update_json(update_request = UpdateRequest.new) ⇒ Object
- #update_model(update_model_request = UpdateModelRequest.new) ⇒ Object
Methods inherited from BaseClient
#initialize, #token_expired?, #token_will_expire?
Constructor Details
This class inherits a constructor from Etna::Clients::BaseClient
Instance Method Details
#query(query_request = QueryRequest.new) ⇒ Object
This ‘query’ end point is used to fetch data by graph query See question.rb for more detail
28 29 30 31 32 33 34 35 |
# File 'lib/etna/clients/magma/client.rb', line 28 def query(query_request = QueryRequest.new) json = nil @etna_client.post('/query', query_request) do |res| json = JSON.parse(res.body) end QueryResponse.new(json) end |
#retrieve(retrieval_request = RetrievalRequest.new) ⇒ Object
This endpoint returns models and records by name: e.g. params:
model_name: "model_one", # or "all"
record_names: [ "rn1", "rn2" ], # or "all",
attribute_names: "all"
17 18 19 20 21 22 23 24 |
# File 'lib/etna/clients/magma/client.rb', line 17 def retrieve(retrieval_request = RetrievalRequest.new) json = nil @etna_client.post('/retrieve', retrieval_request) do |res| json = JSON.parse(res.body) end RetrievalResponse.new(json) end |
#update(update_request = UpdateRequest.new) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/etna/clients/magma/client.rb', line 37 def update(update_request = UpdateRequest.new) json = nil @etna_client.multipart_post('/update', update_request.encode_multipart_content) do |res| json = JSON.parse(res.body) end UpdateResponse.new(json) end |
#update_json(update_request = UpdateRequest.new) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/etna/clients/magma/client.rb', line 46 def update_json(update_request = UpdateRequest.new) json = nil @etna_client.post('/update', update_request) do |res| json = JSON.parse(res.body) end UpdateResponse.new(json) end |
#update_model(update_model_request = UpdateModelRequest.new) ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/etna/clients/magma/client.rb', line 55 def update_model(update_model_request = UpdateModelRequest.new) json = nil @etna_client.post('/update_model', update_model_request) do |res| json = JSON.parse(res.body) end UpdateModelResponse.new(json) end |