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.



65256
65257
65258
65259
65260
65261
65262
65263
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65256

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.



65254
65255
65256
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65254

def email_recipients
  @email_recipients
end

#scheduleObject (readonly)

Returns the value of attribute schedule.



65254
65255
65256
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65254

def schedule
  @schedule
end

#timezoneObject (readonly)

Returns the value of attribute timezone.



65254
65255
65256
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65254

def timezone
  @timezone
end

#typesObject (readonly)

Returns the value of attribute types.



65254
65255
65256
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65254

def types
  @types
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



65269
65270
65271
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65269

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

#to_hashObject



65273
65274
65275
65276
65277
65278
65279
65280
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65273

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



65265
65266
65267
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65265

def to_json
  JSON.dump(to_hash)
end