Class: StrawberryAPI::CustomMetadatum

Inherits:
Object
  • Object
show all
Defined in:
lib/strawberry_api/custom_metadatum.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ CustomMetadatum

Returns a new instance of CustomMetadatum



12
13
14
15
16
17
18
19
20
21
# File 'lib/strawberry_api/custom_metadatum.rb', line 12

def initialize(params = {})
  params.each do |k, v|
    if k == 'custom_metadata_field'
      k = 'custom_metadata_field_name'
      v = v['name']
    end
    
    instance_variable_set("@#{k}", v) unless v.nil?
  end
end

Instance Attribute Details

#asset_idObject

Returns the value of attribute asset_id



6
7
8
# File 'lib/strawberry_api/custom_metadatum.rb', line 6

def asset_id
  @asset_id
end

#custom_metadata_field_idObject

Returns the value of attribute custom_metadata_field_id



7
8
9
# File 'lib/strawberry_api/custom_metadatum.rb', line 7

def 
  @custom_metadata_field_id
end

#custom_metadata_field_nameObject

Returns the value of attribute custom_metadata_field_name



8
9
10
# File 'lib/strawberry_api/custom_metadatum.rb', line 8

def 
  @custom_metadata_field_name
end

#project_idObject

Returns the value of attribute project_id



5
6
7
# File 'lib/strawberry_api/custom_metadatum.rb', line 5

def project_id
  @project_id
end

#safe_searchObject

Returns the value of attribute safe_search



10
11
12
# File 'lib/strawberry_api/custom_metadatum.rb', line 10

def safe_search
  @safe_search
end

#valueObject

Returns the value of attribute value



9
10
11
# File 'lib/strawberry_api/custom_metadatum.rb', line 9

def value
  @value
end

Class Method Details

.filthify(custom_metadata:) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/strawberry_api/custom_metadatum.rb', line 23

def self.filthify(custom_metadata:)
  filthy_hash = Hash.new

  .each_with_index do |(key, val), i|
    filthy_hash["custom_metadata[#{i}][custom_metadata_field]"] = key
    filthy_hash["custom_metadata[#{i}][value]"] = val
  end

  return filthy_hash
end