Class: EmailHunter::Campaigns
- Inherits:
-
Object
- Object
- EmailHunter::Campaigns
- Defined in:
- lib/email_hunter/campaigns.rb
Constant Summary collapse
- API_URL =
'https://api.hunter.io/v2/campaigns'
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#campaign_id ⇒ Object
readonly
Returns the value of attribute campaign_id.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #hunt ⇒ Object
-
#initialize(key, action: :list, campaign_id: nil, data: nil, params: {}) ⇒ Campaigns
constructor
A new instance of Campaigns.
Constructor Details
#initialize(key, action: :list, campaign_id: nil, data: nil, params: {}) ⇒ Campaigns
Returns a new instance of Campaigns.
13 14 15 16 17 18 19 |
# File 'lib/email_hunter/campaigns.rb', line 13 def initialize(key, action: :list, campaign_id: nil, data: nil, params: {}) @key = key @action = action @campaign_id = campaign_id @data = data @params = params end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
11 12 13 |
# File 'lib/email_hunter/campaigns.rb', line 11 def action @action end |
#campaign_id ⇒ Object (readonly)
Returns the value of attribute campaign_id.
11 12 13 |
# File 'lib/email_hunter/campaigns.rb', line 11 def campaign_id @campaign_id end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
11 12 13 |
# File 'lib/email_hunter/campaigns.rb', line 11 def data @data end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
11 12 13 |
# File 'lib/email_hunter/campaigns.rb', line 11 def key @key end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
11 12 13 |
# File 'lib/email_hunter/campaigns.rb', line 11 def params @params end |
Instance Method Details
#hunt ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/email_hunter/campaigns.rb', line 21 def hunt case action when :list list_campaigns when :recipients list_recipients when :add_recipient add_recipient when :delete_recipient delete_recipient else raise ArgumentError, "Unknown action: #{action}" end end |