Class: Travis::Client::Settings

Inherits:
WeakEntity show all
Defined in:
lib/travis/client/settings.rb

Constant Summary

Constants inherited from Entity

Entity::MAP

Instance Attribute Summary collapse

Attributes inherited from Entity

#attributes, #curry, #id, #session

Instance Method Summary collapse

Methods inherited from WeakEntity

cast_id, id?, id_field, weak?

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

#build_pull_requestsObject (readonly)

Returns the value of attribute build_pull_requests.



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

def build_pull_requests
  @build_pull_requests
end

#build_pushesObject (readonly)

Returns the value of attribute build_pushes.



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

def build_pushes
  @build_pushes
end

#builds_only_with_travis_ymlObject (readonly)

Returns the value of attribute builds_only_with_travis_yml.



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

def builds_only_with_travis_yml
  @builds_only_with_travis_yml
end

#maximum_number_of_buildsObject (readonly)

Returns the value of attribute maximum_number_of_builds.



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

def maximum_number_of_builds
  @maximum_number_of_builds
end

#repositoryObject

Returns the value of attribute repository.



7
8
9
# File 'lib/travis/client/settings.rb', line 7

def repository
  @repository
end

Instance Method Details

#inspect_infoObject



20
21
22
# File 'lib/travis/client/settings.rb', line 20

def inspect_info
  repository ? repository.slug : repository
end

#saveObject



13
14
15
16
17
18
# File 'lib/travis/client/settings.rb', line 13

def save
  raise "repository unknown" unless repository
  result = session.patch("/repos/#{repository.id}/settings", JSON.dump("settings" => attributes))
  attributes.replace(result['settings'].attributes)
  self
end