Class: Jiralicious::CustomFieldOption

Inherits:
Base
  • Object
show all
Defined in:
lib/jiralicious/custom_field_option.rb

Overview

The CustomFieldOption provides a list of available custom field options. This method is used in lazy loading and can be used to validate options prior to updating the issue.

Instance Attribute Summary

Attributes inherited from Base

#loaded

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#all, #endpoint_name, fetch, find_all, handler, issueKey_test, #loaded?, #method_missing, #numeric?, #parent_name, parent_name, #properties_from_hash, #reload

Methods included from Parsers::FieldParser

#parse!

Constructor Details

#initialize(decoded_json) ⇒ CustomFieldOption

Initialization Method

Arguments

:decoded_json (optional) rubyized json object



16
17
18
19
20
21
22
23
24
# File 'lib/jiralicious/custom_field_option.rb', line 16

def initialize(decoded_json)
  @loaded = false
  if decoded_json.is_a? Hash
    properties_from_hash(decoded_json)
    super(decoded_json)
    parse!(decoded_json)
    @loaded = true
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Jiralicious::Base

Class Method Details

.endpoint_nameObject

Overrides the auto-generated endpoint_name from Base. This is necessary due to lower camel case naming convention.



31
32
33
# File 'lib/jiralicious/custom_field_option.rb', line 31

def endpoint_name
  "customFieldOption"
end

.find(id, options = {}) ⇒ Object

Retrieves the options based on the ID



38
39
40
41
42
# File 'lib/jiralicious/custom_field_option.rb', line 38

def find(id, options = {})
  response = fetch({:key => id})
  response.parsed_response['id'] = id
  new(response.parsed_response)
end