Class: VpsbClient::Api::GetItemIdRequest

Inherits:
GetRequest show all
Defined in:
lib/vpsb_client/api/get_item_id_request.rb

Direct Known Subclasses

GetPlanIdRequest

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from GetRequest

#run

Methods inherited from Request

#accept, #post_params, #put_params, #query_params

Constructor Details

#initialize(http_client, item_type, name) ⇒ GetItemIdRequest

Returns a new instance of GetItemIdRequest.



6
7
8
9
10
# File 'lib/vpsb_client/api/get_item_id_request.rb', line 6

def initialize(http_client, item_type, name)
  super(http_client)
  @item_type = item_type
  @name = name
end

Class Method Details

.item_id(http_response) ⇒ Object



16
17
18
19
# File 'lib/vpsb_client/api/get_item_id_request.rb', line 16

def self.item_id(http_response)
  return nil unless http_response.parsed_response.any?
  http_response.parsed_response.first['id']
end

Instance Method Details

#url_pathObject



12
13
14
# File 'lib/vpsb_client/api/get_item_id_request.rb', line 12

def url_path
  "/api/#{@item_type}/by_name/#{ERB::Util.url_encode(@name)}"
end