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) ⇒ BillableUsageReport
constructor
A new instance of BillableUsageReport.
Methods inherited from BaseModel
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) ⇒ BillableUsageReport
Returns a new instance of BillableUsageReport.
73 74 75 76 77 78 79 80 81 82 83 84 |
# 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) @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 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.
87 88 89 90 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 |
# File 'lib/verizon/models/billable_usage_report.rb', line 87 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 object from extracted values. BillableUsageReport.new(account_name, usage_for_all_accounts, sku_name, transactions_allowed, total_transaction_count, primary_account, managed_accounts) 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 |