Class: Agree2::Agreement
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#finalize! ⇒ Object
Finalize marks a draft agreement as being ready to accept.
-
#parties ⇒ Object
Returns the parties to the agreement.
- #parties=(values) ⇒ Object
-
#respond_to?(symbol, include_priv = false) ⇒ Boolean
:nodoc:.
-
#to_param ⇒ Object
:nodoc:.
Methods inherited from Base
attr_serializable, #attributes, collection_name, collection_path, #destroy, get, #initialize, instance_path, #new_record?, #path, #reload, #save, serializable_attributes, singular_name, #to_url
Constructor Details
This class inherits a constructor from Agree2::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (protected)
:nodoc:
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/agree2/agreement.rb', line 49 def method_missing(method, *args, &block) #:nodoc: return super(method, *args, &block) if fields.nil?||fields.empty? method=method.to_s if method=~/(.+)=$/ field=$1 setter=true else field=method setter=false end if fields.has_key?(field) if setter fields[field]=args.first else fields[field] end else super method, *args, &block end end |
Instance Method Details
#finalize! ⇒ Object
Finalize marks a draft agreement as being ready to accept
35 36 37 |
# File 'lib/agree2/agreement.rb', line 35 def finalize! user.post(path+"/finalize")==" " end |
#parties ⇒ Object
Returns the parties to the agreement
8 9 10 |
# File 'lib/agree2/agreement.rb', line 8 def parties @parties||=Agree2::ProxyCollection.new self,"#{self.path}/parties",'Party' end |
#parties=(values) ⇒ Object
12 13 14 |
# File 'lib/agree2/agreement.rb', line 12 def parties=(values) @parties=Agree2::ProxyCollection.new self,"#{self.path}/parties",'Party',values end |
#respond_to?(symbol, include_priv = false) ⇒ Boolean
:nodoc:
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/agree2/agreement.rb', line 20 def respond_to?(symbol, include_priv = false) #:nodoc: return true if super symbol,include_priv return false if fields.nil?||fields.empty? method=symbol.to_s if method=~/(.+)=$/ field=$1 setter=true else field=method setter=false end fields.has_key?(field) end |
#to_param ⇒ Object
:nodoc:
16 17 18 |
# File 'lib/agree2/agreement.rb', line 16 def to_param #:nodoc: permalink end |