class JsonApiModel::Model
Constants
- RESERVED_FIELDS
Attributes
client_class[R]
client[RW]
Public Class Methods
connection( &block )
click to toggle source
# File lib/json_api_model/model.rb, line 17 def connection( &block ) client_class.connection true, &block end
method_missing( m, *args, &block )
click to toggle source
# File lib/json_api_model/model.rb, line 21 def method_missing( m, *args, &block ) result = client_class.send m, *args, &block case result when JsonApiClient::ResultSet JsonApiModel::ResultSet.new( result, self ) when client_class new_from_client result else result end rescue NoMethodError raise NoMethodError, "No method `#{m}' found in #{self} or #{client_class}" end
new( attributes = {} )
click to toggle source
# File lib/json_api_model/model.rb, line 47 def initialize( attributes = {} ) @client = self.class.client_class.new( attributes ) end
new_from_client( client )
click to toggle source
# File lib/json_api_model/model.rb, line 11 def new_from_client( client ) model = new model.client = client model end
wraps( client_class )
click to toggle source
# File lib/json_api_model/model.rb, line 7 def wraps( client_class ) @client_class = client_class end
Private Class Methods
__new_scope()
click to toggle source
# File lib/json_api_model/model.rb, line 37 def __new_scope Scope.new( self ) end
Public Instance Methods
method_missing( m, *args, &block )
click to toggle source
# File lib/json_api_model/model.rb, line 51 def method_missing( m, *args, &block ) client.send m, *args, &block rescue NoMethodError raise NoMethodError, "No method `#{m}' found in #{self} or #{client}" end