Class: ThreeUsage::UsageBlock

Inherits:
Object
  • Object
show all
Defined in:
lib/three_usage/usage_block.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ UsageBlock

Returns a new instance of UsageBlock.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/three_usage/usage_block.rb', line 4

def initialize(options)
  @description = options[:description]
  @remaining = options[:remaining].to_f
  @expires_at = Date.strptime(options[:expires_at], '%d/%m/%y')
  
  @block_type = case @description
  when 'Prepaid Mobile Broadband (On Net)', 'Prepaid Initial Activation Data (On Net)'
    :three
  when 'Prepaid Roaming Mobile Broadband'
    :roaming
  else
    :unknown
  end
end

Instance Attribute Details

#block_typeObject (readonly)

Returns the value of attribute block_type.



3
4
5
# File 'lib/three_usage/usage_block.rb', line 3

def block_type
  @block_type
end

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/three_usage/usage_block.rb', line 3

def description
  @description
end

#expires_atObject (readonly)

Returns the value of attribute expires_at.



3
4
5
# File 'lib/three_usage/usage_block.rb', line 3

def expires_at
  @expires_at
end

#remainingObject (readonly)

Returns the value of attribute remaining.



3
4
5
# File 'lib/three_usage/usage_block.rb', line 3

def remaining
  @remaining
end