Class: Stripe::Quote

Inherits:
APIResource show all
Extended by:
APIOperations::Create, APIOperations::List
Includes:
APIOperations::Save
Defined in:
lib/stripe/resources/quote.rb

Constant Summary collapse

OBJECT_NAME =
"quote"

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Attribute Summary

Attributes inherited from APIResource

#save_with_parent

Class Method Summary collapse

Instance Method Summary collapse

Methods included from APIOperations::Create

create

Methods included from APIOperations::List

list

Methods included from APIOperations::Save

included, #save

Methods inherited from APIResource

class_name, custom_method, #refresh, resource_url, #resource_url, retrieve, save_nested_resource

Methods included from APIOperations::Request

included

Methods inherited from StripeObject

#==, #[], #[]=, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values

Constructor Details

This class inherits a constructor from Stripe::StripeObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject

Class Method Details

.pdf(id, params = {}, opts = {}, &read_body_chunk_block) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/stripe/resources/quote.rb', line 81

def self.pdf(id, params = {}, opts = {}, &read_body_chunk_block)
  unless id.is_a?(String)
    raise ArgumentError,
          "id should be a string representing the ID of an API resource"
  end

  unless block_given?
    raise ArgumentError, "A read_body_chunk_block block parameter is required when calling the pdf method."
  end

  config = opts[:client]&.config || Stripe.config

  resp = execute_resource_request_stream(
    :get,
    "#{resource_url}/#{CGI.escape(id)}/pdf",
    params,
    {
      api_base: config.uploads_base,
    }.merge(opts),
    &read_body_chunk_block
  )
  resp
end

Instance Method Details

#accept(params = {}, opts = {}) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/stripe/resources/quote.rb', line 18

def accept(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: resource_url + "/accept",
    params: params,
    opts: opts
  )
end

#cancel(params = {}, opts = {}) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/stripe/resources/quote.rb', line 27

def cancel(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: resource_url + "/cancel",
    params: params,
    opts: opts
  )
end

#finalize_quote(params = {}, opts = {}) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/stripe/resources/quote.rb', line 36

def finalize_quote(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: resource_url + "/finalize",
    params: params,
    opts: opts
  )
end

#list_computed_upfront_line_items(params = {}, opts = {}) ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/stripe/resources/quote.rb', line 45

def list_computed_upfront_line_items(params = {}, opts = {})
  request_stripe_object(
    method: :get,
    path: resource_url + "/computed_upfront_line_items",
    params: params,
    opts: opts
  )
end

#list_line_items(params = {}, opts = {}) ⇒ Object



54
55
56
57
58
59
60
61
# File 'lib/stripe/resources/quote.rb', line 54

def list_line_items(params = {}, opts = {})
  request_stripe_object(
    method: :get,
    path: resource_url + "/line_items",
    params: params,
    opts: opts
  )
end

#pdf(params = {}, opts = {}, &read_body_chunk_block) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/stripe/resources/quote.rb', line 63

def pdf(params = {}, opts = {}, &read_body_chunk_block)
  unless block_given?
    raise ArgumentError, "A read_body_chunk_block block parameter is required when calling the pdf method."
  end

  config = opts[:client]&.config || Stripe.config

  request_stream(
    method: :get,
    path: resource_url + "/pdf",
    params: params,
    opts: {
      api_base: config.uploads_base,
    }.merge(opts),
    &read_body_chunk_block
  )
end