Class: ApiReference::FetchCustomerCreditBlocksQueryParams

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/fetch_customer_credit_blocks_query_params.rb

Overview

FetchCustomerCreditBlocksQueryParams 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(limit: 20, cursor: SKIP, currency: SKIP, include_all_blocks: false, effective_date_gte: SKIP, effective_date_gt: SKIP, effective_date_lt: SKIP, effective_date_lte: SKIP) ⇒ FetchCustomerCreditBlocksQueryParams

Returns a new instance of FetchCustomerCreditBlocksQueryParams.



91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/api_reference/models/fetch_customer_credit_blocks_query_params.rb', line 91

def initialize(limit: 20, cursor: SKIP, currency: SKIP,
               include_all_blocks: false, effective_date_gte: SKIP,
               effective_date_gt: SKIP, effective_date_lt: SKIP,
               effective_date_lte: SKIP)
  @limit = limit unless limit == SKIP
  @cursor = cursor unless cursor == SKIP
  @currency = currency unless currency == SKIP
  @include_all_blocks = include_all_blocks unless include_all_blocks == SKIP
  @effective_date_gte = effective_date_gte unless effective_date_gte == SKIP
  @effective_date_gt = effective_date_gt unless effective_date_gt == SKIP
  @effective_date_lt = effective_date_lt unless effective_date_lt == SKIP
  @effective_date_lte = effective_date_lte unless effective_date_lte == SKIP
end

Instance Attribute Details

#currencyString

The ledger currency or custom pricing unit to use.

Returns:

  • (String)


24
25
26
# File 'lib/api_reference/models/fetch_customer_credit_blocks_query_params.rb', line 24

def currency
  @currency
end

#cursorString

Cursor for pagination. This can be populated by the next_cursor value returned from the initial request.

Returns:

  • (String)


20
21
22
# File 'lib/api_reference/models/fetch_customer_credit_blocks_query_params.rb', line 20

def cursor
  @cursor
end

#effective_date_gtDateTime

If set to True, all expired and depleted blocks, as well as active block will be returned.

Returns:

  • (DateTime)


39
40
41
# File 'lib/api_reference/models/fetch_customer_credit_blocks_query_params.rb', line 39

def effective_date_gt
  @effective_date_gt
end

#effective_date_gteDateTime

If set to True, all expired and depleted blocks, as well as active block will be returned.

Returns:

  • (DateTime)


34
35
36
# File 'lib/api_reference/models/fetch_customer_credit_blocks_query_params.rb', line 34

def effective_date_gte
  @effective_date_gte
end

#effective_date_ltDateTime

If set to True, all expired and depleted blocks, as well as active block will be returned.

Returns:

  • (DateTime)


44
45
46
# File 'lib/api_reference/models/fetch_customer_credit_blocks_query_params.rb', line 44

def effective_date_lt
  @effective_date_lt
end

#effective_date_lteDateTime

If set to True, all expired and depleted blocks, as well as active block will be returned.

Returns:

  • (DateTime)


49
50
51
# File 'lib/api_reference/models/fetch_customer_credit_blocks_query_params.rb', line 49

def effective_date_lte
  @effective_date_lte
end

#include_all_blocksTrueClass | FalseClass

If set to True, all expired and depleted blocks, as well as active block will be returned.

Returns:

  • (TrueClass | FalseClass)


29
30
31
# File 'lib/api_reference/models/fetch_customer_credit_blocks_query_params.rb', line 29

def include_all_blocks
  @include_all_blocks
end

#limitInteger

The number of items to fetch. Defaults to 20.

Returns:

  • (Integer)


15
16
17
# File 'lib/api_reference/models/fetch_customer_credit_blocks_query_params.rb', line 15

