Module: ThreeScale::Core::APIClient::Attributes
- Included in:
- Resource
- Defined in:
- lib/3scale/core/api_client/attributes.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #attributes ⇒ Object (also: #to_hash)
- #dirty? ⇒ Boolean
- #update_attributes(attributes) ⇒ Object
Class Method Details
.included(base) ⇒ Object
7 8 9 |
# File 'lib/3scale/core/api_client/attributes.rb', line 7 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#attributes ⇒ Object Also known as: to_hash
11 12 13 14 15 16 17 |
# File 'lib/3scale/core/api_client/attributes.rb', line 11 def attributes attrs = {} self.class.attributes.each do |attr| attrs[attr] = send(attr) end attrs end |
#dirty? ⇒ Boolean
27 28 29 |
# File 'lib/3scale/core/api_client/attributes.rb', line 27 def dirty? @dirty end |
#update_attributes(attributes) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/3scale/core/api_client/attributes.rb', line 20 def update_attributes(attributes) self.class.attributes.each do |attr| send("#{attr}=", attributes[attr]) end self end |