Class: DatagroutConduit::Byok

Inherits:
Struct
  • Object
show all
Defined in:
lib/datagrout_conduit/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#discount_appliedObject

Returns the value of attribute discount_applied

Returns:

  • (Object)

    the current value of discount_applied



22
23
24
# File 'lib/datagrout_conduit/types.rb', line 22

def discount_applied
  @discount_applied
end

#discount_rateObject

Returns the value of attribute discount_rate

Returns:

  • (Object)

    the current value of discount_rate



22
23
24
# File 'lib/datagrout_conduit/types.rb', line 22

def discount_rate
  @discount_rate
end

#enabledObject

Returns the value of attribute enabled

Returns:

  • (Object)

    the current value of enabled



22
23
24
# File 'lib/datagrout_conduit/types.rb', line 22

def enabled
  @enabled
end

Class Method Details

.from_hash(hash) ⇒ Object



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

def self.from_hash(hash)
  return new(enabled: false, discount_applied: 0.0, discount_rate: 0.0) if hash.nil?

  hash = hash.transform_keys(&:to_s)
  new(
    enabled: hash["enabled"] || false,
    discount_applied: (hash["discount_applied"] || 0.0).to_f,
    discount_rate: (hash["discount_rate"] || 0.0).to_f
  )
end