Class: Txgh::TransifexProject
- Inherits:
-
Object
- Object
- Txgh::TransifexProject
- Defined in:
- lib/txgh/transifex_project.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #auto_delete_resources? ⇒ Boolean
-
#initialize(config, api) ⇒ TransifexProject
constructor
A new instance of TransifexProject.
- #languages ⇒ Object
- #name ⇒ Object
- #organization ⇒ Object
- #protected_branches ⇒ Object
- #serialization_options ⇒ Object
- #supported_language?(language) ⇒ Boolean
- #tx_config_uri ⇒ Object
- #webhook_protected? ⇒ Boolean
- #webhook_secret ⇒ Object
Constructor Details
#initialize(config, api) ⇒ TransifexProject
Returns a new instance of TransifexProject.
5 6 7 8 |
# File 'lib/txgh/transifex_project.rb', line 5 def initialize(config, api) @config = config @api = api end |
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
3 4 5 |
# File 'lib/txgh/transifex_project.rb', line 3 def api @api end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/txgh/transifex_project.rb', line 3 def config @config end |
Instance Method Details
#auto_delete_resources? ⇒ Boolean
33 34 35 |
# File 'lib/txgh/transifex_project.rb', line 33 def auto_delete_resources? Utils.booleanize(config['auto_delete_resources'] || 'false') end |
#languages ⇒ Object
41 42 43 |
# File 'lib/txgh/transifex_project.rb', line 41 def languages config.fetch('languages', []) end |
#name ⇒ Object
10 11 12 |
# File 'lib/txgh/transifex_project.rb', line 10 def name config['name'] end |
#organization ⇒ Object
14 15 16 |
# File 'lib/txgh/transifex_project.rb', line 14 def organization config['organization'] end |
#protected_branches ⇒ Object
22 23 24 25 26 27 |
# File 'lib/txgh/transifex_project.rb', line 22 def protected_branches @protected_branches ||= (config['protected_branches'] || '').split(',').map do |branch| Utils.absolute_branch(branch.strip) end end |
#serialization_options ⇒ Object
45 46 47 |
# File 'lib/txgh/transifex_project.rb', line 45 def config['serialization_options'] end |
#supported_language?(language) ⇒ Boolean
49 50 51 |
# File 'lib/txgh/transifex_project.rb', line 49 def supported_language?(language) languages.include?(language) end |
#tx_config_uri ⇒ Object
37 38 39 |
# File 'lib/txgh/transifex_project.rb', line 37 def tx_config_uri config['tx_config'] end |
#webhook_protected? ⇒ Boolean
29 30 31 |
# File 'lib/txgh/transifex_project.rb', line 29 def webhook_protected? !(webhook_secret || '').empty? end |
#webhook_secret ⇒ Object
18 19 20 |
# File 'lib/txgh/transifex_project.rb', line 18 def webhook_secret config['webhook_secret'] end |