Class: Cloverly::Estimate

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/cloverly/estimate.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/estimate.rb', line 28

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

.list(cloverly_instance = nil) ⇒ Object



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

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

.retrieve(cloverly_instance = nil, slug) ⇒ Object



14
15
16
17
# File 'lib/cloverly/estimate.rb', line 14

def retrieve(cloverly_instance = nil, slug)
  c = cloverly_instance || Cloverly.default
  Cloverly::Estimate.parse(c, c.get("/2019-03-beta/estimates/#{slug}"))
end

.shipping(args) ⇒ Object



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

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

.vehicle(args) ⇒ Object



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

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

Instance Method Details

#cancel!Object



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

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

#purchase!Object



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

def purchase!
  Cloverly::Purchase.parse(@cloverly_instance, @cloverly_instance.post("/2019-03-beta/purchases", {estimate_slug: self.slug}))
end