Class: HermesAPI::PrintInStoreQrCode

Inherits:
JsonBase
  • Object
show all
Defined in:
lib/hermes_api/resources/print_in_store_qr_code.rb

Instance Method Summary collapse

Methods inherited from JsonBase

inherited, #to_json

Instance Method Details

#load(attributes, remove_root = false, persisted = false) ⇒ Object



6
7
8
9
10
# File 'lib/hermes_api/resources/print_in_store_qr_code.rb', line 6

def load(attributes, remove_root = false, persisted = false)
  # remove the outer array before parsing the response body
  attributes = attributes[0] if attributes.is_a?(Array) && attributes.length == 1
  super
end

#qr_code_imageObject



12
13
14
15
# File 'lib/hermes_api/resources/print_in_store_qr_code.rb', line 12

def qr_code_image
  base64_data = as_json.dig("qr_code", "base64_encoded_bytes")
  Base64.decode64(base64_data) if base64_data
end