Class: KiYoutrack::Api
- Inherits:
-
Object
- Object
- KiYoutrack::Api
- Defined in:
- lib/ki_youtrack/api.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(config = Kiseru::Config[:ki_youtrack]) ⇒ Api
constructor
A new instance of Api.
- #issue(id, opts = {}) ⇒ Object
Constructor Details
#initialize(config = Kiseru::Config[:ki_youtrack]) ⇒ Api
Returns a new instance of Api.
7 8 9 |
# File 'lib/ki_youtrack/api.rb', line 7 def initialize(config=Kiseru::Config[:ki_youtrack]) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/ki_youtrack/api.rb', line 5 def config @config end |
Instance Method Details
#issue(id, opts = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ki_youtrack/api.rb', line 11 def issue(id, opts = {}) config.ensure_present('login', 'password', 'subdomain', 'ssl') login = @config.read('login') password = @config.read('password') subdomain = @config.read('subdomain') ssl = @config.read('ssl') = @config.read('cached_auth_cookies') session = Session.new(login, password, subdomain, :ssl => ssl, :cookies => ) response = session.init issue = session.issue(id) @config.write('cached_auth_cookies', session..encode("UTF-8")) filtered_data = IssueFilter.filter(issue) MultiJson.dump(filtered_data, :pretty => opts[:pretty]) end |