Class: Semaph::Model::Project
- Inherits:
-
Object
- Object
- Semaph::Model::Project
- Defined in:
- lib/semaph/model/project.rb
Constant Summary collapse
- GITHUB_REGGEXP =
%r{[email protected]:(.*)/(.*).git}
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #github_url ⇒ Object
-
#initialize(client, raw) ⇒ Project
constructor
A new instance of Project.
- #workflow_collection ⇒ Object
Constructor Details
#initialize(client, raw) ⇒ Project
Returns a new instance of Project.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/semaph/model/project.rb', line 10 def initialize(client, raw) @client = client @raw = raw @id = raw["metadata"]["id"] @name = raw["metadata"]["name"] repo = raw["spec"]["repository"]["url"] match = GITHUB_REGGEXP.match(repo) return unless match @repo_owner = match[1] @repo_name = match[2] end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
8 9 10 |
# File 'lib/semaph/model/project.rb', line 8 def client @client end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/semaph/model/project.rb', line 8 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/semaph/model/project.rb', line 8 def name @name end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
8 9 10 |
# File 'lib/semaph/model/project.rb', line 8 def raw @raw end |
Instance Method Details
#github_url ⇒ Object
23 24 25 26 27 |
# File 'lib/semaph/model/project.rb', line 23 def github_url return nil unless @repo_owner && @repo_name "https://github.com/#{@repo_owner}/#{@repo_name}" end |
#workflow_collection ⇒ Object
29 30 31 |
# File 'lib/semaph/model/project.rb', line 29 def workflow_collection @workflow_collection ||= WorkflowCollection.new(self) end |