Class: CyberSourceMergedSpec::CreateSearchRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/create_search_request.rb

Overview

CreateSearchRequest Model.

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(save: SKIP, name: SKIP, timezone: SKIP, query: SKIP, offset: SKIP, limit: SKIP, sort: SKIP, additional_properties: nil) ⇒ CreateSearchRequest

Returns a new instance of CreateSearchRequest.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/cyber_source_merged_spec/models/create_search_request.rb', line 96

def initialize(save: SKIP, name: SKIP, timezone: SKIP, query: SKIP,
               offset: SKIP, limit: SKIP, sort: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @save = save unless save == SKIP
  @name = name unless name == SKIP
  @timezone = timezone unless timezone == SKIP
  @query = query unless query == SKIP
  @offset = offset unless offset == SKIP
  @limit = limit unless limit == SKIP
  @sort = sort unless sort == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#limitInteger

Controls the maximum number of items that may be returned for a single request. The default is 20, the maximum is 2500.

Returns:

  • (Integer)


58
59
60
# File 'lib/cyber_source_merged_spec/models/create_search_request.rb', line 58

def limit
  @limit
end

#nameString

Name of this search. When save is set to true, this search is saved with this name.

Returns:

  • (String)


25
26
27
# File 'lib/cyber_source_merged_spec/models/create_search_request.rb', line 25

def name
  @name
end

#offsetInteger

Controls the starting point within the collection of results, which defaults to 0. The first item in the collection is retrieved by setting a zero offset. For example, if you have a collection of 15 items to be retrieved from a resource and you specify limit=5, you can retrieve the entire set of results in 3 successive requests by varying the offset value like this: offset=0 offset=5 offset=10 Note: If an offset larger than the number of results is provided, this will result in no embedded object being returned.

Returns:

  • (Integer)


53
54
55
# File 'lib/cyber_source_merged_spec/models/create_search_request.rb', line 53

def offset
  @offset
end

#queryString

String that contains the filters and variables for which you want to search. For information about supported field-filters and operators, see the [Query Filters]( https://developer.cybersource.com/api/developer-guides/dita-txn-search-det ails-rest-api-dev-guide-102718/txn-search-intro/txn-filtering.html) section of the Transaction Search Developer Guide.

Returns:

  • (String)


39
40
41
# File 'lib/cyber_source_merged_spec/models/create_search_request.rb', line 39

def query
  @query
end

#saveTrueClass | FalseClass

Indicates whether or not you want to save this search request for future use. The options are:

  • true
  • false (default value) If set to true, this field returns searchID in the response. You can use this value to retrieve the details of the saved search.

Returns:

  • (TrueClass | FalseClass)


20
21
22
# File 'lib/cyber_source_merged_spec/models/create_search_request.rb', line 20

def save
  @save
end

#sortString

A comma separated list of the following form: submitTimeUtc:desc

Returns:

  • (String)


63
64
65
# File 'lib/cyber_source_merged_spec/models/create_search_request.rb', line 63

def sort
  @sort
end

#timezoneString

Merchant’s time zone in ISO standard, using the TZ database format. For example: America/Chicago

Returns:

  • (String)


30
31
32
# File 'lib/cyber_source_merged_spec/models/create_search_request.rb', line 30

def timezone
  @timezone
end

Class Method Details

.from_element(root) ⇒ Object



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/cyber_source_merged_spec/models/create_search_request.rb', line 143

def self.from_element(root)
  save = XmlUtilities.from_element(root, 'save', TrueClass)
  name = XmlUtilities.from_element(root, 'name', String)
  timezone = XmlUtilities.from_element(root, 'timezone', String)
  query = XmlUtilities.from_element(root, 'query', String)
  offset = XmlUtilities.from_element(root, 'offset', Integer)
  limit = XmlUtilities.from_element(root, 'limit', Integer)
  sort = XmlUtilities.from_element(root, 'sort', String)

  new(save: save,
      name: name,
      timezone: timezone,
      query: query,
      offset: offset,
      limit: limit,
      sort: sort,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/cyber_source_merged_spec/models/create_search_request.rb', line 113

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  save = hash.key?('save') ? hash['save'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  timezone = hash.key?('timezone') ? hash['timezone'] : SKIP
  query = hash.key?('query') ? hash['query'] : SKIP
  offset = hash.key?('offset') ? hash['offset'] : SKIP
  limit = hash.key?('limit') ? hash['limit'] : SKIP
  sort = hash.key?('sort') ? hash['sort'] : 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.
  CreateSearchRequest.new(save: save,
                          name: name,
                          timezone: timezone,
                          query: query,
                          offset: offset,
                          limit: limit,
                          sort: sort,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



66
67
68
69
70
71
72
73
74
75
76
# File 'lib/cyber_source_merged_spec/models/create_search_request.rb', line 66

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['save'] = 'save'
  @_hash['name'] = 'name'
  @_hash['timezone'] = 'timezone'
  @_hash['query'] = 'query'
  @_hash['offset'] = 'offset'
  @_hash['limit'] = 'limit'
  @_hash['sort'] = 'sort'
  @_hash
end

.nullablesObject

An array for nullable fields



92
93
94
# File 'lib/cyber_source_merged_spec/models/create_search_request.rb', line 92

def self.nullables
  []
end

.optionalsObject

An array for optional fields



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/cyber_source_merged_spec/models/create_search_request.rb', line 79

def self.optionals
  %w[
    save
    name
    timezone
    query
    offset
    limit
    sort
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



187
188
189
190
191
192
193
# File 'lib/cyber_source_merged_spec/models/create_search_request.rb', line 187

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} save: #{@save.inspect}, name: #{@name.inspect}, timezone:"\
  " #{@timezone.inspect}, query: #{@query.inspect}, offset: #{@offset.inspect}, limit:"\
  " #{@limit.inspect}, sort: #{@sort.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



179
180
181
182
183
184
# File 'lib/cyber_source_merged_spec/models/create_search_request.rb', line 179

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} save: #{@save}, name: #{@name}, timezone: #{@timezone}, query: #{@query},"\
  " offset: #{@offset}, limit: #{@limit}, sort: #{@sort}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/cyber_source_merged_spec/models/create_search_request.rb', line 162

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'save', save)
  XmlUtilities.add_as_subelement(doc, root, 'name', name)
  XmlUtilities.add_as_subelement(doc, root, 'timezone', timezone)
  XmlUtilities.add_as_subelement(doc, root, 'query', query)
  XmlUtilities.add_as_subelement(doc, root, 'offset', offset)
  XmlUtilities.add_as_subelement(doc, root, 'limit', limit)
  XmlUtilities.add_as_subelement(doc, root, 'sort', sort)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end