Class: CodewarsCli::Finalize
- Inherits:
-
Object
- Object
- CodewarsCli::Finalize
- Includes:
- FileParserHelpers, GenericHelpers
- Defined in:
- lib/codewars_cli/finalize.rb
Instance Attribute Summary collapse
-
#kata_name ⇒ Object
readonly
Returns the value of attribute kata_name.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
Class Method Summary collapse
Instance Method Summary collapse
- #finalize ⇒ Object
-
#initialize(kata_name, language) ⇒ Finalize
constructor
A new instance of Finalize.
Methods included from FileParserHelpers
#_fetch_info, #_kata_path, #_parse_description_file
Methods included from GenericHelpers
#check_for_api_key, #client, #error, #extend_object, included, #info, #presenter
Constructor Details
#initialize(kata_name, language) ⇒ Finalize
Returns a new instance of Finalize.
12 13 14 15 |
# File 'lib/codewars_cli/finalize.rb', line 12 def initialize(kata_name, language) @kata_name = kata_name @language = language || Configuration.language end |
Instance Attribute Details
#kata_name ⇒ Object (readonly)
Returns the value of attribute kata_name.
10 11 12 |
# File 'lib/codewars_cli/finalize.rb', line 10 def kata_name @kata_name end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
10 11 12 |
# File 'lib/codewars_cli/finalize.rb', line 10 def language @language end |
Class Method Details
.find(kata_name, language) ⇒ Object
5 6 7 8 |
# File 'lib/codewars_cli/finalize.rb', line 5 def self.find(kata_name, language) check_for_api_key new(kata_name, language).finalize end |
Instance Method Details
#finalize ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/codewars_cli/finalize.rb', line 17 def finalize response = client.finalize(kata: _parse_description_file(kata_name, language)) if response.success info('Your Kata has been uploaded and finish') else error("There has been an error finalizing your kata #{response.reason}") end end |