Class: TXTextControl::ReportingCloud::AccountSettings
- Inherits:
-
Object
- Object
- TXTextControl::ReportingCloud::AccountSettings
- Defined in:
- lib/txtextcontrol/reportingcloud/account_settings.rb
Overview
Represents ReportingCloud account settings.
Instance Attribute Summary collapse
-
#created_documents ⇒ Integer
readonly
The number of created documents in the current month.
-
#max_documents ⇒ Integer
readonly
The maximum number of documents that can be created per month.
-
#max_templates ⇒ Integer
readonly
The maximum number of templates that can be uploaded to the template storage.
-
#serial_number ⇒ String, Symbol
readonly
The serial number that is attached to the account.
-
#uploaded_templates ⇒ Integer
readonly
The number of uploaded templates to the template storage.
-
#valid_until ⇒ DateTime
readonly
The date until the current subscription is valid.
Class Method Summary collapse
-
.from_camelized_hash(hash) ⇒ AccountSettings
Creates an AccountSettings instance from a hash.
Instance Method Summary collapse
-
#initialize(serial_number, created_documents, uploaded_templates, max_documents, max_templates, valid_until = nil) ⇒ AccountSettings
constructor
A new instance of AccountSettings.
Constructor Details
#initialize(serial_number, created_documents, uploaded_templates, max_documents, max_templates, valid_until = nil) ⇒ AccountSettings
Returns a new instance of AccountSettings
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/txtextcontrol/reportingcloud/account_settings.rb', line 51 def initialize(serial_number, created_documents, uploaded_templates, max_documents, max_templates, valid_until = nil) case serial_number.downcase when "trial" @serial_number = :trial when "free" @serial_number = :free else @serial_number = serial_number end @created_documents = Integer(created_documents) @uploaded_templates = Integer(uploaded_templates) @max_documents = Integer(max_documents) @max_templates = Integer(max_templates) case valid_until when DateTime @valid_until = valid_until when String @valid_until = DateTime.iso8601(valid_until) else @valid_until = nil end end |
Instance Attribute Details
#created_documents ⇒ Integer (readonly)
The number of created documents in the current month.
31 32 33 |
# File 'lib/txtextcontrol/reportingcloud/account_settings.rb', line 31 def created_documents @created_documents end |
#max_documents ⇒ Integer (readonly)
The maximum number of documents that can be created per month.
31 32 33 |
# File 'lib/txtextcontrol/reportingcloud/account_settings.rb', line 31 def max_documents @max_documents end |
#max_templates ⇒ Integer (readonly)
The maximum number of templates that can be uploaded to the template storage.
31 32 33 |
# File 'lib/txtextcontrol/reportingcloud/account_settings.rb', line 31 def max_templates @max_templates end |
#serial_number ⇒ String, Symbol (readonly)
The serial number that is attached to the account. Possible values are
:free
, :trial
and a 13 character long serial
number.
31 32 33 |
# File 'lib/txtextcontrol/reportingcloud/account_settings.rb', line 31 def serial_number @serial_number end |
#uploaded_templates ⇒ Integer (readonly)
The number of uploaded templates to the template storage.
31 32 33 |
# File 'lib/txtextcontrol/reportingcloud/account_settings.rb', line 31 def uploaded_templates @uploaded_templates end |
#valid_until ⇒ DateTime (readonly)
The date until the current subscription is valid. Can be nil.
31 32 33 |
# File 'lib/txtextcontrol/reportingcloud/account_settings.rb', line 31 def valid_until @valid_until end |
Class Method Details
.from_camelized_hash(hash) ⇒ AccountSettings
Creates an AccountSettings instance from a hash.
77 78 79 80 81 82 83 84 85 |
# File 'lib/txtextcontrol/reportingcloud/account_settings.rb', line 77 def self.from_camelized_hash(hash) sn = hash["serialNumber"] cd = hash["createdDocuments"] ut = hash["uploadedTemplates"] md = hash["maxDocuments"] mt = hash["maxTemplates"] vu = hash["validUntil"] return AccountSettings.new(sn, cd, ut, md, mt, vu) end |