Module: ActiveRemote::DSL::ClassMethods
- Defined in:
- lib/active_remote/dsl.rb
Instance Method Summary collapse
- 
  
    
      #attr_publishable(*attributes)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Whitelist enable attributes for serialization purposes. 
- #endpoint_for_create(endpoint) ⇒ Object
- #endpoint_for_delete(endpoint) ⇒ Object
- #endpoint_for_destroy(endpoint) ⇒ Object
- #endpoint_for_search(endpoint) ⇒ Object
- #endpoint_for_update(endpoint) ⇒ Object
- #endpoints(endpoints_hash = nil) ⇒ Object
- 
  
    
      #namespace(name = false)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Set the namespace for the underlying RPC service class. 
- 
  
    
      #publishable_attributes  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Retrieve the attributes that have been whitelisted for serialization. 
- 
  
    
      #service_class(klass = false)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Set the RPC service class directly. 
- 
  
    
      #service_name(name = false)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Set the name of the underlying RPC service class. 
Instance Method Details
#attr_publishable(*attributes) ⇒ Object
Whitelist enable attributes for serialization purposes.
Examples
# To only publish the :guid and :status attributes:
class User < ActiveRemote::Base
  attr_publishable :guid, :status
end
| 17 18 19 20 | # File 'lib/active_remote/dsl.rb', line 17 def attr_publishable(*attributes) @publishable_attributes ||= [] @publishable_attributes += attributes end | 
#endpoint_for_create(endpoint) ⇒ Object
| 22 23 24 | # File 'lib/active_remote/dsl.rb', line 22 def endpoint_for_create(endpoint) endpoints :create => endpoint end | 
#endpoint_for_delete(endpoint) ⇒ Object
| 26 27 28 | # File 'lib/active_remote/dsl.rb', line 26 def endpoint_for_delete(endpoint) endpoints :delete => endpoint end | 
#endpoint_for_destroy(endpoint) ⇒ Object
| 30 31 32 | # File 'lib/active_remote/dsl.rb', line 30 def endpoint_for_destroy(endpoint) endpoints :destroy => endpoint end | 
#endpoint_for_search(endpoint) ⇒ Object
| 34 35 36 | # File 'lib/active_remote/dsl.rb', line 34 def endpoint_for_search(endpoint) endpoints :search => endpoint end | 
#endpoint_for_update(endpoint) ⇒ Object
| 38 39 40 | # File 'lib/active_remote/dsl.rb', line 38 def endpoint_for_update(endpoint) endpoints :update => endpoint end | 
#endpoints(endpoints_hash = nil) ⇒ Object
| 42 43 44 45 46 47 48 49 50 51 52 | # File 'lib/active_remote/dsl.rb', line 42 def endpoints(endpoints_hash = nil) @endpoints ||= { :create => :create, :delete => :delete, :destroy => :destroy, :search => :search, :update => :update } @endpoints.merge!(endpoints_hash) if endpoints_hash.present? @endpoints end | 
#namespace(name = false) ⇒ Object
Set the namespace for the underlying RPC service class. If no namespace is given, then none will be used.
Examples
# If the user's service class is namespaced (e.g. Acme::UserService):
class User < ActiveRemote::Base
  namespace :acme
end
| 64 65 66 67 | # File 'lib/active_remote/dsl.rb', line 64 def namespace(name = false) @namespace = name unless name == false @namespace end | 
#publishable_attributes ⇒ Object
Retrieve the attributes that have been whitelisted for serialization.
| 71 72 73 | # File 'lib/active_remote/dsl.rb', line 71 def publishable_attributes @publishable_attributes end | 
#service_class(klass = false) ⇒ Object
Set the RPC service class directly. By default, ActiveRemote determines the RPC service by constantizing the namespace and service name.
Examples
class User < ActiveRemote::Base
  service_class Acme::UserService
end
# ...is the same as:
class User < ActiveRemote::Base
  namespace :acme
  service_name :user_service
end
# ...is the same as:
class User < ActiveRemote::Base
  namespace :acme
end
| 97 98 99 100 | # File 'lib/active_remote/dsl.rb', line 97 def service_class(klass = false) @service_class = klass unless klass == false @service_class ||= _determine_service_class end | 
#service_name(name = false) ⇒ Object
Set the name of the underlying RPC service class. By default, Active Remote assumes that a User model will have a UserService (making the service name :user_service).
Examples
class User < ActiveRemote::Base
  service_name :jangly_users
end
| 112 113 114 115 | # File 'lib/active_remote/dsl.rb', line 112 def service_name(name = false) @service_name = name unless name == false @service_name ||= _determine_service_name end |