Class: RTrail::API
- Inherits:
-
Object
- Object
- RTrail::API
- Defined in:
- lib/rtrail/api.rb
Overview
High-level API for TestRail
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #cases(project_name, suite_name) ⇒ Object
-
#initialize(hostname, user, password) ⇒ API
constructor
A new instance of API.
- #project(project_name) ⇒ Object
-
#projects ⇒ Object
Convenience methods for commonly-accessed entities.
- #runs(project_name) ⇒ Object
- #suite(project_name, suite_name) ⇒ Object
Constructor Details
#initialize(hostname, user, password) ⇒ API
Returns a new instance of API.
8 9 10 11 12 13 14 15 |
# File 'lib/rtrail/api.rb', line 8 def initialize(hostname, user, password) url = hostname.gsub(/\/$/, '') + '/index.php?/api/v2/' @client = RTrail::Client.new(url, user, password) # FIXME: This is a bit hinky, but works well RTrail::Entity.client = @client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
16 17 18 |
# File 'lib/rtrail/api.rb', line 16 def client @client end |
Instance Method Details
#cases(project_name, suite_name) ⇒ Object
36 37 38 |
# File 'lib/rtrail/api.rb', line 36 def cases(project_name, suite_name) return suite(project_name, suite_name).cases end |
#project(project_name) ⇒ Object
24 25 26 |
# File 'lib/rtrail/api.rb', line 24 def project(project_name) return Project.by_name(project_name) end |
#projects ⇒ Object
Convenience methods for commonly-accessed entities
20 21 22 |
# File 'lib/rtrail/api.rb', line 20 def projects return Project.all end |
#runs(project_name) ⇒ Object
32 33 34 |
# File 'lib/rtrail/api.rb', line 32 def runs(project_name) return project(project_name).runs end |