Class: ActiveRemote::Base

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Callbacks
Includes:
ActiveAttr::AttributeDefaults, ActiveAttr::Attributes, ActiveAttr::BasicModel, ActiveAttr::BlockInitialization, ActiveAttr::ChainableInitialization, ActiveAttr::Logger, ActiveAttr::MassAssignment, ActiveAttr::QueryAttributes, ActiveAttr::Serialization, ActiveModel::Validations::Callbacks, Association, AttributeDefaults, Attributes, Bulk, DSL, Dirty, Integration, Persistence, PrimaryKey, Publication, RPC, ScopeKeys, Search, Serialization, Typecasting, Validations
Defined in:
lib/active_remote/base.rb

Constant Summary

Constants included from Typecasting

Typecasting::TYPECASTER_MAP

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Validations

#save, #save!, #valid?

Methods included from Dirty

#disable_dirty_tracking, #enable_dirty_tracking, #reload, #save, #save!, #skip_dirty_tracking, #write_attribute

Methods included from Serialization

#add_errors, #add_errors_from_response, #serialize_records

Methods included from Search

#_active_remote_search, #reload

Methods included from ScopeKeys

#scope_key_hash, #scope_keys

Methods included from RPC

#rpc

Methods included from Publication

#_publishable_json_attributes, #_publishable_json_methods, #publishable_hash

Methods included from PrimaryKey

#primary_key

Methods included from Persistence

#delete, #delete!, #destroy, #destroy!, #has_errors?, #instantiate, #new_record?, #persisted?, #readonly!, #readonly?, #save, #save!, #success?, #update_attribute, #update_attributes, #update_attributes!

Methods included from Integration

#cache_key, #to_param

Methods included from Attributes

#attributes, #read_attribute, #write_attribute

Methods included from AttributeDefaults

#apply_defaults, #attribute_defaults

Constructor Details

#initializeBase

Returns a new instance of Base.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/active_remote/base.rb', line 63

def initialize(*)
  @attributes ||= begin
    attribute_names = self.class.attribute_names
    Hash[attribute_names.map { |key| [key, send(key)] }]
  end

  @new_record = true

  skip_dirty_tracking do
    run_callbacks :initialize do
      super
    end
  end
end

Instance Attribute Details

#last_requestObject (readonly)

Returns the value of attribute last_request.



59
60
61
# File 'lib/active_remote/base.rb', line 59

def last_request
  @last_request
end

#last_responseObject (readonly)

Returns the value of attribute last_response.



59
60
61
# File 'lib/active_remote/base.rb', line 59

def last_response
  @last_response
end

Instance Method Details

#freezeObject



78
79
80
# File 'lib/active_remote/base.rb', line 78

def freeze
  @attributes.freeze; self
end

#frozen?Boolean

Returns:



82
83
84
# File 'lib/active_remote/base.rb', line 82

def frozen?
  @attributes.frozen?
end