Class: PaypalServerSdk::SearchResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/search_response.rb

Overview

The search response information.

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(transaction_details: SKIP, account_number: SKIP, start_date: SKIP, end_date: SKIP, last_refreshed_datetime: SKIP, page: SKIP, total_items: SKIP, total_pages: SKIP, links: SKIP) ⇒ SearchResponse

Returns a new instance of SearchResponse.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/paypal_server_sdk/models/search_response.rb', line 95

def initialize(transaction_details: SKIP, account_number: SKIP,
               start_date: SKIP, end_date: SKIP,
               last_refreshed_datetime: SKIP, page: SKIP, total_items: SKIP,
               total_pages: SKIP, links: SKIP)
  @transaction_details = transaction_details unless transaction_details == SKIP
  @account_number =  unless  == SKIP
  @start_date = start_date unless start_date == SKIP
  @end_date = end_date unless end_date == SKIP
  @last_refreshed_datetime = last_refreshed_datetime unless last_refreshed_datetime == SKIP
  @page = page unless page == SKIP
  @total_items = total_items unless total_items == SKIP
  @total_pages = total_pages unless total_pages == SKIP
  @links = links unless links == SKIP
end

Instance Attribute Details

#account_numberString

The merchant account number.

Returns:

  • (String)


18
19
20
# File 'lib/paypal_server_sdk/models/search_response.rb', line 18

def 
  @account_number
end

#end_dateString

The date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional. Note: The regular expression provides guidance but does not reject all invalid dates.

Returns:

  • (String)


32
33
34
# File 'lib/paypal_server_sdk/models/search_response.rb', line 32

def end_date
  @end_date
end

#last_refreshed_datetimeString

The date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional. Note: The regular expression provides guidance but does not reject all invalid dates.

Returns:

  • (String)


39
40
41
# File 'lib/paypal_server_sdk/models/search_response.rb', line 39

def last_refreshed_datetime
  @last_refreshed_datetime
end

An array of request-related [HATEOAS links](/api/rest/responses/#hateoas-links).

Returns:



58
59
60
# File 'lib/paypal_server_sdk/models/search_response.rb', line 58

def links
  @links
end

#pageInteger

A zero-relative index of transactions.

Returns:

  • (Integer)


43
44
45
# File 'lib/paypal_server_sdk/models/search_response.rb', line 43

def page
  @page
end

#start_dateString

The date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional. Note: The regular expression provides guidance but does not reject all invalid dates.

Returns:

  • (String)


25
26
27
# File 'lib/paypal_server_sdk/models/search_response.rb', line 25

def start_date
  @start_date
end

#total_itemsInteger

The total number of transactions as an integer beginning with the specified ‘page` in the full result and not just in this response.

Returns:

  • (Integer)


48
49
50
# File 'lib/paypal_server_sdk/models/search_response.rb', line 48

def total_items
  @total_items
end

#total_pagesInteger

The total number of pages, as an ‘integer`, when the `total_items` is divided into pages of the specified `page_size`.

Returns:

  • (Integer)


53
54
55
# File 'lib/paypal_server_sdk/models/search_response.rb', line 53

def total_pages
  @total_pages
end

#transaction_detailsArray[TransactionDetails]

An array of transaction detail objects.

Returns:



14
15
16
# File 'lib/paypal_server_sdk/models/search_response.rb', line 14

def transaction_details
  @transaction_details
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/paypal_server_sdk/models/search_response.rb', line 111

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

  transaction_details = nil
  unless hash['transaction_details'].nil?
    transaction_details = []
    hash['transaction_details'].each do |structure|
      transaction_details << (TransactionDetails.from_hash(structure) if structure)
    end
  end

  transaction_details = SKIP unless hash.key?('transaction_details')
   =
    hash.key?('account_number') ? hash['account_number'] : SKIP
  start_date = hash.key?('start_date') ? hash['start_date'] : SKIP
  end_date = hash.key?('end_date') ? hash['end_date'] : SKIP
  last_refreshed_datetime =
    hash.key?('last_refreshed_datetime') ? hash['last_refreshed_datetime'] : SKIP
  page = hash.key?('page') ? hash['page'] : SKIP
  total_items = hash.key?('total_items') ? hash['total_items'] : SKIP
  total_pages = hash.key?('total_pages') ? hash['total_pages'] : SKIP
  # Parameter is an array, so we need to iterate through it

  links = nil
  unless hash['links'].nil?
    links = []
    hash['links'].each do |structure|
      links << (LinkDescription.from_hash(structure) if structure)
    end
  end

  links = SKIP unless hash.key?('links')

  # Create object from extracted values.

  SearchResponse.new(transaction_details: transaction_details,
                     account_number: ,
                     start_date: start_date,
                     end_date: end_date,
                     last_refreshed_datetime: last_refreshed_datetime,
                     page: page,
                     total_items: total_items,
                     total_pages: total_pages,
                     links: links)
end

.namesObject

A mapping from model property names to API property names.



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/paypal_server_sdk/models/search_response.rb', line 61

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['transaction_details'] = 'transaction_details'
  @_hash['account_number'] = 'account_number'
  @_hash['start_date'] = 'start_date'
  @_hash['end_date'] = 'end_date'
  @_hash['last_refreshed_datetime'] = 'last_refreshed_datetime'
  @_hash['page'] = 'page'
  @_hash['total_items'] = 'total_items'
  @_hash['total_pages'] = 'total_pages'
  @_hash['links'] = 'links'
  @_hash
end

.nullablesObject

An array for nullable fields



91
92
93
# File 'lib/paypal_server_sdk/models/search_response.rb', line 91

def self.nullables
  []
end

.optionalsObject

An array for optional fields



76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/paypal_server_sdk/models/search_response.rb', line 76

def self.optionals
  %w[
    transaction_details
    account_number
    start_date
    end_date
    last_refreshed_datetime
    page
    total_items
    total_pages
    links
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



167
168
169
170
171
172
173
174
# File 'lib/paypal_server_sdk/models/search_response.rb', line 167

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} transaction_details: #{@transaction_details.inspect}, account_number:"\
  " #{@account_number.inspect}, start_date: #{@start_date.inspect}, end_date:"\
  " #{@end_date.inspect}, last_refreshed_datetime: #{@last_refreshed_datetime.inspect}, page:"\
  " #{@page.inspect}, total_items: #{@total_items.inspect}, total_pages:"\
  " #{@total_pages.inspect}, links: #{@links.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



158
159
160
161
162
163
164
# File 'lib/paypal_server_sdk/models/search_response.rb', line 158

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} transaction_details: #{@transaction_details}, account_number:"\
  " #{@account_number}, start_date: #{@start_date}, end_date: #{@end_date},"\
  " last_refreshed_datetime: #{@last_refreshed_datetime}, page: #{@page}, total_items:"\
  " #{@total_items}, total_pages: #{@total_pages}, links: #{@links}>"
end