Class: Lita::Handlers::BillingHistory

Inherits:
Object
  • Object
show all
Defined in:
lib/lita/handlers/spendo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ BillingHistory

Returns a new instance of BillingHistory.



8
9
10
11
# File 'lib/lita/handlers/spendo.rb', line 8

def initialize(params={})
  @account    = params[:aws_account_id]
  @table_name = params[:dynamodb_table]
end

Instance Attribute Details

#accountObject

Returns the value of attribute account.



6
7
8
# File 'lib/lita/handlers/spendo.rb', line 6

def 
  @account
end

#table_nameObject

Returns the value of attribute table_name.



6
7
8
# File 'lib/lita/handlers/spendo.rb', line 6

def table_name
  @table_name
end

Instance Method Details

#latestObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/lita/handlers/spendo.rb', line 13

def latest
  ddb = Aws::DynamoDB::Resource.new()
  table = ddb.table(table_name)
  opts = {
    key_condition_expression: 'Account = :account',
    expression_attribute_values: {":account" => },
    scan_index_forward: false,
    limit: 1
  }
  results = table.query opts
  results.items.first
end