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.



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

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

Instance Attribute Details

#accountObject

Returns the value of attribute account.



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

def 
  @account
end

#table_nameObject

Returns the value of attribute table_name.



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

def table_name
  @table_name
end

Instance Method Details

#latestObject



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

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