Class: InfaktApiClient::User
- Inherits:
-
Object
- Object
- InfaktApiClient::User
- Defined in:
- lib/infakt_api_client/user.rb
Overview
Represents a user in the Infakt API system, containing account information, company details, subscription status, and various settings. This class serves as a wrapper for user-related data returned by the Infakt API.
Defined Under Namespace
Classes: AccountData, CompanyData, Subscription
Instance Attribute Summary collapse
-
#account_data ⇒ Object
readonly
Returns the value of attribute account_data.
-
#accounting_office_service ⇒ Object
readonly
Returns the value of attribute accounting_office_service.
-
#accounting_settings ⇒ Object
readonly
Returns the value of attribute accounting_settings.
-
#company_data ⇒ Object
readonly
Returns the value of attribute company_data.
-
#current_subscription ⇒ Object
readonly
Returns the value of attribute current_subscription.
-
#extensions ⇒ Object
readonly
Returns the value of attribute extensions.
-
#foundation_process ⇒ Object
readonly
Returns the value of attribute foundation_process.
Instance Method Summary collapse
- #days_to_subscription_end ⇒ Object
- #full_name ⇒ Object
-
#initialize(attributes) ⇒ User
constructor
A new instance of User.
- #ksef_active? ⇒ Boolean
- #subscription_active? ⇒ Boolean
Constructor Details
#initialize(attributes) ⇒ User
Returns a new instance of User.
78 79 80 81 82 83 84 85 86 |
# File 'lib/infakt_api_client/user.rb', line 78 def initialize(attributes) @account_data = AccountData.new(attributes["account_data"]) @company_data = CompanyData.new(attributes["company_data"]) @current_subscription = Subscription.new(attributes["current_subscription"]) @accounting_settings = attributes["accounting_settings"] @accounting_office_service = attributes["accounting_office_service"] @foundation_process = attributes["foundation_process"] @extensions = attributes["extentions"] end |
Instance Attribute Details
#account_data ⇒ Object (readonly)
Returns the value of attribute account_data.
8 9 10 |
# File 'lib/infakt_api_client/user.rb', line 8 def account_data @account_data end |
#accounting_office_service ⇒ Object (readonly)
Returns the value of attribute accounting_office_service.
8 9 10 |
# File 'lib/infakt_api_client/user.rb', line 8 def accounting_office_service @accounting_office_service end |
#accounting_settings ⇒ Object (readonly)
Returns the value of attribute accounting_settings.
8 9 10 |
# File 'lib/infakt_api_client/user.rb', line 8 def accounting_settings @accounting_settings end |
#company_data ⇒ Object (readonly)
Returns the value of attribute company_data.
8 9 10 |
# File 'lib/infakt_api_client/user.rb', line 8 def company_data @company_data end |
#current_subscription ⇒ Object (readonly)
Returns the value of attribute current_subscription.
8 9 10 |
# File 'lib/infakt_api_client/user.rb', line 8 def current_subscription @current_subscription end |
#extensions ⇒ Object (readonly)
Returns the value of attribute extensions.
8 9 10 |
# File 'lib/infakt_api_client/user.rb', line 8 def extensions @extensions end |
#foundation_process ⇒ Object (readonly)
Returns the value of attribute foundation_process.
8 9 10 |
# File 'lib/infakt_api_client/user.rb', line 8 def foundation_process @foundation_process end |
Instance Method Details
#days_to_subscription_end ⇒ Object
96 97 98 |
# File 'lib/infakt_api_client/user.rb', line 96 def days_to_subscription_end current_subscription.days_until_expiration end |
#full_name ⇒ Object
88 89 90 |
# File 'lib/infakt_api_client/user.rb', line 88 def full_name "#{company_data.first_name} #{company_data.last_name}".strip end |
#ksef_active? ⇒ Boolean
100 101 102 |
# File 'lib/infakt_api_client/user.rb', line 100 def ksef_active? extensions.dig("ksef", "active") end |
#subscription_active? ⇒ Boolean
92 93 94 |
# File 'lib/infakt_api_client/user.rb', line 92 def subscription_active? Date.parse(current_subscription.expired_on) > Date.today end |