Class: FrontendApiService
- Inherits:
-
Object
- Object
- FrontendApiService
- Defined in:
- app/services/frontend_api_service.rb
Constant Summary collapse
- FRONTEND_URL =
Rails.application.config.local_web_ui_url
Instance Attribute Summary collapse
-
#company_id ⇒ Object
readonly
Returns the value of attribute company_id.
-
#current_user_id ⇒ Object
readonly
Returns the value of attribute current_user_id.
-
#tenant_id ⇒ Object
readonly
Returns the value of attribute tenant_id.
Instance Method Summary collapse
-
#initialize(current_user_id:, company_id:, tenant_id: nil) ⇒ FrontendApiService
constructor
A new instance of FrontendApiService.
- #pdf_from_component(component:, props:, filename: 'document.pdf', return_file: true) ⇒ Object
Constructor Details
#initialize(current_user_id:, company_id:, tenant_id: nil) ⇒ FrontendApiService
Returns a new instance of FrontendApiService.
6 7 8 9 10 |
# File 'app/services/frontend_api_service.rb', line 6 def initialize(current_user_id:, company_id:, tenant_id: nil) @current_user_id = current_user_id @company_id = company_id @tenant_id = tenant_id end |
Instance Attribute Details
#company_id ⇒ Object (readonly)
Returns the value of attribute company_id.
4 5 6 |
# File 'app/services/frontend_api_service.rb', line 4 def company_id @company_id end |
#current_user_id ⇒ Object (readonly)
Returns the value of attribute current_user_id.
4 5 6 |
# File 'app/services/frontend_api_service.rb', line 4 def current_user_id @current_user_id end |
#tenant_id ⇒ Object (readonly)
Returns the value of attribute tenant_id.
4 5 6 |
# File 'app/services/frontend_api_service.rb', line 4 def tenant_id @tenant_id end |
Instance Method Details
#pdf_from_component(component:, props:, filename: 'document.pdf', return_file: true) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/services/frontend_api_service.rb', line 12 def pdf_from_component(component:, props:, filename: 'document.pdf', return_file: true) response = get( '/static', { component: component, props: props.to_json, filename: filename, token: token, 'companyId' => company_id, 'systemUserTenantId' => tenant_id } ) return_file ? file_from_bin(response.body) : response.body end |