Class: Lita::Handlers::BillingHistory
- Inherits:
-
Object
- Object
- Lita::Handlers::BillingHistory
- Defined in:
- lib/lita/handlers/spendo.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#table_name ⇒ Object
Returns the value of attribute table_name.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ BillingHistory
constructor
A new instance of BillingHistory.
- #latest ⇒ Object
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
#account ⇒ Object
Returns the value of attribute account.
6 7 8 |
# File 'lib/lita/handlers/spendo.rb', line 6 def account @account end |
#table_name ⇒ Object
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
#latest ⇒ Object
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" => account}, scan_index_forward: false, limit: 1 } results = table.query opts results.items.first end |