Module: RubyLokaliseApi::Utils::Keys

Included in:
Collections::Base, Resources::Base
Defined in:
lib/ruby_lokalise_api/utils/keys.rb

Instance Method Summary collapse

Instance Method Details

#collection_key_for(klass:) ⇒ String

Retrieves the DATA_KEY for collections. DATA_KEY specifies the key in the API response containing the actual data.

Parameters:

  • klass (Class)

    The class of the collection

Returns:

  • (String)

    The snake-cased DATA_KEY



22
23
24
# File 'lib/ruby_lokalise_api/utils/keys.rb', line 22

def collection_key_for(klass:)
  retrieve_data_key("RubyLokaliseApi::Collections::#{klass}::DATA_KEY", klass)
end

#data_key_for(klass:) ⇒ String

Retrieves the DATA_KEY for resources. DATA_KEY specifies the key in the API response containing the actual data.

Parameters:

  • klass (Class)

    The class of the resource

Returns:

  • (String)

    The snake-cased DATA_KEY



13
14
15
# File 'lib/ruby_lokalise_api/utils/keys.rb', line 13

def data_key_for(klass:)
  retrieve_data_key("RubyLokaliseApi::Resources::#{klass}::DATA_KEY", klass)
end