Module: Apiway::Resource::InstanceMethods
- Defined in:
- lib/apiway/resource.rb
Instance Method Summary collapse
- #initialize(id, client) ⇒ Object
- #set_params(params = {}) ⇒ Object
- #sync ⇒ Object
- #sync_changes(changed_models) ⇒ Object
Instance Method Details
#initialize(id, client) ⇒ Object
40 41 42 43 |
# File 'lib/apiway/resource.rb', line 40 def initialize( id, client ) @id = id @client = client end |
#set_params(params = {}) ⇒ Object
45 46 47 48 49 |
# File 'lib/apiway/resource.rb', line 45 def set_params( params = {} ) @params = params @current_error = nil self end |
#sync ⇒ Object
55 56 57 58 59 60 61 62 63 |
# File 'lib/apiway/resource.rb', line 55 def sync begin instance_eval &self.class.access rescue ResourceError => e sync_error e.params else sync_data instance_eval &self.class.data end end |
#sync_changes(changed_models) ⇒ Object
51 52 53 |
# File 'lib/apiway/resource.rb', line 51 def sync_changes( changed_models ) sync if self.class.depend_on.any? { |dependency| changed_models.include? dependency } end |