Class: FdxV660Api::CardArtEntity

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/card_art_entity.rb

Overview

Art associated with the card

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(label: SKIP, image_uri: SKIP, additional_properties: nil) ⇒ CardArtEntity

Returns a new instance of CardArtEntity.



47
48
49
50
51
52
53
54
# File 'lib/fdx_v660_api/models/card_art_entity.rb', line 47

def initialize(label: SKIP, image_uri: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @label = label unless label == SKIP
  @image_uri = image_uri unless image_uri == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#image_uriString

The URI link of a PNG, JPG or GIF image with proportions defined by ISO 8710 ID-1 with 340x210 ratio and width no greater than 512 pixels. The image at this URI must be accessible at all times, with no additional authentication headers. Typically this is an image resource located in the data provider's public web site or Content Delivery Network

Returns:

  • (String)


24
25
26
# File 'lib/fdx_v660_api/models/card_art_entity.rb', line 24

def image_uri
  @image_uri
end

#labelString

Display label for the specific image

Returns:

  • (String)


14
15
16
# File 'lib/fdx_v660_api/models/card_art_entity.rb', line 14

def label
  @label
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/fdx_v660_api/models/card_art_entity.rb', line 57

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  label = hash.key?('label') ? hash['label'] : SKIP
  image_uri = hash.key?('imageUri') ? hash['imageUri'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  CardArtEntity.new(label: label,
                    image_uri: image_uri,
                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



27
28
29
30
31
32
# File 'lib/fdx_v660_api/models/card_art_entity.rb', line 27

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['label'] = 'label'
  @_hash['image_uri'] = 'imageUri'
  @_hash
end

.nullablesObject

An array for nullable fields



43
44
45
# File 'lib/fdx_v660_api/models/card_art_entity.rb', line 43

def self.nullables
  []
end

.optionalsObject

An array for optional fields



35
36
37
38
39
40
# File 'lib/fdx_v660_api/models/card_art_entity.rb', line 35

def self.optionals
  %w[
    label
    image_uri
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



85
86
87
88
89
# File 'lib/fdx_v660_api/models/card_art_entity.rb', line 85

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} label: #{@label.inspect}, image_uri: #{@image_uri.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



78
79
80
81
82
# File 'lib/fdx_v660_api/models/card_art_entity.rb', line 78

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} label: #{@label}, image_uri: #{@image_uri}, additional_properties:"\
  " #{@additional_properties}>"
end