Class: GoApiClient::Api::Properties
- Inherits:
-
AbstractApi
- Object
- GoApiClient::AttributeHelper
- AbstractApi
- GoApiClient::Api::Properties
- Defined in:
- lib/go_api_client/api/properties.rb
Instance Method Summary collapse
- #create_property(options = {}) ⇒ Object
-
#initialize(attributes = {}) ⇒ Properties
constructor
A new instance of Properties.
- #properties(options = {}) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Properties
7 8 9 |
# File 'lib/go_api_client/api/properties.rb', line 7 def initialize(attributes = {}) super(attributes) end |
Instance Method Details
#create_property(options = {}) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/go_api_client/api/properties.rb', line 29 def create_property( = {}) = ({:properties_uri => nil, :pipeline_name => nil, :pipeline_counter => nil, :stage_name => nil, :stage_counter => nil, :job_name => nil, :property_name => nil, :property_value => nil}).merge() if [:properties_uri] uri = [:properties_uri] else raise 'Insufficient arguments' unless [:pipeline_name] && [:pipeline_counter] && [:stage_name] && [:stage_counter] && [:job_name] && [:property_name] && [:property_value] uri = "#{@base_uri}/properties/#{options[:pipeline_name]}/#{options[:pipeline_counter]}/#{options[:stage_name]}/#{options[:stage_counter]}/#{options[:job_name]}/#{options[:property_name]}" end response_body = @http_fetcher.post!(uri, {:params => {:value => [:property_value]}}) response_body == "Property '#{options[:property_name]}' created with value '#{options[:property_value]}'" ? true : false end |
#properties(options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/go_api_client/api/properties.rb', line 11 def properties( = {}) = ({:properties_uri => nil, :pipeline_name => nil, :pipeline_counter => nil, :stage_name => nil, :stage_counter => nil, :job_name => nil, :property_name => nil}).merge() if [:properties_uri] uri = [:properties_uri] else raise 'Insufficient arguments' unless [:pipeline_name] && [:pipeline_counter] && [:stage_name] && [:stage_counter] && [:job_name] uri = "#{@base_uri}/properties/#{options[:pipeline_name]}/#{options[:pipeline_counter]}/#{options[:stage_name]}/#{options[:stage_counter]}/#{options[:job_name]}" + ([:property_name] ? "/#{options[:property_name]}" : '') end begin body = @http_fetcher.get!(uri) rescue GoApiClient::HttpFetcher::HttpError # ignore, error message will be logged end body ? CSV.new(body, :headers => true).to_a.map { |row| row.to_hash } : [] end |