Class: Stripe::InvoiceRenderingTemplate

Inherits:
APIResource show all
Extended by:
APIOperations::List
Defined in:
lib/stripe/resources/invoice_rendering_template.rb

Overview

Invoice Rendering Templates are used to configure how invoices are rendered on surfaces like the PDF. Invoice Rendering Templates can be created from within the Dashboard, and they can be used over the API when creating invoices.

Defined Under Namespace

Classes: ArchiveParams, ListParams, RetrieveParams, UnarchiveParams

Constant Summary collapse

OBJECT_NAME =
"invoice_rendering_template"

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Attribute Summary collapse

Attributes inherited from APIResource

#save_with_parent

Attributes inherited from StripeObject

#last_response

Class Method Summary collapse

Instance Method Summary collapse

Methods included from APIOperations::List

list

Methods inherited from APIResource

class_name, custom_method, #refresh, #request_stripe_object, 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

Instance Attribute Details

#createdObject (readonly)

Time at which the object was created. Measured in seconds since the Unix epoch.



71
72
73
# File 'lib/stripe/resources/invoice_rendering_template.rb', line 71

def created
  @created
end

#idObject (readonly)

Unique identifier for the object.



74
75
76
# File 'lib/stripe/resources/invoice_rendering_template.rb', line 74

def id
  @id
end

#livemodeObject (readonly)

Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.



77
78
79
# File 'lib/stripe/resources/invoice_rendering_template.rb', line 77

def livemode
  @livemode
end

#metadataObject (readonly)

Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.



80
81
82
# File 'lib/stripe/resources/invoice_rendering_template.rb', line 80

def 
  @metadata
end

#nicknameObject (readonly)

A brief description of the template, hidden from customers



83
84
85
# File 'lib/stripe/resources/invoice_rendering_template.rb', line 83

def nickname
  @nickname
end

#objectObject (readonly)

String representing the object’s type. Objects of the same type share the same value.



86
87
88
# File 'lib/stripe/resources/invoice_rendering_template.rb', line 86

def object
  @object
end

#statusObject (readonly)

The status of the template, one of ‘active` or `archived`.



89
90
91
# File 'lib/stripe/resources/invoice_rendering_template.rb', line 89

def status
  @status
end

#versionObject (readonly)

Version of this template; version increases by one when an update on the template changes any field that controls invoice rendering



92
93
94
# File 'lib/stripe/resources/invoice_rendering_template.rb', line 92

def version
  @version
end

Class Method Details

.archive(template, params = {}, opts = {}) ⇒ Object

Updates the status of an invoice rendering template to ‘archived’ so no new Stripe objects (customers, invoices, etc.) can reference it. The template can also no longer be updated. However, if the template is already set on a Stripe object, it will continue to be applied on invoices generated by it.



105
106
107
108
109
110
111
112
# File 'lib/stripe/resources/invoice_rendering_template.rb', line 105

def self.archive(template, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/invoice_rendering_templates/%<template>s/archive", { template: CGI.escape(template) }),
    params: params,
    opts: opts
  )
end

.list(params = {}, opts = {}) ⇒ Object

List all templates, ordered by creation date, with the most recently created template appearing first.



115
116
117
118
119
120
121
122
# File 'lib/stripe/resources/invoice_rendering_template.rb', line 115

def self.list(params = {}, opts = {})
  request_stripe_object(
    method: :get,
    path: "/v1/invoice_rendering_templates",
    params: params,
    opts: opts
  )
end

.object_nameObject



11
12
13
# File 'lib/stripe/resources/invoice_rendering_template.rb', line 11

def self.object_name
  "invoice_rendering_template"
end

.unarchive(template, params = {}, opts = {}) ⇒ Object

Unarchive an invoice rendering template so it can be used on new Stripe objects again.



135
136
137
138
139
140
141
142
# File 'lib/stripe/resources/invoice_rendering_template.rb', line 135

def self.unarchive(template, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/invoice_rendering_templates/%<template>s/unarchive", { template: CGI.escape(template) }),
    params: params,
    opts: opts
  )
end

Instance Method Details

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

Updates the status of an invoice rendering template to ‘archived’ so no new Stripe objects (customers, invoices, etc.) can reference it. The template can also no longer be updated. However, if the template is already set on a Stripe object, it will continue to be applied on invoices generated by it.



95
96
97
98
99
100
101
102
# File 'lib/stripe/resources/invoice_rendering_template.rb', line 95

def archive(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/invoice_rendering_templates/%<template>s/archive", { template: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

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

Unarchive an invoice rendering template so it can be used on new Stripe objects again.



125
126
127
128
129
130
131
132
# File 'lib/stripe/resources/invoice_rendering_template.rb', line 125

def unarchive(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/invoice_rendering_templates/%<template>s/unarchive", { template: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end