Class: PlentyClient::Account::Contact::Address

Inherits:
Object
  • Object
show all
Includes:
Endpoint, Request
Defined in:
lib/plenty_client/account/contact/address.rb

Constant Summary collapse

CONTACT_ADDRESS_BASE_PATH =
'/accounts/contacts/{contactId}'
LIST_A_CONTACT_ADDRESSES =
'/addresses/{addressTypeId}'
CREATE_A_CONTACT_ADDRESS =
'/addresses'
UPDATE_A_CONTACT_ADDRESS =
'/addresses/{addressId}'
DELETE_A_CONTACT_ADDRESS =
'/addresses/{addressId}'
SET_PRIMARY_CONTACT_ADDRESS =
'/addresses/{addressId}/types/{addressTypeId}/primary'

Class Method Summary collapse

Methods included from Request

included

Methods included from Endpoint

included

Class Method Details

.create(body = {}) ⇒ Object



26
27
28
# File 'lib/plenty_client/account/contact/address.rb', line 26

def create(body = {})
  post("#{CONTACT_ADDRESS_BASE_PATH}#{CREATE_A_CONTACT_ADDRESS}", body)
end

.destroy(contact_id, address_id, body = {}) ⇒ Object



37
38
39
40
41
42
# File 'lib/plenty_client/account/contact/address.rb', line 37

def destroy(contact_id, address_id, body = {})
  delete(build_endpoint("#{CONTACT_ADDRESS_BASE_PATH}#{DELETE_A_CONTACT_ADDRESS}",
                        contact: contact_id,
                        address: address_id),
         body)
end

.list(contact_id, address_type = '', headers = {}, &block) ⇒ Object



19
20
21
22
23
24
# File 'lib/plenty_client/account/contact/address.rb', line 19

def list(contact_id, address_type = '', headers = {}, &block)
  get(build_endpoint("#{CONTACT_ADDRESS_BASE_PATH}#{LIST_A_CONTACT_ADDRESSES}",
                     contact: contact_id,
                     address_type: address_type),
      headers, &block)
end

.update(contact_id, address_id, body = {}) ⇒ Object



30
31
32
33
34
35
# File 'lib/plenty_client/account/contact/address.rb', line 30

def update(contact_id, address_id, body = {})
  put(build_endpoint("#{CONTACT_ADDRESS_BASE_PATH}#{UPDATE_A_CONTACT_ADDRESS}",
                     contact: contact_id,
                     address: address_id),
      body)
end

.update_primary(contact_id, address_id, address_type, body = {}) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/plenty_client/account/contact/address.rb', line 44

def update_primary(contact_id, address_id, address_type, body = {})
  put(build_endpoint("#{CONTACT_ADDRESS_BASE_PATH}#{SET_PRIMARY_CONTACT_ADDRESS}",
                     contact: contact_id,
                     address: address_id,
                     address_type: address_type),
      body)
end