Module: Rhoconnect::Resource::InstanceMethods
- Defined in:
- lib/rhoconnect/resource.rb
Instance Attribute Summary collapse
-
#skip_rhoconnect_callbacks ⇒ Object
Returns the value of attribute skip_rhoconnect_callbacks.
Instance Method Summary collapse
- #get_partition ⇒ Object
-
#normalized_attributes ⇒ Object
Return Rhoconnect-friendly attributes list.
-
#rhoconnect_apply_attributes(partition, attributes) ⇒ Object
By default we ignore partition TODO: Document - this is user-facing function.
- #rhoconnect_create ⇒ Object
- #rhoconnect_destroy ⇒ Object
- #rhoconnect_query(partition) ⇒ Object
- #rhoconnect_update ⇒ Object
Instance Attribute Details
#skip_rhoconnect_callbacks ⇒ Object
Returns the value of attribute skip_rhoconnect_callbacks.
41 42 43 |
# File 'lib/rhoconnect/resource.rb', line 41 def skip_rhoconnect_callbacks @skip_rhoconnect_callbacks end |
Instance Method Details
#get_partition ⇒ Object
43 44 45 46 |
# File 'lib/rhoconnect/resource.rb', line 43 def get_partition @partition = partition @partition.is_a?(Proc) ? @partition.call : @partition end |
#normalized_attributes ⇒ Object
Return Rhoconnect-friendly attributes list
71 72 73 74 75 76 77 |
# File 'lib/rhoconnect/resource.rb', line 71 def normalized_attributes attribs = self.attributes.dup attribs.each do |key,value| attribs[key] = Time.parse(value.to_s).to_i.to_s if value.is_a?(Time) or value.is_a?(DateTime) end if Rhoconnect.configuration.sync_time_as_int attribs end |
#rhoconnect_apply_attributes(partition, attributes) ⇒ Object
By default we ignore partition TODO: Document - this is user-facing function
66 67 68 |
# File 'lib/rhoconnect/resource.rb', line 66 def rhoconnect_apply_attributes(partition, attributes) self.attributes = attributes end |
#rhoconnect_create ⇒ Object
48 49 50 |
# File 'lib/rhoconnect/resource.rb', line 48 def rhoconnect_create call_client_method(:create) end |
#rhoconnect_destroy ⇒ Object
52 53 54 |
# File 'lib/rhoconnect/resource.rb', line 52 def rhoconnect_destroy call_client_method(:destroy) end |
#rhoconnect_query(partition) ⇒ Object
60 61 62 |
# File 'lib/rhoconnect/resource.rb', line 60 def rhoconnect_query(partition) #return all objects for this partition end |
#rhoconnect_update ⇒ Object
56 57 58 |
# File 'lib/rhoconnect/resource.rb', line 56 def rhoconnect_update call_client_method(:update) end |