Class: WalmartApIs::DocumentDownload
- Defined in:
- lib/walmart_ap_is/models/document_download.rb
Overview
Resource to download the requested document.
Instance Attribute Summary collapse
-
#download_type ⇒ String
The type of download.
-
#expiration ⇒ DateTime
The URI's expiration time.
-
#uri ⇒ String
Uniform resource identifier to identify where the document is located.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(download_type:, uri:, expiration: SKIP, additional_properties: nil) ⇒ DocumentDownload
constructor
A new instance of DocumentDownload.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_expiration ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(download_type:, uri:, expiration: SKIP, additional_properties: nil) ⇒ DocumentDownload
Returns a new instance of DocumentDownload.
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/walmart_ap_is/models/document_download.rb', line 47 def initialize(download_type:, uri:, expiration: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @download_type = download_type @expiration = expiration unless expiration == SKIP @uri = uri @additional_properties = additional_properties end |
Instance Attribute Details
#download_type ⇒ String
The type of download. Possible values: URL.
15 16 17 |
# File 'lib/walmart_ap_is/models/document_download.rb', line 15 def download_type @download_type end |
#expiration ⇒ DateTime
The URI's expiration time. In ISO 8601 datetime format with pattern
yyyy-MM-ddTHH:mm:ss.sssZ.
20 21 22 |
# File 'lib/walmart_ap_is/models/document_download.rb', line 20 def expiration @expiration end |
#uri ⇒ String
Uniform resource identifier to identify where the document is located.
24 25 26 |
# File 'lib/walmart_ap_is/models/document_download.rb', line 24 def uri @uri end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/walmart_ap_is/models/document_download.rb', line 59 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. download_type = hash.key?('downloadType') ? hash['downloadType'] : nil uri = hash.key?('uri') ? hash['uri'] : nil expiration = if hash.key?('expiration') (DateTimeHelper.from_rfc3339(hash['expiration']) if hash['expiration']) else SKIP end # 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. DocumentDownload.new(download_type: download_type, uri: uri, expiration: expiration, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
27 28 29 30 31 32 33 |
# File 'lib/walmart_ap_is/models/document_download.rb', line 27 def self.names @_hash = {} if @_hash.nil? @_hash['download_type'] = 'downloadType' @_hash['expiration'] = 'expiration' @_hash['uri'] = 'uri' @_hash end |
.nullables ⇒ Object
An array for nullable fields
43 44 45 |
# File 'lib/walmart_ap_is/models/document_download.rb', line 43 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
36 37 38 39 40 |
# File 'lib/walmart_ap_is/models/document_download.rb', line 36 def self.optionals %w[ expiration ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
97 98 99 100 101 102 |
# File 'lib/walmart_ap_is/models/document_download.rb', line 97 def inspect class_name = self.class.name.split('::').last "<#{class_name} download_type: #{@download_type.inspect}, expiration:"\ " #{@expiration.inspect}, uri: #{@uri.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_expiration ⇒ Object
85 86 87 |
# File 'lib/walmart_ap_is/models/document_download.rb', line 85 def to_custom_expiration DateTimeHelper.to_rfc3339(expiration) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
90 91 92 93 94 |
# File 'lib/walmart_ap_is/models/document_download.rb', line 90 def to_s class_name = self.class.name.split('::').last "<#{class_name} download_type: #{@download_type}, expiration: #{@expiration}, uri: #{@uri},"\ " additional_properties: #{@additional_properties}>" end |