Class: Emma::Client

Inherits:
Object
  • Object
show all
Includes:
API::Fields, API::Groups, API::Mailings, API::Members, API::Response, API::Searches, API::Triggers, API::Webhooks, HTTParty
Defined in:
lib/emma/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from API::Webhooks

#add_webhook, #get_webhook, #my_webhooks, #remove_all_webhooks, #remove_webhook, #update_webhook, #webhook_events

Methods included from API::Triggers

#add_trigger, #get_trigger_by_id, #get_trigger_mailings, #my_triggers, #remove_trigger, #update_trigger

Methods included from API::Searches

#create_search, #get_members_of_search, #my_searches, #remove_search, #single_search, #update_search

Methods included from API::Response

#customer_share_information, #mailing_shares_overview, #my_account_summary, #response_mailing_information, #single_response_summary

Methods included from API::Mailings

#cancel_queued_mailing, #declare_winner_of_split_test, #forward_mailing_to_additional_recipients, #get_groups_by_mailing, #get_mailing_by_id, #get_mailing_members, #get_personalized_member_mailing, #mailing_headsup, #mailing_searches, #my_mailings, #remove_mailing, #send_existing_mailing, #update_mailing, #validate_mailing

Methods included from API::Groups

#add_members_to_group, #add_new_groups, #copy_members_to_different_group, #get_group_by_id, #group_members, #my_groups, #remove_all_members_from_group, #remove_all_members_from_groups, #remove_group, #remove_members_from_group, #update_group

Methods included from API::Fields

#add_field, #get_field_by_id, #my_fields, #remove_field, #remove_member_data_for_field, #update_field

Methods included from API::Members

#add_member, #add_member_signup, #add_member_to_groups, #add_members, #change_members_status, #copy_members_to_group, #delete_import, #get_mailing_history_for_member, #get_member_by_email, #get_member_by_id, #get_members_groups, #get_optout_member, #import_stats, #imported_members, #my_imports, #my_members, #optout, #remove_all_members, #remove_member, #remove_member_from_all_groups, #remove_member_from_groups, #remove_members, #remove_multiple_members_from_groups, #update_group_members_status, #update_member

Constructor Details

#initialize(options = {}) ⇒ Client

On insantiation set instance variables into memory



33
34
35
36
37
38
# File 'lib/emma/client.rb', line 33

def initialize(options = {})
  Emma::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", options[key] || Emma.instance_variable_get(:"@#{key}"))
  end
  @default_params = {:basic_auth => {:username => @public_key, :password => @private_key}}
end

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



30
31
32
# File 'lib/emma/client.rb', line 30

def 
  @account_id
end

#private_keyObject

Returns the value of attribute private_key.



30
31
32
# File 'lib/emma/client.rb', line 30

def private_key
  @private_key
end

#public_keyObject

Returns the value of attribute public_key.



30
31
32
# File 'lib/emma/client.rb', line 30

def public_key
  @public_key
end

Instance Method Details

#delete(path, query = {}) ⇒ Object

HTTP DELETE Request



58
59
60
# File 'lib/emma/client.rb', line 58

def delete(path, query = {})
  request(:delete, path, query)
end

#get(path, query = {}) ⇒ Object

HTTP GET Request



41
42
43
# File 'lib/emma/client.rb', line 41

def get(path, query = {})
  request(:get, path, query)
end

#post(path, params = {}) ⇒ Object

HTTP POST Request



46
47
48
49
# File 'lib/emma/client.rb', line 46

def post(path, params = {})
  # options = {:body => params.to_json}
  request(:post, path, params)
end

#put(path, params = {}) ⇒ Object

HTTP PUT Request



52
53
54
55
# File 'lib/emma/client.rb', line 52

def put(path, params = {})
  # options = {:body => params.to_json}
  request(:put, path, params)
end