Class: ElastomerClient::Client::RestApiSpec::RestApi::Url

Inherits:
Object
  • Object
show all
Defined in:
lib/elastomer_client/client/rest_api_spec/rest_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, paths: [], parts: {}, params: {}) ⇒ Url

Returns a new instance of Url.



34
35
36
37
38
39
40
41
42
# File 'lib/elastomer_client/client/rest_api_spec/rest_api.rb', line 34

def initialize(path:, paths: [], parts: {}, params: {})
  @path = path
  @paths = Array(paths)
  @parts = parts
  @params = params

  @parts_set  = Set.new(@parts.keys)
  @params_set = Set.new(@params.keys)
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



32
33
34
# File 'lib/elastomer_client/client/rest_api_spec/rest_api.rb', line 32

def params
  @params
end

#partsObject (readonly)

Returns the value of attribute parts.



31
32
33
# File 'lib/elastomer_client/client/rest_api_spec/rest_api.rb', line 31

def parts
  @parts
end

#pathObject (readonly)

Returns the value of attribute path.



29
30
31
# File 'lib/elastomer_client/client/rest_api_spec/rest_api.rb', line 29

def path
  @path
end

#pathsObject (readonly)

Returns the value of attribute paths.



30
31
32
# File 'lib/elastomer_client/client/rest_api_spec/rest_api.rb', line 30

def paths
  @paths
end

Instance Method Details

#select_params(from:) ⇒ Object



52
53
54
# File 'lib/elastomer_client/client/rest_api_spec/rest_api.rb', line 52

def select_params(from:)
  from.select { |k, v| valid_param?(k) }
end

#select_parts(from:) ⇒ Object



44
45
46
# File 'lib/elastomer_client/client/rest_api_spec/rest_api.rb', line 44

def select_parts(from:)
  from.select { |k, v| valid_part?(k) }
end

#valid_param?(param) ⇒ Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/elastomer_client/client/rest_api_spec/rest_api.rb', line 56

def valid_param?(param)
  @params_set.include?(param.to_s)
end

#valid_part?(part) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/elastomer_client/client/rest_api_spec/rest_api.rb', line 48

def valid_part?(part)
  @parts_set.include?(part.to_s)
end