Class: MailchimpMarketing::CampaignFoldersApi
- Inherits:
-
Object
- Object
- MailchimpMarketing::CampaignFoldersApi
- Defined in:
- lib/MailchimpMarketing/api/campaign_folders_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create(body, opts = {}) ⇒ Object
Add campaign folder.
-
#get(folder_id, opts = {}) ⇒ Object
Get campaign folder.
-
#initialize(api_client) ⇒ CampaignFoldersApi
constructor
A new instance of CampaignFoldersApi.
-
#list(opts = {}) ⇒ Object
List campaign folders.
-
#remove(folder_id, opts = {}) ⇒ Object
Delete campaign folder.
-
#update(folder_id, body, opts = {}) ⇒ Object
Update campaign folder.
Constructor Details
#initialize(api_client) ⇒ CampaignFoldersApi
Returns a new instance of CampaignFoldersApi.
19 20 21 |
# File 'lib/MailchimpMarketing/api/campaign_folders_api.rb', line 19 def initialize(api_client) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/MailchimpMarketing/api/campaign_folders_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#create(body, opts = {}) ⇒ Object
Add campaign folder
87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/MailchimpMarketing/api/campaign_folders_api.rb', line 87 def create(body, opts = {}) fail ArgumentError, "Missing required param: 'body'" if body.nil? query_params = {} post_body = @api_client.object_to_http_body(body) local_var_path = '/campaign-folders' data = @api_client.call_api(:POST, local_var_path, :query_params => query_params, :body => post_body) return data end |
#get(folder_id, opts = {}) ⇒ Object
Get campaign folder
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/MailchimpMarketing/api/campaign_folders_api.rb', line 56 def get(folder_id, opts = {}) fail ArgumentError, "Missing required param: 'folder_id'" if folder_id.nil? query_params = {} query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil? query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :csv) if !opts[:'exclude_fields'].nil? post_body = nil local_var_path = '/campaign-folders/{folder_id}'.sub('{' + 'folder_id' + '}', folder_id.to_s) data = @api_client.call_api(:GET, local_var_path, :query_params => query_params, :body => post_body) return data end |
#list(opts = {}) ⇒ Object
List campaign folders
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/MailchimpMarketing/api/campaign_folders_api.rb', line 38 def list(opts = {}) fail ArgumentError, 'invalid value for "opts[:"count"]", must be smaller than or equal to 1000.' if !opts[:'count'].nil? && opts[:'count'] > 1000 query_params = {} query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil? query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :csv) if !opts[:'exclude_fields'].nil? query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? post_body = nil local_var_path = '/campaign-folders' data = @api_client.call_api(:GET, local_var_path, :query_params => query_params, :body => post_body) return data end |
#remove(folder_id, opts = {}) ⇒ Object
Delete campaign folder
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/MailchimpMarketing/api/campaign_folders_api.rb', line 24 def remove(folder_id, opts = {}) fail ArgumentError, "Missing required param: 'folder_id'" if folder_id.nil? query_params = {} post_body = nil local_var_path = '/campaign-folders/{folder_id}'.sub('{' + 'folder_id' + '}', folder_id.to_s) data = @api_client.call_api(:DELETE, local_var_path, :query_params => query_params, :body => post_body) return data end |
#update(folder_id, body, opts = {}) ⇒ Object
Update campaign folder
72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/MailchimpMarketing/api/campaign_folders_api.rb', line 72 def update(folder_id, body, opts = {}) fail ArgumentError, "Missing required param: 'folder_id'" if folder_id.nil? fail ArgumentError, "Missing required param: 'body'" if body.nil? query_params = {} post_body = @api_client.object_to_http_body(body) local_var_path = '/campaign-folders/{folder_id}'.sub('{' + 'folder_id' + '}', folder_id.to_s) data = @api_client.call_api(:PATCH, local_var_path, :query_params => query_params, :body => post_body) return data end |