Module: Trackman::Assets::Persistence::Remote

Included in:
RemoteAsset
Defined in:
lib/trackman/assets/persistence/remote.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



8
9
10
# File 'lib/trackman/assets/persistence/remote.rb', line 8

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#deleteObject



47
48
49
50
# File 'lib/trackman/assets/persistence/remote.rb', line 47

def delete
  response = RestClient.delete "#{self.class.site}/#{id}"
  true
end

#insertObject



37
38
39
40
41
# File 'lib/trackman/assets/persistence/remote.rb', line 37

def insert
  response = RestClient.post self.class.site, build_params, :content_type => :json, :accept => :json, :ssl_version => 'SSLv3'
  path = response.headers[:location]
  @id = path[/\d+$/].to_i
end

#updateObject



43
44
45
# File 'lib/trackman/assets/persistence/remote.rb', line 43

def update
  RestClient.put "#{self.class.site}/#{id}", build_params, :content_type => :json, :accept => :json, :ssl_version => 'SSLv3'
end