Class: Travis::Client::EnvVar

Inherits:
Entity
  • Object
show all
Extended by:
HasUuid
Includes:
NotLoadable
Defined in:
lib/travis/client/env_var.rb

Defined Under Namespace

Classes: List

Constant Summary

Constants inherited from Entity

Travis::Client::Entity::MAP

Instance Attribute Summary collapse

Attributes inherited from Entity

#attributes, #curry, #id, #session

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HasUuid

cast_id, id?

Methods included from NotLoadable

#complete?, #missing?

Methods inherited from Entity

#[], #[]=, aka, #attribute_names, attributes, base_path, #cancelable?, cast_id, #complete?, has, has_singleton, id?, id_field, #include?, #initialize, #inspect, inspect_info, #load, many, #missing?, one, preloadable, preloadable?, relations, #relations, #reload, #restartable?, subclass_for, subclasses, time, #to_h, #update_attributes, weak?

Constructor Details

This class inherits a constructor from Travis::Client::Entity

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name


1
2
3
# File 'lib/travis/client/env_var.rb', line 1

def name
  @name
end

#publicObject (readonly)

Returns the value of attribute public


1
2
3
# File 'lib/travis/client/env_var.rb', line 1

def public
  @public
end

#repositoryObject (readonly)

Returns the value of attribute repository


1
2
3
# File 'lib/travis/client/env_var.rb', line 1

def repository
  @repository
end

#repository_idObject (readonly)

Returns the value of attribute repository_id


1
2
3
# File 'lib/travis/client/env_var.rb', line 1

def repository_id
  @repository_id
end

Class Method Details

.path(object) ⇒ Object


67
68
69
70
71
# File 'lib/travis/client/env_var.rb', line 67

def self.path(object)
  repository_id = Repository === object ? object.id : object.repository_id
  raise "repository unknown" unless repository_id
  "/settings/env_vars/#{object.id if object.is_a? EnvVar}?repository_id=#{repository_id}"
end

Instance Method Details

#deleteObject


91
92
93
94
95
# File 'lib/travis/client/env_var.rb', line 91

def delete
  session.delete_raw EnvVar.path(self)
  repository.env_vars.reload
  true
end

#inspect_infoObject


97
98
99
# File 'lib/travis/client/env_var.rb', line 97

def inspect_info
  "#{name}=#{value ? value.inspect : "[secure]"}"
end

#update(options) ⇒ Object


84
85
86
87
88
89
# File 'lib/travis/client/env_var.rb', line 84

def update(options)
  options = { :value => options } unless options.is_a? Hash
  result  = session.patch(EnvVar.path(self), JSON.dump(:env_var => options))
  attributes.replace(result['env_var'].attributes)
  self
end