Class: SKVReport::Stripe
- Inherits:
-
Object
- Object
- SKVReport::Stripe
- Defined in:
- lib/skv_report/stripe.rb
Overview
Generate SKV CSV string from Stripe charge
Defined Under Namespace
Classes: UndefinedTypeOfSalesError
Instance Attribute Summary collapse
-
#charges ⇒ Object
readonly
Returns the value of attribute charges.
-
#company_information ⇒ Object
readonly
Returns the value of attribute company_information.
-
#period ⇒ Object
readonly
Returns the value of attribute period.
-
#rates ⇒ Object
readonly
Returns the value of attribute rates.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(charges, period, year, company_information = {}, rates = {}) ⇒ Stripe
constructor
company_information needs to contain the following information { vat_number: String, # vat number of the selling company name: String, # contact name on selling company phone: String, # phone to contact on selling company email: String, # optional email to contact on selling company period_type: String, # defaults to ‘quarter’, can be set to month type_of_sales: String, # one of the following three [‘wares’, ‘third_party’, ‘services’] }.
Constructor Details
#initialize(charges, period, year, company_information = {}, rates = {}) ⇒ Stripe
company_information needs to contain the following information
vat_number: String, # vat number of the selling company
name: String, # contact name on selling company
phone: String, # phone to contact on selling company
email: String, # optional email to contact on selling company
period_type: String, # defaults to 'quarter', can be set to month
type_of_sales: String, # one of the following three
['wares', 'third_party', 'services']
Send rates to ImportExchangeRates, and send the object to stripe charge row, and then call rate for in there? Nah…
27 28 29 30 31 32 33 |
# File 'lib/skv_report/stripe.rb', line 27 def initialize(charges, period, year, company_information = {}, rates = {}) @charges = charges @company_information = company_information @period = period @year = year @rates = rates end |
Instance Attribute Details
#charges ⇒ Object (readonly)
Returns the value of attribute charges.
11 12 13 |
# File 'lib/skv_report/stripe.rb', line 11 def charges @charges end |
#company_information ⇒ Object (readonly)
Returns the value of attribute company_information.
11 12 13 |
# File 'lib/skv_report/stripe.rb', line 11 def company_information @company_information end |
#period ⇒ Object (readonly)
Returns the value of attribute period.
11 12 13 |
# File 'lib/skv_report/stripe.rb', line 11 def period @period end |
#rates ⇒ Object (readonly)
Returns the value of attribute rates.
11 12 13 |
# File 'lib/skv_report/stripe.rb', line 11 def rates @rates end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
11 12 13 |
# File 'lib/skv_report/stripe.rb', line 11 def year @year end |
Class Method Details
.call(charges, period, year, company_information = {}, rates = {}) ⇒ Object
35 36 37 |
# File 'lib/skv_report/stripe.rb', line 35 def self.call(charges, period, year, company_information = {}, rates = {}) new(charges, period, year, company_information, rates).call end |
Instance Method Details
#call ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/skv_report/stripe.rb', line 39 def call CSV.generate() do |csv| csv << first_row csv << second_row generate_charge_rows(csv) end end |