Class: BigCommerce::ManagementAPI::Segments

Inherits:
Endpoint
  • Object
show all
Defined in:
lib/big_commerce/management_api/segments.rb

Constant Summary collapse

PATH =
"segments"
RESULT_INSTANCE =
Segment

Constants inherited from Endpoint

Endpoint::CONTENT_TYPE, Endpoint::CONTENT_TYPE_JSON, Endpoint::HOST, Endpoint::JSON_CONTENT_TYPES, Endpoint::PORT, Endpoint::RESULT_KEY, Endpoint::USER_AGENT

Instance Method Summary collapse

Methods inherited from Endpoint

#initialize

Constructor Details

This class inherits a constructor from BigCommerce::ManagementAPI::Endpoint

Instance Method Details

#create(*segments) ⇒ Object



11
12
13
14
15
# File 'lib/big_commerce/management_api/segments.rb', line 11

def create(*segments)
  segments.flatten!

  POST(PATH, segments.map(&:to_h))
end

#delete(*ids) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/big_commerce/management_api/segments.rb', line 17

def delete(*ids)
  ids.flatten!

  DELETE(
    PATH,
    with_in_param({:id => ids}, :id)
  )
end

#get(options = {}) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/big_commerce/management_api/segments.rb', line 26

def get(options = {})
  GET(
    PATH,
    with_in_param(
      options,
      :id
    )
  )
end

#update(*segments) ⇒ Object



36
37
38
39
40
# File 'lib/big_commerce/management_api/segments.rb', line 36

def update(*segments)
  segments.flatten!

  PUT(PATH, segments.map(&:to_h))
end