Class: Blastengine::Usage
- Includes:
- Blastengine
- Defined in:
- lib/blastengine/usage.rb
Constant Summary
Constants included from Blastengine
Instance Attribute Summary collapse
-
#current ⇒ Object
Returns the value of attribute current.
-
#month ⇒ Object
Returns the value of attribute month.
-
#plan_id ⇒ Object
Returns the value of attribute plan_id.
-
#remaining ⇒ Object
Returns the value of attribute remaining.
-
#updated_time ⇒ Object
Returns the value of attribute updated_time.
Attributes inherited from Base
#created_time, #delivery_id, #delivery_time, #delivery_type, #drop_count, #hard_error_count, #open_count, #sent_count, #soft_error_count, #status, #total_count
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params) ⇒ Usage
constructor
A new instance of Usage.
Methods included from Blastengine
Methods inherited from Base
#cancel, #client, client, #delete, #get, #set, #sets, #unsubscribe
Constructor Details
#initialize(params) ⇒ Usage
Returns a new instance of Usage.
7 8 9 10 11 12 13 |
# File 'lib/blastengine/usage.rb', line 7 def initialize params @month = params["month"] @current = params["current"] @remaining = params["remaining"] @updated_time = params["updated_time"] @plan_id = params["plan_id"] end |
Instance Attribute Details
#current ⇒ Object
Returns the value of attribute current.
6 7 8 |
# File 'lib/blastengine/usage.rb', line 6 def current @current end |
#month ⇒ Object
Returns the value of attribute month.
6 7 8 |
# File 'lib/blastengine/usage.rb', line 6 def month @month end |
#plan_id ⇒ Object
Returns the value of attribute plan_id.
6 7 8 |
# File 'lib/blastengine/usage.rb', line 6 def plan_id @plan_id end |
#remaining ⇒ Object
Returns the value of attribute remaining.
6 7 8 |
# File 'lib/blastengine/usage.rb', line 6 def remaining @remaining end |
#updated_time ⇒ Object
Returns the value of attribute updated_time.
6 7 8 |
# File 'lib/blastengine/usage.rb', line 6 def updated_time @updated_time end |
Class Method Details
.all(month_ago = 1) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/blastengine/usage.rb', line 15 def self.all month_ago = 1 # APIリクエスト用のパス path = "/usages?month_ago=#{month_ago}" res = @@client.get path res["data"].map do |params| self.new params end end |
.get(month = Date.today.strftime("%Y%m")) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/blastengine/usage.rb', line 24 def self.get month = Date.today.strftime("%Y%m") # APIリクエスト用のパス path = "/usages/#{month}" res = @@client.get path self.new res end |
.latest ⇒ Object
31 32 33 34 35 36 |
# File 'lib/blastengine/usage.rb', line 31 def self.latest # APIリクエスト用のパス path = "/usages/latest" res = @@client.get path self.new res end |