Class: Io::Flow::V0::Models::LogoImage

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Logos should be rendered in a size that best fits the user’s device and viewport. Some images formats can be resized natively by UI applications, but others require separate image links for each one.

Defined Under Namespace

Modules: Types

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ LogoImage

Returns a new instance of LogoImage.



12619
12620
12621
12622
12623
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12619

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:discriminator], 'LogoImage')
  @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String)
end

Instance Attribute Details

#discriminatorObject (readonly)

Returns the value of attribute discriminator.



12617
12618
12619
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12617

def discriminator
  @discriminator
end

Class Method Details

.from_json(hash) ⇒ Object



12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12633

def LogoImage.from_json(hash)
  HttpClient::Preconditions.assert_class('hash', hash, Hash)
  discriminator = HttpClient::Helper.symbolize_keys(hash)[:discriminator].to_s.strip
  if discriminator.empty?
    raise "Union type[logo_image] requires a field named 'discriminator'"
  end
  case discriminator
    when Types::LOGO_IMAGE_SVG; LogoImageSvg.new(hash)
    when Types::LOGO_IMAGE_SET_STATIC; LogoImageSetStatic.new(hash)
    else LogoImageUndefinedType.new(:discriminator => discriminator)
  end
end

Instance Method Details

#subtype_to_hashObject



12625
12626
12627
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12625

def subtype_to_hash
  raise 'Cannot serialize an instance of logo_image directly - must use one of the specific types: logo_image_svg, logo_image_set_static'
end

#to_hashObject



12629
12630
12631
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12629

def to_hash
  subtype_to_hash.merge(:discriminator => @discriminator)
end