Class: Voucherify::Service::Segments

Inherits:
Object
  • Object
show all
Defined in:
lib/voucherify/service/segments.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Segments

Returns a new instance of Segments.



8
9
10
# File 'lib/voucherify/service/segments.rb', line 8

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/voucherify/service/segments.rb', line 6

def client
  @client
end

Instance Method Details

#create(segment) ⇒ Object



12
13
14
# File 'lib/voucherify/service/segments.rb', line 12

def create(segment)
  @client.post('/segments', segment.to_json)
end

#delete(id) ⇒ Object



20
21
22
# File 'lib/voucherify/service/segments.rb', line 20

def delete(id)
  @client.delete("/segments/#{URI.encode(id)}")
end

#get(id) ⇒ Object



16
17
18
# File 'lib/voucherify/service/segments.rb', line 16

def get(id)
  @client.get("/segments/#{URI.encode(id)}")
end