Class: Helium::Script

Inherits:
Resource show all
Defined in:
lib/helium/helium_script.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#id, #params, #type

Instance Method Summary collapse

Methods inherited from Resource

#==, all, all_path, #as_json, create, #created_at, #destroy, #eql?, find, #hash, initialize_from_path, #metadata, resource_name, #resource_name, #resource_path, singleton, #to_json, #update, #updated_at

Methods included from Utils

#datetime_to_iso, #kebab_case

Constructor Details

#initialize(opts = {}) ⇒ Script

Returns a new instance of Script.



6
7
8
9
10
# File 'lib/helium/helium_script.rb', line 6

def initialize(opts = {})
  super(opts)
  @name    = @params.dig('attributes', 'name')
  @digest  = @params.dig('meta', 'digest')
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/helium/helium_script.rb', line 4

def name
  @name
end

Instance Method Details

#contentObject



12
13
14
15
# File 'lib/helium/helium_script.rb', line 12

def content
  @content ||= @client.get(resource_path+'/content',
                           content_type: 'application/octet-stream').body
end