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.



62152
62153
62154
62155
62156
62157
62158
62159
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62152

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.



62150
62151
62152
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62150

def email_recipients
  @email_recipients
end

#scheduleObject (readonly)

Returns the value of attribute schedule.



62150
62151
62152
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62150

def schedule
  @schedule
end

#timezoneObject (readonly)

Returns the value of attribute timezone.



62150
62151
62152
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62150

def timezone
  @timezone
end

#typesObject (readonly)

Returns the value of attribute types.



62150
62151
62152
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62150

def types
  @types
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



62165
62166
62167
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62165

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

#to_hashObject



62169
62170
62171
62172
62173
62174
62175
62176
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62169

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



62161
62162
62163
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62161

def to_json
  JSON.dump(to_hash)
end