Class: Blastengine::Base
- Inherits:
-
Object
- Object
- Blastengine::Base
- Includes:
- Blastengine
- Defined in:
- lib/blastengine/base.rb
Constant Summary
Constants included from Blastengine
Instance Attribute Summary collapse
-
#created_time ⇒ Object
Returns the value of attribute created_time.
-
#delivery_id ⇒ Object
Returns the value of attribute delivery_id.
-
#delivery_time ⇒ Object
Returns the value of attribute delivery_time.
-
#delivery_type ⇒ Object
Returns the value of attribute delivery_type.
-
#drop_count ⇒ Object
Returns the value of attribute drop_count.
-
#hard_error_count ⇒ Object
Returns the value of attribute hard_error_count.
-
#open_count ⇒ Object
Returns the value of attribute open_count.
-
#sent_count ⇒ Object
Returns the value of attribute sent_count.
-
#soft_error_count ⇒ Object
Returns the value of attribute soft_error_count.
-
#status ⇒ Object
Returns the value of attribute status.
-
#total_count ⇒ Object
Returns the value of attribute total_count.
-
#updated_time ⇒ Object
Returns the value of attribute updated_time.
Class Method Summary collapse
Instance Method Summary collapse
-
#cancel ⇒ Object
メール送信のキャンセル.
- #client ⇒ Object
-
#delete ⇒ Object
バルクメールの削除.
- #get ⇒ Object
- #set(key, value) ⇒ Object
- #sets(params) ⇒ Object
- #unsubscribe(url: "", email: "") ⇒ Object
Methods included from Blastengine
Instance Attribute Details
#created_time ⇒ Object
Returns the value of attribute created_time.
6 7 8 |
# File 'lib/blastengine/base.rb', line 6 def created_time @created_time end |
#delivery_id ⇒ Object
Returns the value of attribute delivery_id.
6 7 8 |
# File 'lib/blastengine/base.rb', line 6 def delivery_id @delivery_id end |
#delivery_time ⇒ Object
Returns the value of attribute delivery_time.
6 7 8 |
# File 'lib/blastengine/base.rb', line 6 def delivery_time @delivery_time end |
#delivery_type ⇒ Object
Returns the value of attribute delivery_type.
6 7 8 |
# File 'lib/blastengine/base.rb', line 6 def delivery_type @delivery_type end |
#drop_count ⇒ Object
Returns the value of attribute drop_count.
6 7 8 |
# File 'lib/blastengine/base.rb', line 6 def drop_count @drop_count end |
#hard_error_count ⇒ Object
Returns the value of attribute hard_error_count.
6 7 8 |
# File 'lib/blastengine/base.rb', line 6 def hard_error_count @hard_error_count end |
#open_count ⇒ Object
Returns the value of attribute open_count.
6 7 8 |
# File 'lib/blastengine/base.rb', line 6 def open_count @open_count end |
#sent_count ⇒ Object
Returns the value of attribute sent_count.
6 7 8 |
# File 'lib/blastengine/base.rb', line 6 def sent_count @sent_count end |
#soft_error_count ⇒ Object
Returns the value of attribute soft_error_count.
6 7 8 |
# File 'lib/blastengine/base.rb', line 6 def soft_error_count @soft_error_count end |
#status ⇒ Object
Returns the value of attribute status.
6 7 8 |
# File 'lib/blastengine/base.rb', line 6 def status @status end |
#total_count ⇒ Object
Returns the value of attribute total_count.
6 7 8 |
# File 'lib/blastengine/base.rb', line 6 def total_count @total_count end |
#updated_time ⇒ Object
Returns the value of attribute updated_time.
6 7 8 |
# File 'lib/blastengine/base.rb', line 6 def updated_time @updated_time end |
Class Method Details
.client ⇒ Object
9 10 11 12 |
# File 'lib/blastengine/base.rb', line 9 def self.client base = Base.new base.client end |
Instance Method Details
#cancel ⇒ Object
メール送信のキャンセル
102 103 104 105 106 107 108 |
# File 'lib/blastengine/base.rb', line 102 def cancel # APIリクエスト用のパス path = "/deliveries/#{@delivery_id}/cancel" # API実行 res = @@client.patch path, {} return res["delivery_id"] end |
#client ⇒ Object
14 15 16 |
# File 'lib/blastengine/base.rb', line 14 def client @@client end |
#delete ⇒ Object
バルクメールの削除
113 114 115 116 117 118 |
# File 'lib/blastengine/base.rb', line 113 def delete path = "/deliveries/#{@delivery_id}" # API実行 res = @@client.delete path return res["delivery_id"] end |
#get ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/blastengine/base.rb', line 75 def get # APIリクエスト用のパス path = "/deliveries/#{@delivery_id}" res = @@client.get path # エラーがあったら例外を投げるので、この場合は通常終了 @delivery_type = res["delivery_type"] @delivery_id = res["delivery_id"] @status = res["status"] @total_count = res["total_count"] @sent_count = res["sent_count"] @drop_count = res["drop_count"] @hard_error_count = res["hard_error_count"] @soft_error_count = res["soft_error_count"] @open_count = res["open_count"] @delivery_time = res["delivery_time"] @reservation_time = res["reservation_time"] @created_time = res["created_time"] @updated_time = res["updated_time"] @_from = res["from"] @subject = res["subject"] @text_part = res["text_part"] @html_part = res["html_part"] end |
#set(key, value) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/blastengine/base.rb', line 29 def set(key, value) case key when "delivery_id" @delivery_id = value when "status" @status = value when "delivery_time" @delivery_time = Date.parse(value) if value != nil when "delivery_type" @delivery_type = value when "open_count" @open_count = value when "created_time" @created_time = Date.parse(value) if value != nil when "updated_time" @updated_time = Date.parse(value) if value != nil when "hard_error_count" @hard_error_count = value when "soft_error_count" @soft_error_count = value when "drop_count" @drop_count = value when "sent_count" @sent_count = value when "total_count" @total_count = value when "from" @_from = value when "reservation_time" @reservation_time = Date.parse(value) if value != nil when "maillog_id" @maillog_id = value when "email" @to = value when "last_response_code" @last_response_code = value when "last_response_message" = value when "subject" @subject = value when "open_time" @open_time = Date.parse(value) if value != nil end self end |
#sets(params) ⇒ Object
23 24 25 26 27 |
# File 'lib/blastengine/base.rb', line 23 def sets(params) params.each do |key, value| self.set(key, value) end end |
#unsubscribe(url: "", email: "") ⇒ Object
18 19 20 21 |
# File 'lib/blastengine/base.rb', line 18 def unsubscribe(url: "", email: "") @list_unsubscribe = {url: url, email: email} self end |