class Redmine::Client

Attributes

api[RW]
token[RW]
url[RW]

Public Class Methods

new(url, token) click to toggle source
# File lib/redmine-ruby.rb, line 17
def initialize(url, token)
  self.url    = url
  self.token  = token
  self.api = Her::API.new
  self.api.setup url: url, ssl: { verify: false } do |c|
    c.use Faraday::Request::BasicAuthentication, token, ''
    c.use Faraday::Request::UrlEncoded
    c.use Redmine::Middleware::XmlParser
    c.use Faraday::Adapter::NetHttp
  end
end

Public Instance Methods

issues() click to toggle source
# File lib/redmine-ruby.rb, line 46
def issues
  resource(:issue)
end
projects() click to toggle source
# File lib/redmine-ruby.rb, line 42
def projects
  resource(:project)
end
resource(name, options={}) click to toggle source
# File lib/redmine-ruby.rb, line 29
def resource(name, options={})
  klass   = "Redmine::#{name.to_s.classify}".constantize
  the_api = api
  the_token = token
  Class.new(klass) do |c|
    c.uses_api        the_api
    c.api_token       the_token
    c.element_name    name.to_s.underscore.to_sym
    c.collection_path klass.collection_path
    c.resource_path   klass.resource_path
  end
end
time_entries() click to toggle source
# File lib/redmine-ruby.rb, line 54
def time_entries
  resource(:time_entry)
end
uploads() click to toggle source
# File lib/redmine-ruby.rb, line 50
def uploads
  resource(:upload)
end