Class: Io::Flow::V0::Models::TaxReport

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ TaxReport

Returns a new instance of TaxReport.



70324
70325
70326
70327
70328
70329
70330
70331
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70324

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:schedule, :timezone], 'TaxReport')
  @schedule = (x = opts.delete(:schedule); x.is_a?(::Io::Flow::V0::Models::RepeatSchedule) ? x : ::Io::Flow::V0::Models::RepeatSchedule.from_json(x))
  @timezone = HttpClient::Preconditions.assert_class('timezone', opts.delete(:timezone), String)
  @types = HttpClient::Preconditions.assert_class('types', (x = opts.delete(:types); x.nil? ? ["consumer","b2b"] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::TaxReportType) ? x : ::Io::Flow::V0::Models::TaxReportType.apply(x)) }
  @email_recipients = (x = opts.delete(:email_recipients); x.nil? ? nil : HttpClient::Preconditions.assert_class('email_recipients', x, Array).map { |v| HttpClient::Preconditions.assert_class('email_recipients', v, String) })
end

Instance Attribute Details

#email_recipientsObject (readonly)

Returns the value of attribute email_recipients.



70322
70323
70324
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70322

def email_recipients
  @email_recipients
end

#scheduleObject (readonly)

Returns the value of attribute schedule.



70322
70323
70324
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70322

def schedule
  @schedule
end

#timezoneObject (readonly)

Returns the value of attribute timezone.



70322
70323
70324
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70322

def timezone
  @timezone
end

#typesObject (readonly)

Returns the value of attribute types.



70322
70323
70324
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70322

def types
  @types
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



70337
70338
70339
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70337

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

#to_hashObject



70341
70342
70343
70344
70345
70346
70347
70348
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70341

def to_hash
  {
    :schedule => schedule.to_hash,
    :timezone => timezone,
    :types => types.map { |o| o.value },
    :email_recipients => email_recipients.nil? ? nil : email_recipients
  }
end

#to_jsonObject



70333
70334
70335
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70333

def to_json
  JSON.dump(to_hash)
end