Class: AdvancedBilling::ListPricePointsFilter
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::ListPricePointsFilter
- Defined in:
- lib/advanced_billing/models/list_price_points_filter.rb
Overview
ListPricePointsFilter Model.
Instance Attribute Summary collapse
-
#archived_at ⇒ IncludeNullOrNotNull
Allows fetching price points only if archived_at is present or not.
-
#date_field ⇒ BasicDateField
The type of filter you would like to apply to your search.
-
#end_date ⇒ Date
The end date (format YYYY-MM-DD) with which to filter the date_field.
-
#end_datetime ⇒ DateTime
The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field.
-
#ids ⇒ Array[Integer]
Allows fetching price points with matching id based on provided values.
-
#start_date ⇒ Date
The start date (format YYYY-MM-DD) with which to filter the date_field.
-
#start_datetime ⇒ DateTime
The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field.
-
#type ⇒ Array[PricePointType]
Allows fetching price points with matching type.
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(date_field: SKIP, start_date: SKIP, end_date: SKIP, start_datetime: SKIP, end_datetime: SKIP, type: SKIP, ids: SKIP, archived_at: SKIP, additional_properties: {}) ⇒ ListPricePointsFilter
constructor
A new instance of ListPricePointsFilter.
- #to_custom_end_datetime ⇒ Object
- #to_custom_start_datetime ⇒ 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(date_field: SKIP, start_date: SKIP, end_date: SKIP, start_datetime: SKIP, end_datetime: SKIP, type: SKIP, ids: SKIP, archived_at: SKIP, additional_properties: {}) ⇒ ListPricePointsFilter
Returns a new instance of ListPricePointsFilter.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/advanced_billing/models/list_price_points_filter.rb', line 94 def initialize(date_field: SKIP, start_date: SKIP, end_date: SKIP, start_datetime: SKIP, end_datetime: SKIP, type: SKIP, ids: SKIP, archived_at: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @date_field = date_field unless date_field == SKIP @start_date = start_date unless start_date == SKIP @end_date = end_date unless end_date == SKIP @start_datetime = start_datetime unless start_datetime == SKIP @end_datetime = end_datetime unless end_datetime == SKIP @type = type unless type == SKIP @ids = ids unless ids == SKIP @archived_at = archived_at unless archived_at == SKIP end |
Instance Attribute Details
#archived_at ⇒ IncludeNullOrNotNull
Allows fetching price points only if archived_at is present or not. Use in query: ‘filter=not_null`.
59 60 61 |
# File 'lib/advanced_billing/models/list_price_points_filter.rb', line 59 def archived_at @archived_at end |
#date_field ⇒ BasicDateField
The type of filter you would like to apply to your search. Use in query: ‘filter=created_at`.
16 17 18 |
# File 'lib/advanced_billing/models/list_price_points_filter.rb', line 16 def date_field @date_field end |
#end_date ⇒ Date
The end date (format YYYY-MM-DD) with which to filter the date_field. Returns price points with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified.
28 29 30 |
# File 'lib/advanced_billing/models/list_price_points_filter.rb', line 28 def end_date @end_date end |
#end_datetime ⇒ DateTime
The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns price points with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site’s time zone will be used. If provided, this parameter will be used instead of end_date.
44 45 46 |
# File 'lib/advanced_billing/models/list_price_points_filter.rb', line 44 def end_datetime @end_datetime end |
#ids ⇒ Array[Integer]
Allows fetching price points with matching id based on provided values. Use in query: ‘filter=1,2,3`.
54 55 56 |
# File 'lib/advanced_billing/models/list_price_points_filter.rb', line 54 def ids @ids end |
#start_date ⇒ Date
The start date (format YYYY-MM-DD) with which to filter the date_field. Returns price points with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified.
22 23 24 |
# File 'lib/advanced_billing/models/list_price_points_filter.rb', line 22 def start_date @start_date end |
#start_datetime ⇒ DateTime
The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns price points with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site’s time zone will be used. If provided, this parameter will be used instead of start_date.
36 37 38 |
# File 'lib/advanced_billing/models/list_price_points_filter.rb', line 36 def start_datetime @start_datetime end |
#type ⇒ Array[PricePointType]
Allows fetching price points with matching type. Use in query: ‘filter=custom,catalog`.
49 50 51 |
# File 'lib/advanced_billing/models/list_price_points_filter.rb', line 49 def type @type end |
Class Method Details
.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 142 143 144 145 146 147 |
# File 'lib/advanced_billing/models/list_price_points_filter.rb', line 113 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. date_field = hash.key?('date_field') ? hash['date_field'] : SKIP start_date = hash.key?('start_date') ? hash['start_date'] : SKIP end_date = hash.key?('end_date') ? hash['end_date'] : SKIP start_datetime = if hash.key?('start_datetime') (DateTimeHelper.from_rfc3339(hash['start_datetime']) if hash['start_datetime']) else SKIP end end_datetime = if hash.key?('end_datetime') (DateTimeHelper.from_rfc3339(hash['end_datetime']) if hash['end_datetime']) else SKIP end type = hash.key?('type') ? hash['type'] : SKIP ids = hash.key?('ids') ? hash['ids'] : SKIP archived_at = hash.key?('archived_at') ? hash['archived_at'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. ListPricePointsFilter.new(date_field: date_field, start_date: start_date, end_date: end_date, start_datetime: start_datetime, end_datetime: end_datetime, type: type, ids: ids, archived_at: archived_at, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/advanced_billing/models/list_price_points_filter.rb', line 62 def self.names @_hash = {} if @_hash.nil? @_hash['date_field'] = 'date_field' @_hash['start_date'] = 'start_date' @_hash['end_date'] = 'end_date' @_hash['start_datetime'] = 'start_datetime' @_hash['end_datetime'] = 'end_datetime' @_hash['type'] = 'type' @_hash['ids'] = 'ids' @_hash['archived_at'] = 'archived_at' @_hash end |
.nullables ⇒ Object
An array for nullable fields
90 91 92 |
# File 'lib/advanced_billing/models/list_price_points_filter.rb', line 90 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/advanced_billing/models/list_price_points_filter.rb', line 76 def self.optionals %w[ date_field start_date end_date start_datetime end_datetime type ids archived_at ] end |
Instance Method Details
#to_custom_end_datetime ⇒ Object
153 154 155 |
# File 'lib/advanced_billing/models/list_price_points_filter.rb', line 153 def to_custom_end_datetime DateTimeHelper.to_rfc3339(end_datetime) end |
#to_custom_start_datetime ⇒ Object
149 150 151 |
# File 'lib/advanced_billing/models/list_price_points_filter.rb', line 149 def to_custom_start_datetime DateTimeHelper.to_rfc3339(start_datetime) end |