Module: Mingle4r::CommonClassMethods
- Included in:
- API::Attachment, API::Card, API::Comment, API::ExecuteMql, API::Murmur, API::Project, API::PropertyDefinition, API::Transition, API::User, API::Wiki
- Defined in:
- lib/mingle4r/common_class_methods.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
Returns the value of attribute password.
-
#site ⇒ Object
Returns the value of attribute site.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#collection_name ⇒ Object
collection name for the class in which this module is extended.
-
#collection_name=(collection_name) ⇒ Object
sets the collection name for the class in which this module is extended.
-
#element_name ⇒ Object
element name for the class in which this module is extended.
-
#element_name=(element_name) ⇒ Object
sets the elment name for the class in which this module is extended.
-
#find(*args) ⇒ Object
routes to active resource find.
-
#new(args = {}) ⇒ Object
creates an object of the class in which this module is extended.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth_id, *args, &block) ⇒ Object (private)
134 135 136 137 |
# File 'lib/mingle4r/common_class_methods.rb', line 134 def method_missing(meth_id, *args, &block) raise ResourceNotSetup.new("Site not set for #{name}.") unless @resource_class @resource_class.send(meth_id.to_sym, *args, &block) end |
Instance Attribute Details
#password ⇒ Object
Returns the value of attribute password.
5 6 7 |
# File 'lib/mingle4r/common_class_methods.rb', line 5 def password @password end |
#site ⇒ Object
Returns the value of attribute site.
5 6 7 |
# File 'lib/mingle4r/common_class_methods.rb', line 5 def site @site end |
#user ⇒ Object
Returns the value of attribute user.
5 6 7 |
# File 'lib/mingle4r/common_class_methods.rb', line 5 def user @user end |
Instance Method Details
#collection_name ⇒ Object
collection name for the class in which this module is extended
60 61 62 |
# File 'lib/mingle4r/common_class_methods.rb', line 60 def collection_name @collection_name || class_name.underscore.pluralize end |
#collection_name=(collection_name) ⇒ Object
sets the collection name for the class in which this module is extended
44 45 46 47 48 49 |
# File 'lib/mingle4r/common_class_methods.rb', line 44 def collection_name=(collection_name) if collection_name != self.collection_name @collection_name = collection_name end @collection_name end |
#element_name ⇒ Object
element name for the class in which this module is extended
65 66 67 |
# File 'lib/mingle4r/common_class_methods.rb', line 65 def element_name @element_name || class_name.underscore end |
#element_name=(element_name) ⇒ Object
sets the elment name for the class in which this module is extended
52 53 54 55 56 57 |
# File 'lib/mingle4r/common_class_methods.rb', line 52 def element_name=(element_name) if element_name != self.element_name @element_name = element_name end @element_name end |
#find(*args) ⇒ Object
routes to active resource find
74 75 76 77 78 |
# File 'lib/mingle4r/common_class_methods.rb', line 74 def find(*args) scope = args.slice!(0) = args.slice!(0) || {} @resource_class.find(scope, ) end |
#new(args = {}) ⇒ Object
creates an object of the class in which this module is extended
8 9 10 11 |
# File 'lib/mingle4r/common_class_methods.rb', line 8 def new(args = {}) # @resource_class ||= create_resource_class() # should this be commented @resource_class.new(args) end |