Class: Cloverly::Purchase

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/cloverly/purchase.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base

#attributes=, included, #initialize, #json=, #to_json

Class Method Details

.carbon(args) ⇒ Object



28
29
30
# File 'lib/cloverly/purchase.rb', line 28

def carbon(args)
  Cloverly.default.offset("carbon", args)
end

.list(cloverly_instance = nil) ⇒ Object



19
20
21
22
# File 'lib/cloverly/purchase.rb', line 19

def list(cloverly_instance = nil)
  c = cloverly_instance || Cloverly.default
  Cloverly::Purchase.parse(c, c.get("/2019-03-beta/purchases"))
end

.retrieve(cloverly_instance = nil, slug) ⇒ Object



4
5
6
# File 'lib/cloverly/purchase.rb', line 4

def self.retrieve(slug)
  self.parse(Cloverly.default, Cloverly.default.get("/2019-03-beta/purchases/#{slug}"))
end

.shipping(args) ⇒ Object



24
25
26
# File 'lib/cloverly/purchase.rb', line 24

def shipping(args)
  Cloverly.default.offset("shipping", args)
end

.vehicle(args) ⇒ Object



32
33
34
# File 'lib/cloverly/purchase.rb', line 32

def vehicle(args)
  Cloverly.default.offset("vehicle", args)
end

Instance Method Details

#cancel!Object



8
9
10
# File 'lib/cloverly/purchase.rb', line 8

def cancel!
  self.attributes = @cloverly_instance.delete("/2019-03-beta/purchases/#{slug}")
end