Class: Vng::SystemOption

Inherits:
Resource show all
Defined in:
lib/vng/system_option.rb

Overview

Provides methods to interact with Vonigo system fields’ options.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, name:) ⇒ SystemOption

Returns a new instance of SystemOption.



6
7
8
9
# File 'lib/vng/system_option.rb', line 6

def initialize(id:, name:)
  @id = id
  @name = name
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/vng/system_option.rb', line 4

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/vng/system_option.rb', line 4

def name
  @name
end

Class Method Details

.for_system_field_id(system_field_id, options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/vng/system_option.rb', line 11

def self.for_system_field_id(system_field_id, options = {})
  options.lazy.filter_map do |option|
    next unless active?(option)

    if option['fieldID'].eql? system_field_id
      new id: option['optionID'], name: option['name']
    end
  end # TODO: make this thing respond to find_by(name:)
end