Class: ActiveCampaignWrapper::Core::CustomFieldValueGateway

Inherits:
Object
  • Object
show all
Defined in:
lib/active_campaign_wrapper/core/custom_field_value_gateway.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ CustomFieldValueGateway

Returns a new instance of CustomFieldValueGateway.



6
7
8
9
# File 'lib/active_campaign_wrapper/core/custom_field_value_gateway.rb', line 6

def initialize(client)
  @client = client
  @config = client.config
end

Instance Method Details

#all(**params) ⇒ Object



11
12
13
# File 'lib/active_campaign_wrapper/core/custom_field_value_gateway.rb', line 11

def all(**params)
  @config.get('/fieldValues', query: params)
end

#create(params, use_defaults: false) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/active_campaign_wrapper/core/custom_field_value_gateway.rb', line 15

def create(params, use_defaults: false)
  params = { field_value: params, use_defaults: use_defaults }
  @config.post(
    '/fieldValues',
    body: ActiveCampaignWrapper::Helpers.normalize_body(
      params
    )
  )
end

#delete(field_value_id) ⇒ Object



25
26
27
# File 'lib/active_campaign_wrapper/core/custom_field_value_gateway.rb', line 25

def delete(field_value_id)
  @config.delete("/fieldValues/#{field_value_id}")
end

#find(field_value_id) ⇒ Object



39
40
41
# File 'lib/active_campaign_wrapper/core/custom_field_value_gateway.rb', line 39

def find(field_value_id)
  @config.get("/fieldValues/#{field_value_id}")
end

#update(field_value_id, params, use_defaults: false) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/active_campaign_wrapper/core/custom_field_value_gateway.rb', line 29

def update(field_value_id, params, use_defaults: false)
  params = { field_value: params, use_defaults: use_defaults }
  @config.put(
    "/fieldValues/#{field_value_id}",
    body: ActiveCampaignWrapper::Helpers.normalize_body(
      params
    )
  )
end