Class: Verizon::BillableUsageReport
- Defined in:
- lib/verizon/models/billable_usage_report.rb
Overview
Bill usage report.
Instance Attribute Summary collapse
-
#account_name ⇒ String
Account identifier.
-
#managed_accounts ⇒ Array[ServiceUsage]
Zero or more managed accounts.
-
#primary_account ⇒ ServiceUsage
The total number of billable device location requests during the reporting period from all included accounts.
-
#sku_name ⇒ String
SKU Name of the service subscription.
-
#total_transaction_count ⇒ String
The total number of billable device location requests during the reporting period from all included accounts.
-
#transactions_allowed ⇒ String
The number of location requests included with the subscription type.
-
#usage_for_all_accounts ⇒ TrueClass | FalseClass
The usage is for a single or multiple accounts.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(account_name: SKIP, usage_for_all_accounts: SKIP, sku_name: SKIP, transactions_allowed: SKIP, total_transaction_count: SKIP, primary_account: SKIP, managed_accounts: SKIP, additional_properties: nil) ⇒ BillableUsageReport
constructor
A new instance of BillableUsageReport.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(account_name: SKIP, usage_for_all_accounts: SKIP, sku_name: SKIP, transactions_allowed: SKIP, total_transaction_count: SKIP, primary_account: SKIP, managed_accounts: SKIP, additional_properties: nil) ⇒ BillableUsageReport
Returns a new instance of BillableUsageReport.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/verizon/models/billable_usage_report.rb', line 73 def initialize(account_name: SKIP, usage_for_all_accounts: SKIP, sku_name: SKIP, transactions_allowed: SKIP, total_transaction_count: SKIP, primary_account: SKIP, managed_accounts: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @account_name = account_name unless account_name == SKIP @usage_for_all_accounts = usage_for_all_accounts unless usage_for_all_accounts == SKIP @sku_name = sku_name unless sku_name == SKIP @transactions_allowed = transactions_allowed unless transactions_allowed == SKIP @total_transaction_count = total_transaction_count unless total_transaction_count == SKIP @primary_account = primary_account unless primary_account == SKIP @managed_accounts = managed_accounts unless managed_accounts == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#account_name ⇒ String
Account identifier.
14 15 16 |
# File 'lib/verizon/models/billable_usage_report.rb', line 14 def account_name @account_name end |
#managed_accounts ⇒ Array[ServiceUsage]
Zero or more managed accounts.
40 41 42 |
# File 'lib/verizon/models/billable_usage_report.rb', line 40 def managed_accounts @managed_accounts end |
#primary_account ⇒ ServiceUsage
The total number of billable device location requests during the reporting period from all included accounts.
36 37 38 |
# File 'lib/verizon/models/billable_usage_report.rb', line 36 def primary_account @primary_account end |
#sku_name ⇒ String
SKU Name of the service subscription.
22 23 24 |
# File 'lib/verizon/models/billable_usage_report.rb', line 22 def sku_name @sku_name end |
#total_transaction_count ⇒ String
The total number of billable device location requests during the reporting period from all included accounts.
31 32 33 |
# File 'lib/verizon/models/billable_usage_report.rb', line 31 def total_transaction_count @total_transaction_count end |
#transactions_allowed ⇒ String
The number of location requests included with the subscription type.
26 27 28 |
# File 'lib/verizon/models/billable_usage_report.rb', line 26 def transactions_allowed @transactions_allowed end |
#usage_for_all_accounts ⇒ TrueClass | FalseClass
The usage is for a single or multiple accounts.
18 19 20 |
# File 'lib/verizon/models/billable_usage_report.rb', line 18 def usage_for_all_accounts @usage_for_all_accounts end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/verizon/models/billable_usage_report.rb', line 91 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. account_name = hash.key?('accountName') ? hash['accountName'] : SKIP usage_for_all_accounts = hash.key?('usageForAllAccounts') ? hash['usageForAllAccounts'] : SKIP sku_name = hash.key?('skuName') ? hash['skuName'] : SKIP transactions_allowed = hash.key?('transactionsAllowed') ? hash['transactionsAllowed'] : SKIP total_transaction_count = hash.key?('totalTransactionCount') ? hash['totalTransactionCount'] : SKIP primary_account = ServiceUsage.from_hash(hash['PrimaryAccount']) if hash['PrimaryAccount'] # Parameter is an array, so we need to iterate through it managed_accounts = nil unless hash['ManagedAccounts'].nil? managed_accounts = [] hash['ManagedAccounts'].each do |structure| managed_accounts << (ServiceUsage.from_hash(structure) if structure) end end managed_accounts = SKIP unless hash.key?('ManagedAccounts') # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. BillableUsageReport.new(account_name: account_name, usage_for_all_accounts: usage_for_all_accounts, sku_name: sku_name, transactions_allowed: transactions_allowed, total_transaction_count: total_transaction_count, primary_account: primary_account, managed_accounts: managed_accounts, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/verizon/models/billable_usage_report.rb', line 43 def self.names @_hash = {} if @_hash.nil? @_hash['account_name'] = 'accountName' @_hash['usage_for_all_accounts'] = 'usageForAllAccounts' @_hash['sku_name'] = 'skuName' @_hash['transactions_allowed'] = 'transactionsAllowed' @_hash['total_transaction_count'] = 'totalTransactionCount' @_hash['primary_account'] = 'PrimaryAccount' @_hash['managed_accounts'] = 'ManagedAccounts' @_hash end |
.nullables ⇒ Object
An array for nullable fields
69 70 71 |
# File 'lib/verizon/models/billable_usage_report.rb', line 69 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/verizon/models/billable_usage_report.rb', line 56 def self.optionals %w[ account_name usage_for_all_accounts sku_name transactions_allowed total_transaction_count primary_account managed_accounts ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
144 145 146 147 148 149 150 151 152 |
# File 'lib/verizon/models/billable_usage_report.rb', line 144 def inspect class_name = self.class.name.split('::').last "<#{class_name} account_name: #{@account_name.inspect}, usage_for_all_accounts:"\ " #{@usage_for_all_accounts.inspect}, sku_name: #{@sku_name.inspect}, transactions_allowed:"\ " #{@transactions_allowed.inspect}, total_transaction_count:"\ " #{@total_transaction_count.inspect}, primary_account: #{@primary_account.inspect},"\ " managed_accounts: #{@managed_accounts.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
134 135 136 137 138 139 140 141 |
# File 'lib/verizon/models/billable_usage_report.rb', line 134 def to_s class_name = self.class.name.split('::').last "<#{class_name} account_name: #{@account_name}, usage_for_all_accounts:"\ " #{@usage_for_all_accounts}, sku_name: #{@sku_name}, transactions_allowed:"\ " #{@transactions_allowed}, total_transaction_count: #{@total_transaction_count},"\ " primary_account: #{@primary_account}, managed_accounts: #{@managed_accounts},"\ " additional_properties: #{@additional_properties}>" end |