Module: PartyResource::ClassMethods
- Includes:
- MethodDefine
- Defined in:
- lib/party_resource/party_resource.rb
Instance Method Summary collapse
-
#connect(name, options = {}) ⇒ nil
Connect a method call to a restful uri.
-
#party_connector(name) ⇒ nil
Set the name of the connector to use for this class.
-
#property(*names, options = {}) ⇒ nil
Define a property.
Instance Method Details
#connect(name, options = {}) ⇒ nil
Connect a method call to a restful uri
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/party_resource/party_resource.rb', line 60 def connect(name, ={}) level = .delete(:on) = {:as => :self, :connector => @party_connector}.merge() route = Route.new() define_method_on(level, name) do |*args| route.call(self, *args) end nil end |
#party_connector(name) ⇒ nil
Set the name of the connector to use for this class
127 128 129 130 |
# File 'lib/party_resource/party_resource.rb', line 127 def party_connector(name) @party_connector = name nil end |
#property(*names, options = {}) ⇒ nil
Define a property
109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/party_resource/party_resource.rb', line 109 def property(*names) = names.pop if names.last.is_a?(Hash) names.each do |name| name = name.to_sym define_method name do get_property(name) end @property_list ||= [] @property_list << Property.new(name, ) end nil end |