Class: ZohoHub::Settings::Field

Inherits:
Object
  • Object
show all
Includes:
WithAttributes, WithConnection
Defined in:
lib/zoho_hub/settings/field.rb

Constant Summary collapse

REQUEST_PATH =
'settings/fields'

Class Method Summary collapse

Instance Method Summary collapse

Methods included from WithAttributes

#assign_attributes, #attributes, included

Methods included from WithConnection

#delete, #get, included, #post, #put

Constructor Details

#initialize(json = {}) ⇒ Field

Returns a new instance of Field.



28
29
30
# File 'lib/zoho_hub/settings/field.rb', line 28

def initialize(json = {})
  attributes.each { |attr| send("#{attr}=", json[attr]) }
end

Class Method Details

.all_for(module_name) ⇒ Object



18
19
20
21
# File 'lib/zoho_hub/settings/field.rb', line 18

def self.all_for(module_name)
  fields = all_json_for(module_name)
  fields.map { |json| new(json) }
end

.all_json_for(module_name) ⇒ Object



23
24
25
26
# File 'lib/zoho_hub/settings/field.rb', line 23

def self.all_json_for(module_name)
  response = get(REQUEST_PATH, module: module_name)
  response[:fields]
end