Class: Io::Flow::V0::Models::ExclusionRulesExportType

Inherits:
ExportType
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Defines the filters that can be applied when requesting an exclusion rule data export

Instance Attribute Summary collapse

Attributes inherited from ExportType

#discriminator

Instance Method Summary collapse

Methods inherited from ExportType

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ ExclusionRulesExportType

Returns a new instance of ExclusionRulesExportType.



38151
38152
38153
38154
38155
38156
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38151

def initialize(incoming={})
  super(:discriminator => ExportType::Types::EXCLUSION_RULES_EXPORT_TYPE)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @states = (x = opts.delete(:states); x.nil? ? nil : HttpClient::Preconditions.assert_class('states', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ExclusionRuleState) ? x : ::Io::Flow::V0::Models::ExclusionRuleState.apply(x)) })
  @sort = (x = opts.delete(:sort); x.nil? ? nil : HttpClient::Preconditions.assert_class('sort', x, String))
end

Instance Attribute Details

#sortObject (readonly)

Returns the value of attribute sort.



38149
38150
38151
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38149

def sort
  @sort
end

#statesObject (readonly)

Returns the value of attribute states.



38149
38150
38151
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38149

def states
  @states
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



38162
38163
38164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38162

def copy(incoming={})
  ExclusionRulesExportType.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#subtype_to_hashObject



38166
38167
38168
38169
38170
38171
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38166

def subtype_to_hash
  {
    :states => states.nil? ? nil : states.map { |o| o.value },
    :sort => sort
  }
end

#to_jsonObject



38158
38159
38160
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38158

def to_json
  JSON.dump(to_hash)
end