Class: PaysecureApiDocumentationLive::Data
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaysecureApiDocumentationLive::Data
- Defined in:
- lib/paysecure_api_documentation_live/models/data.rb
Overview
Data Model.
Instance Attribute Summary collapse
-
#content ⇒ Array[Content]
TODO: Write general description for this method.
-
#current_page ⇒ Integer
TODO: Write general description for this method.
-
#first ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#has_next ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#has_previous ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#last ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#page_size ⇒ Integer
TODO: Write general description for this method.
-
#total_elements ⇒ Integer
TODO: Write general description for this method.
-
#total_pages ⇒ Integer
TODO: Write general description for this method.
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(content:, current_page:, page_size:, total_elements:, total_pages:, first:, last:, has_next:, has_previous:, additional_properties: nil) ⇒ Data
constructor
A new instance of Data.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#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(content:, current_page:, page_size:, total_elements:, total_pages:, first:, last:, has_next:, has_previous:, additional_properties: nil) ⇒ Data
Returns a new instance of Data.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/paysecure_api_documentation_live/models/data.rb', line 73 def initialize(content:, current_page:, page_size:, total_elements:, total_pages:, first:, last:, has_next:, has_previous:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @content = content @current_page = current_page @page_size = page_size @total_elements = total_elements @total_pages = total_pages @first = first @last = last @has_next = has_next @has_previous = has_previous @additional_properties = additional_properties end |
Instance Attribute Details
#content ⇒ Array[Content]
TODO: Write general description for this method
14 15 16 |
# File 'lib/paysecure_api_documentation_live/models/data.rb', line 14 def content @content end |
#current_page ⇒ Integer
TODO: Write general description for this method
18 19 20 |
# File 'lib/paysecure_api_documentation_live/models/data.rb', line 18 def current_page @current_page end |
#first ⇒ TrueClass | FalseClass
TODO: Write general description for this method
34 35 36 |
# File 'lib/paysecure_api_documentation_live/models/data.rb', line 34 def first @first end |
#has_next ⇒ TrueClass | FalseClass
TODO: Write general description for this method
42 43 44 |
# File 'lib/paysecure_api_documentation_live/models/data.rb', line 42 def has_next @has_next end |
#has_previous ⇒ TrueClass | FalseClass
TODO: Write general description for this method
46 47 48 |
# File 'lib/paysecure_api_documentation_live/models/data.rb', line 46 def has_previous @has_previous end |
#last ⇒ TrueClass | FalseClass
TODO: Write general description for this method
38 39 40 |
# File 'lib/paysecure_api_documentation_live/models/data.rb', line 38 def last @last end |
#page_size ⇒ Integer
TODO: Write general description for this method
22 23 24 |
# File 'lib/paysecure_api_documentation_live/models/data.rb', line 22 def page_size @page_size end |
#total_elements ⇒ Integer
TODO: Write general description for this method
26 27 28 |
# File 'lib/paysecure_api_documentation_live/models/data.rb', line 26 def total_elements @total_elements end |
#total_pages ⇒ Integer
TODO: Write general description for this method
30 31 32 |
# File 'lib/paysecure_api_documentation_live/models/data.rb', line 30 def total_pages @total_pages end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/paysecure_api_documentation_live/models/data.rb', line 92 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it content = nil unless hash['content'].nil? content = [] hash['content'].each do |structure| content << (Content.from_hash(structure) if structure) end end content = nil unless hash.key?('content') current_page = hash.key?('currentPage') ? hash['currentPage'] : nil page_size = hash.key?('pageSize') ? hash['pageSize'] : nil total_elements = hash.key?('totalElements') ? hash['totalElements'] : nil total_pages = hash.key?('totalPages') ? hash['totalPages'] : nil first = hash.key?('first') ? hash['first'] : nil last = hash.key?('last') ? hash['last'] : nil has_next = hash.key?('hasNext') ? hash['hasNext'] : nil has_previous = hash.key?('hasPrevious') ? hash['hasPrevious'] : nil # 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. Data.new(content: content, current_page: current_page, page_size: page_size, total_elements: total_elements, total_pages: total_pages, first: first, last: last, has_next: has_next, has_previous: has_previous, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/paysecure_api_documentation_live/models/data.rb', line 49 def self.names @_hash = {} if @_hash.nil? @_hash['content'] = 'content' @_hash['current_page'] = 'currentPage' @_hash['page_size'] = 'pageSize' @_hash['total_elements'] = 'totalElements' @_hash['total_pages'] = 'totalPages' @_hash['first'] = 'first' @_hash['last'] = 'last' @_hash['has_next'] = 'hasNext' @_hash['has_previous'] = 'hasPrevious' @_hash end |
.nullables ⇒ Object
An array for nullable fields
69 70 71 |
# File 'lib/paysecure_api_documentation_live/models/data.rb', line 69 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
64 65 66 |
# File 'lib/paysecure_api_documentation_live/models/data.rb', line 64 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
145 146 147 148 149 150 151 152 |
# File 'lib/paysecure_api_documentation_live/models/data.rb', line 145 def inspect class_name = self.class.name.split('::').last "<#{class_name} content: #{@content.inspect}, current_page: #{@current_page.inspect},"\ " page_size: #{@page_size.inspect}, total_elements: #{@total_elements.inspect}, total_pages:"\ " #{@total_pages.inspect}, first: #{@first.inspect}, last: #{@last.inspect}, has_next:"\ " #{@has_next.inspect}, has_previous: #{@has_previous.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
136 137 138 139 140 141 142 |
# File 'lib/paysecure_api_documentation_live/models/data.rb', line 136 def to_s class_name = self.class.name.split('::').last "<#{class_name} content: #{@content}, current_page: #{@current_page}, page_size:"\ " #{@page_size}, total_elements: #{@total_elements}, total_pages: #{@total_pages}, first:"\ " #{@first}, last: #{@last}, has_next: #{@has_next}, has_previous: #{@has_previous},"\ " additional_properties: #{@additional_properties}>" end |