Class: Verizon::BillUsageRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/bill_usage_request.rb

Overview

Bill usage request.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(account_name = nil, start_date = nil, end_date = nil, usage_for_all_accounts = SKIP) ⇒ BillUsageRequest

Returns a new instance of BillUsageRequest.



50
51
52
53
54
55
56
# File 'lib/verizon/models/bill_usage_request.rb', line 50

def initialize( = nil, start_date = nil, end_date = nil,
               usage_for_all_accounts = SKIP)
  @account_name = 
  @start_date = start_date
  @end_date = end_date
  @usage_for_all_accounts = usage_for_all_accounts unless usage_for_all_accounts == SKIP
end

Instance Attribute Details

#account_nameString

Account identifier.

Returns:

  • (String)


14
15
16
# File 'lib/verizon/models/bill_usage_request.rb', line 14

def 
  @account_name
end

#end_dateString

End date to search for billable usage, mm-dd-yyyy.

Returns:

  • (String)


22
23
24
# File 'lib/verizon/models/bill_usage_request.rb', line 22

def end_date
  @end_date
end

#start_dateString

Start date to search for billable usage, mm-dd-yyyy.

Returns:

  • (String)


18
19
20
# File 'lib/verizon/models/bill_usage_request.rb', line 18

def start_date
  @start_date
end

#usage_for_all_accountsTrueClass | FalseClass

Request usage for single or multiple accounts.

Returns:

  • (TrueClass | FalseClass)


26
27
28
# File 'lib/verizon/models/bill_usage_request.rb', line 26

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.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/verizon/models/bill_usage_request.rb', line 59

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountName') ? hash['accountName'] : nil
  start_date = hash.key?('startDate') ? hash['startDate'] : nil
  end_date = hash.key?('endDate') ? hash['endDate'] : nil
  usage_for_all_accounts =
    hash.key?('usageForAllAccounts') ? hash['usageForAllAccounts'] : SKIP

  # Create object from extracted values.
  BillUsageRequest.new(,
                       start_date,
                       end_date,
                       usage_for_all_accounts)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/verizon/models/bill_usage_request.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_name'] = 'accountName'
  @_hash['start_date'] = 'startDate'
  @_hash['end_date'] = 'endDate'
  @_hash['usage_for_all_accounts'] = 'usageForAllAccounts'
  @_hash
end

.nullablesObject

An array for nullable fields



46
47
48
# File 'lib/verizon/models/bill_usage_request.rb', line 46

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
42
43
# File 'lib/verizon/models/bill_usage_request.rb', line 39

def self.optionals
  %w[
    usage_for_all_accounts
  ]
end