Class: Redmine::Base
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- Redmine::Base
- Defined in:
- lib/redmine/base.rb
Direct Known Subclasses
Constant Summary collapse
- DEFAULTS =
{}
Class Method Summary collapse
Instance Method Summary collapse
- #encode(options = {}) ⇒ Object
-
#initialize(attributes = {}, persisted = false) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(attributes = {}, persisted = false) ⇒ Base
Returns a new instance of Base.
8 9 10 11 12 13 14 15 |
# File 'lib/redmine/base.rb', line 8 def initialize(attributes = {}, persisted = false) self.class.site = Redmine.configuration.site attributes.merge!(self.class::DEFAULTS) attributes.merge!(Redmine.configuration.resources[self.class.element_name.to_sym] || {}) super(attributes, persisted) end |
Class Method Details
.headers ⇒ Object
17 18 19 20 21 22 |
# File 'lib/redmine/base.rb', line 17 def self.headers new_headers = static_headers.clone new_headers["X-Redmine-API-Key"] = Redmine.configuration.api_key new_headers end |
Instance Method Details
#encode(options = {}) ⇒ Object
24 25 26 |
# File 'lib/redmine/base.rb', line 24 def encode(={}) send("to_#{self.class.format.extension}", ) end |