Class: Rafflesia::Billing
- Inherits:
-
Object
- Object
- Rafflesia::Billing
- Defined in:
- lib/rafflesia/billing.rb
Instance Method Summary collapse
-
#checkoutSessionCreate(organization_id:, email: nil, plan: nil, plan_id: nil, request_options: {}) ⇒ Rafflesia::EnvelopeBillingHostedSession
POST /v1/billing/checkout-session.
-
#customerPortalCreate(organization_id:, request_options: {}) ⇒ Rafflesia::EnvelopeBillingHostedSession
POST /v1/billing/customer-portal.
-
#initialize(client) ⇒ Billing
constructor
A new instance of Billing.
-
#planCancelPendingSwitch(organization_id:, request_options: {}) ⇒ Rafflesia::EnvelopeSubscriptionSummary
POST /v1/billing/cancel-pending-switch.
-
#planSwitch(organization_id:, target_plan:, request_options: {}) ⇒ Rafflesia::EnvelopeSubscriptionSummary
POST /v1/billing/switch-plan.
-
#subscription(organization_id: nil, request_options: {}) ⇒ Rafflesia::EnvelopeSubscriptionSummary
GET /v1/billing/subscription.
-
#usage(environment_id: nil, product: nil, meter: nil, started_at: nil, ended_at: nil, bucket_interval: nil, request_options: {}) ⇒ Rafflesia::EnvelopeUsageSummaryData
GET /v1/billing/usage.
-
#usageLimitSet(organization_id:, usage_limit_usd: nil, request_options: {}) ⇒ Rafflesia::EnvelopeSubscriptionSummary
POST /v1/billing/set-usage-limit.
Constructor Details
#initialize(client) ⇒ Billing
Returns a new instance of Billing.
9 10 11 |
# File 'lib/rafflesia/billing.rb', line 9 def initialize(client) @client = client end |
Instance Method Details
#checkoutSessionCreate(organization_id:, email: nil, plan: nil, plan_id: nil, request_options: {}) ⇒ Rafflesia::EnvelopeBillingHostedSession
POST /v1/billing/checkout-session
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/rafflesia/billing.rb', line 43 def checkoutSessionCreate( organization_id:, email: nil, plan: nil, plan_id: nil, request_options: {} ) body = { 'email' => email, 'organization_id' => organization_id, 'plan' => plan, 'plan_id' => plan_id }.compact response = @client.request( method: :post, path: '/v1/billing/checkout-session', auth: true, body: body, request_options: ) result = Rafflesia::EnvelopeBillingHostedSession.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#customerPortalCreate(organization_id:, request_options: {}) ⇒ Rafflesia::EnvelopeBillingHostedSession
POST /v1/billing/customer-portal
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/rafflesia/billing.rb', line 72 def customerPortalCreate( organization_id:, request_options: {} ) body = { 'organization_id' => organization_id } response = @client.request( method: :post, path: '/v1/billing/customer-portal', auth: true, body: body, request_options: ) result = Rafflesia::EnvelopeBillingHostedSession.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#planCancelPendingSwitch(organization_id:, request_options: {}) ⇒ Rafflesia::EnvelopeSubscriptionSummary
POST /v1/billing/cancel-pending-switch
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rafflesia/billing.rb', line 17 def planCancelPendingSwitch( organization_id:, request_options: {} ) body = { 'organization_id' => organization_id } response = @client.request( method: :post, path: '/v1/billing/cancel-pending-switch', auth: true, body: body, request_options: ) result = Rafflesia::EnvelopeSubscriptionSummary.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#planSwitch(organization_id:, target_plan:, request_options: {}) ⇒ Rafflesia::EnvelopeSubscriptionSummary
POST /v1/billing/switch-plan
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/rafflesia/billing.rb', line 145 def planSwitch( organization_id:, target_plan:, request_options: {} ) body = { 'organization_id' => organization_id, 'target_plan' => target_plan } response = @client.request( method: :post, path: '/v1/billing/switch-plan', auth: true, body: body, request_options: ) result = Rafflesia::EnvelopeSubscriptionSummary.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#subscription(organization_id: nil, request_options: {}) ⇒ Rafflesia::EnvelopeSubscriptionSummary
GET /v1/billing/subscription
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/rafflesia/billing.rb', line 121 def subscription( organization_id: nil, request_options: {} ) params = { 'organization_id' => organization_id }.compact response = @client.request( method: :get, path: '/v1/billing/subscription', auth: true, params: params, request_options: ) result = Rafflesia::EnvelopeSubscriptionSummary.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#usage(environment_id: nil, product: nil, meter: nil, started_at: nil, ended_at: nil, bucket_interval: nil, request_options: {}) ⇒ Rafflesia::EnvelopeUsageSummaryData
GET /v1/billing/usage
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/rafflesia/billing.rb', line 175 def usage( environment_id: nil, product: nil, meter: nil, started_at: nil, ended_at: nil, bucket_interval: nil, request_options: {} ) params = { 'environment_id' => environment_id, 'product' => product, 'meter' => meter, 'started_at' => started_at, 'ended_at' => ended_at, 'bucket_interval' => bucket_interval }.compact response = @client.request( method: :get, path: '/v1/billing/usage', auth: true, params: params, request_options: ) result = Rafflesia::EnvelopeUsageSummaryData.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#usageLimitSet(organization_id:, usage_limit_usd: nil, request_options: {}) ⇒ Rafflesia::EnvelopeSubscriptionSummary
POST /v1/billing/set-usage-limit
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/rafflesia/billing.rb', line 96 def usageLimitSet( organization_id:, usage_limit_usd: nil, request_options: {} ) body = { 'organization_id' => organization_id, 'usage_limit_usd' => usage_limit_usd }.compact response = @client.request( method: :post, path: '/v1/billing/set-usage-limit', auth: true, body: body, request_options: ) result = Rafflesia::EnvelopeSubscriptionSummary.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |