Class: Lago::Api::Resources::Organization

Inherits:
Base
  • Object
show all
Defined in:
lib/lago/api/resources/organization.rb

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#create, #destroy, #get, #get_all, #initialize, #update

Constructor Details

This class inherits a constructor from Lago::Api::Resources::Base

Instance Method Details

#api_resourceObject



7
8
9
# File 'lib/lago/api/resources/organization.rb', line 7

def api_resource
  'organizations'
end

#root_nameObject



11
12
13
# File 'lib/lago/api/resources/organization.rb', line 11

def root_name
  'organization'
end

#whitelist_billing_configuration(billing_params) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/lago/api/resources/organization.rb', line 44

def whitelist_billing_configuration(billing_params)
  (billing_params || {}).slice(
    :invoice_footer,
    :invoice_grace_period,
    :document_locale,
  )
end

#whitelist_params(params) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/lago/api/resources/organization.rb', line 15

def whitelist_params(params)
  result_hash = {
    webhook_url: params[:webhook_url],
    webhook_urls: params[:webhook_urls],
    country: params[:country],
    default_currency: params[:default_currency],
    address_line1: params[:address_line1],
    address_line2: params[:address_line2],
    state: params[:state],
    zipcode: params[:zipcode],
    email: params[:email],
    city: params[:city],
    legal_name: params[:legal_name],
    legal_number: params[:legal_number],
    net_payment_term: params[:net_payment_term],
    tax_identification_number: params[:tax_identification_number],
    timezone: params[:timezone],
    email_settings: params[:email_settings],
    document_numbering: params[:document_numbering],
    document_number_prefix: params[:document_number_prefix],
  }.compact

  whitelist_billing_configuration(params[:billing_configuration]).tap do |config|
    result_hash[:billing_configuration] = config unless config.empty?
  end

  { root_name => result_hash }
end