Class: Keymaker::BatchGetNodesRequest

Inherits:
BatchRequest show all
Defined in:
lib/keymaker/requests/batch_get_nodes_request.rb

Instance Attribute Summary collapse

Attributes inherited from Request

#config, #opts, #service

Instance Method Summary collapse

Methods inherited from BatchRequest

#submit

Constructor Details

#initialize(service, node_ids) ⇒ BatchGetNodesRequest

Returns a new instance of BatchGetNodesRequest.



7
8
9
10
11
12
# File 'lib/keymaker/requests/batch_get_nodes_request.rb', line 7

def initialize(service, node_ids)
  self.config = service.config
  self.node_ids = node_ids
  self.service = service
  self.opts = build_job_descriptions_collection
end

Instance Attribute Details

#node_idsObject

Returns the value of attribute node_ids.



5
6
7
# File 'lib/keymaker/requests/batch_get_nodes_request.rb', line 5

def node_ids
  @node_ids
end

Instance Method Details

#build_job_descriptions_collectionObject



14
15
16
17
18
19
20
# File 'lib/keymaker/requests/batch_get_nodes_request.rb', line 14

def build_job_descriptions_collection
  [].tap do |batch_jobs|
    node_ids.each_with_index do |node_id, job_id|
      batch_jobs << {id: job_id, to: node_uri(node_id), method: "GET"}
    end
  end
end