Class: VpsbClient::Api::GetItemIdRequest
- Inherits:
-
GetRequest
- Object
- Request
- GetRequest
- VpsbClient::Api::GetItemIdRequest
- Defined in:
- lib/vpsb_client/api/get_item_id_request.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(http_client, item_type, name) ⇒ GetItemIdRequest
constructor
A new instance of GetItemIdRequest.
- #url_path ⇒ Object
Methods inherited from GetRequest
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_path ⇒ Object
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 |