Class: Io::Flow::V0::Models::ExportForm

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

Overview

Export forms are used to create exports. The export type defines both the type of the export (e.g. the CSV File format) and the available parameters for each export (e.g. the filters to apply to select the desired data).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ExportForm

Returns a new instance of ExportForm.



9512
9513
9514
9515
9516
9517
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9512

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:type], 'ExportForm')
  @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::ExportType) ? x : ::Io::Flow::V0::Models::ExportType.from_json(x))
  @emails = (x = opts.delete(:emails); x.nil? ? nil : HttpClient::Preconditions.assert_class('emails', x, Array).map { |v| HttpClient::Preconditions.assert_class('emails', v, String) })
end

Instance Attribute Details

#emailsObject (readonly)

Returns the value of attribute emails.



9510
9511
9512
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9510

def emails
  @emails
end

#typeObject (readonly)

Returns the value of attribute type.



9510
9511
9512
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9510

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



9523
9524
9525
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9523

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

#to_hashObject



9527
9528
9529
9530
9531
9532
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9527

def to_hash
  {
    :type => type.to_hash,
    :emails => emails.nil? ? nil : emails
  }
end

#to_jsonObject



9519
9520
9521
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9519

def to_json
  JSON.dump(to_hash)
end