def limit
  @limit
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/api_reference/models/fetch_customer_credit_blocks_query_params.rb', line 106

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  limit = hash['limit'] ||= 20
  cursor = hash.key?('cursor') ? hash['cursor'] : SKIP
  currency = hash.key?('currency') ? hash['currency'] : SKIP
  include_all_blocks = hash['include_all_blocks'] ||= false
  effective_date_gte = if hash.key?('effective_date[gte]')
                         (DateTimeHelper.from_rfc3339(hash['effective_date[gte]']) if hash['effective_date[gte]'])
                       else
                         SKIP
                       end
  effective_date_gt = if hash.key?('effective_date[gt]')
                        (DateTimeHelper.from_rfc3339(hash['effective_date[gt]']) if hash['effective_date[gt]'])
                      else
                        SKIP
                      end
  effective_date_lt = if hash.key?('effective_date[lt]')
                        (DateTimeHelper.from_rfc3339(hash['effective_date[lt]']) if hash['effective_date[lt]'])
                      else
                        SKIP
                      end
  effective_date_lte = if hash.key?('effective_date[lte]')
                         (DateTimeHelper.from_rfc3339(hash['effective_date[lte]']) if hash['effective_date[lte]'])
                       else
                         SKIP
                       end

  # Create object from extracted values.
  FetchCustomerCreditBlocksQueryParams.new(limit: limit,
                                           cursor: cursor,
                                           currency: currency,
                                           include_all_blocks: include_all_blocks,
                                           effective_date_gte: effective_date_gte,
                                           effective_date_gt: effective_date_gt,
                                           effective_date_lt: effective_date_lt,
                                           effective_date_lte: effective_date_lte)
end

.namesObject

A mapping from model property names to API property names.



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/api_reference/models/fetch_customer_credit_blocks_query_params.rb', line 52

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['limit'] = 'limit'
  @_hash['cursor'] = 'cursor'
  @_hash['currency'] = 'currency'
  @_hash['include_all_blocks'] = 'include_all_blocks'
  @_hash['effective_date_gte'] = 'effective_date[gte]'
  @_hash['effective_date_gt'] = 'effective_date[gt]'
  @_hash['effective_date_lt'] = 'effective_date[lt]'
  @_hash['effective_date_lte'] = 'effective_date[lte]'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    cursor
    currency
    effective_date_gte
    effective_date_gt
    effective_date_lt
    effective_date_lte
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    limit
    cursor
    currency
    include_all_blocks
    effective_date_gte
    effective_date_gt
    effective_date_lt
    effective_date_lte
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



172
173
174
175
176
177
178
179
# File 'lib/api_reference/models/fetch_customer_credit_blocks_query_params.rb', line 172

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} limit: #{@limit.inspect}, cursor: #{@cursor.inspect}, currency:"\
  " #{@currency.inspect}, include_all_blocks: #{@include_all_blocks.inspect},"\
  " effective_date_gte: #{@effective_date_gte.inspect}, effective_date_gt:"\
  " #{@effective_date_gt.inspect}, effective_date_lt: #{@effective_date_lt.inspect},"\
  " effective_date_lte: #{@effective_date_lte.inspect}>"
end

#to_custom_effective_date_gtObject



150
151
152
# File 'lib/api_reference/models/fetch_customer_credit_blocks_query_params.rb', line 150

def to_custom_effective_date_gt
  DateTimeHelper.to_rfc3339(effective_date_gt)
end

#to_custom_effective_date_gteObject



146
147
148
# File 'lib/api_reference/models/fetch_customer_credit_blocks_query_params.rb', line 146

def to_custom_effective_date_gte
  DateTimeHelper.to_rfc3339(effective_date_gte)
end

#to_custom_effective_date_ltObject



154
155
156
# File 'lib/api_reference/models/fetch_customer_credit_blocks_query_params.rb', line 154

def to_custom_effective_date_lt
  DateTimeHelper.to_rfc3339(effective_date_lt)
end

#to_custom_effective_date_lteObject



158
159
160
# File 'lib/api_reference/models/fetch_customer_credit_blocks_query_params.rb', line 158

def to_custom_effective_date_lte
  DateTimeHelper.to_rfc3339(effective_date_lte)
end

#to_sObject

Provides a human-readable string representation of the object.



163
164
165
166
167
168
169
# File 'lib/api_reference/models/fetch_customer_credit_blocks_query_params.rb', line 163

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} limit: #{@limit}, cursor: #{@cursor}, currency: #{@currency},"\
  " include_all_blocks: #{@include_all_blocks}, effective_date_gte: #{@effective_date_gte},"\
  " effective_date_gt: #{@effective_date_gt}, effective_date_lt: #{@effective_date_lt},"\
  " effective_date_lte: #{@effective_date_lte}>"
end