Class: Nordlet::Billing::Client
- Inherits:
-
Object
- Object
- Nordlet::Billing::Client
- Defined in:
- lib/nordlet/billing/client.rb
Instance Method Summary collapse
- #initialize(client:) ⇒ void constructor
- #post_v1billing_account_get(request_options: {}, **params) ⇒ Nordlet::Billing::Types::PostV1BillingAccountGetResponse
- #post_v1billing_account_set_plan(request_options: {}, **params) ⇒ Nordlet::Billing::Types::PostV1BillingAccountSetPlanResponse
- #post_v1billing_topup_create(request_options: {}, **params) ⇒ Nordlet::Billing::Types::PostV1BillingTopupCreateResponse
- #post_v1billing_transactions_list(request_options: {}, **params) ⇒ Nordlet::Billing::Types::PostV1BillingTransactionsListResponse
- #post_v1billing_usage_list(request_options: {}, **params) ⇒ Nordlet::Billing::Types::PostV1BillingUsageListResponse
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/nordlet/billing/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#post_v1billing_account_get(request_options: {}, **params) ⇒ Nordlet::Billing::Types::PostV1BillingAccountGetResponse
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/nordlet/billing/client.rb', line 22 def post_v1billing_account_get(request_options: {}, **params) params = Nordlet::Internal::Types::Utils.normalize_keys(params) request = Nordlet::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "v1/billing/account/get", body: Nordlet::Billing::Types::PostV1BillingAccountGetRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Nordlet::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Nordlet::Billing::Types::PostV1BillingAccountGetResponse.load(response.body) else error_class = Nordlet::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#post_v1billing_account_set_plan(request_options: {}, **params) ⇒ Nordlet::Billing::Types::PostV1BillingAccountSetPlanResponse
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/nordlet/billing/client.rb', line 54 def post_v1billing_account_set_plan(request_options: {}, **params) params = Nordlet::Internal::Types::Utils.normalize_keys(params) request = Nordlet::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "v1/billing/account/set-plan", body: Nordlet::Billing::Types::PostV1BillingAccountSetPlanRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Nordlet::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Nordlet::Billing::Types::PostV1BillingAccountSetPlanResponse.load(response.body) else error_class = Nordlet::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#post_v1billing_topup_create(request_options: {}, **params) ⇒ Nordlet::Billing::Types::PostV1BillingTopupCreateResponse
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/nordlet/billing/client.rb', line 86 def post_v1billing_topup_create(request_options: {}, **params) params = Nordlet::Internal::Types::Utils.normalize_keys(params) request = Nordlet::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "v1/billing/topup/create", body: Nordlet::Billing::Types::PostV1BillingTopupCreateRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Nordlet::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Nordlet::Billing::Types::PostV1BillingTopupCreateResponse.load(response.body) else error_class = Nordlet::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#post_v1billing_transactions_list(request_options: {}, **params) ⇒ Nordlet::Billing::Types::PostV1BillingTransactionsListResponse
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/nordlet/billing/client.rb', line 118 def post_v1billing_transactions_list(request_options: {}, **params) params = Nordlet::Internal::Types::Utils.normalize_keys(params) request = Nordlet::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "v1/billing/transactions/list", body: Nordlet::Billing::Types::PostV1BillingTransactionsListRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Nordlet::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Nordlet::Billing::Types::PostV1BillingTransactionsListResponse.load(response.body) else error_class = Nordlet::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#post_v1billing_usage_list(request_options: {}, **params) ⇒ Nordlet::Billing::Types::PostV1BillingUsageListResponse
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/nordlet/billing/client.rb', line 150 def post_v1billing_usage_list(request_options: {}, **params) params = Nordlet::Internal::Types::Utils.normalize_keys(params) request = Nordlet::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "v1/billing/usage/list", body: Nordlet::Billing::Types::PostV1BillingUsageListRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Nordlet::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Nordlet::Billing::Types::PostV1BillingUsageListResponse.load(response.body) else error_class = Nordlet::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |