schematichq 1.5.4 → 1.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.fern/metadata.json +4 -4
- data/.fern/replay.lock +7 -1
- data/WASM_VERSION +1 -1
- data/lib/schematic/billing/client.rb +423 -0
- data/lib/schematic/billing/types/count_native_invoices_params.rb +20 -0
- data/lib/schematic/billing/types/count_native_invoices_request.rb +19 -0
- data/lib/schematic/billing/types/count_native_invoices_response.rb +13 -0
- data/lib/schematic/billing/types/finalize_native_invoice_response.rb +13 -0
- data/lib/schematic/billing/types/get_company_native_subscription_response.rb +13 -0
- data/lib/schematic/billing/types/get_native_invoice_response.rb +13 -0
- data/lib/schematic/billing/types/list_native_invoices_params.rb +20 -0
- data/lib/schematic/billing/types/list_native_invoices_request.rb +19 -0
- data/lib/schematic/billing/types/list_native_invoices_response.rb +13 -0
- data/lib/schematic/billing/types/mark_invoice_paid_request_body.rb +19 -0
- data/lib/schematic/billing/types/mark_native_invoice_paid_response.rb +13 -0
- data/lib/schematic/billing/types/void_native_invoice_response.rb +13 -0
- data/lib/schematic/client.rb +1 -1
- data/lib/schematic/features/client.rb +0 -2
- data/lib/schematic/internal/iterators/cursor_item_iterator.rb +2 -2
- data/lib/schematic/internal/iterators/cursor_page_iterator.rb +11 -2
- data/lib/schematic/internal/iterators/item_iterator.rb +11 -2
- data/lib/schematic/internal/iterators/offset_item_iterator.rb +2 -2
- data/lib/schematic/internal/iterators/offset_page_iterator.rb +15 -6
- data/lib/schematic/internal/types/model.rb +17 -1
- data/lib/schematic/plans/client.rb +61 -5
- data/lib/schematic/plans/types/list_custom_plan_billings_params.rb +4 -0
- data/lib/schematic/plans/types/list_custom_plan_billings_request.rb +4 -0
- data/lib/schematic/plans/types/preview_publish_plan_version_response.rb +13 -0
- data/lib/schematic/types/amendment_proration_lands_on.rb +13 -0
- data/lib/schematic/types/billing_invoice_detail_response_data.rb +49 -0
- data/lib/schematic/types/billing_invoice_line_response_data.rb +27 -0
- data/lib/schematic/types/billing_invoice_response_data.rb +43 -0
- data/lib/schematic/types/billing_invoice_settlement_response_data.rb +17 -0
- data/lib/schematic/types/billing_invoice_terms_response_data.rb +19 -0
- data/lib/schematic/types/billing_native_subscription_change_response_data.rb +15 -0
- data/lib/schematic/types/billing_native_subscription_line_response_data.rb +47 -0
- data/lib/schematic/types/billing_native_subscription_response_data.rb +31 -0
- data/lib/schematic/types/billing_statement_line_response_data.rb +21 -0
- data/lib/schematic/types/billing_statement_response_data.rb +19 -0
- data/lib/schematic/types/charge_timing.rb +12 -0
- data/lib/schematic/types/collector.rb +13 -0
- data/lib/schematic/types/company_billing_profile_response_data.rb +12 -0
- data/lib/schematic/types/company_credit_balance.rb +4 -0
- data/lib/schematic/types/create_flag_request_body.rb +1 -1
- data/lib/schematic/types/create_or_update_flag_request_body.rb +1 -1
- data/lib/schematic/types/credit_spend_policy.rb +2 -0
- data/lib/schematic/types/event_body_inference.rb +4 -0
- data/lib/schematic/types/flag_detail_response_data.rb +1 -1
- data/lib/schematic/types/flag_in_plan_response_data.rb +1 -1
- data/lib/schematic/types/flag_response_data.rb +1 -1
- data/lib/schematic/types/invoice_collection_state.rb +17 -0
- data/lib/schematic/types/invoice_document_state.rb +14 -0
- data/lib/schematic/types/invoice_line_kind.rb +15 -0
- data/lib/schematic/types/line_kind.rb +13 -0
- data/lib/schematic/types/payment_gating.rb +12 -0
- data/lib/schematic/types/preflight_event_quantities_request_body.rb +13 -0
- data/lib/schematic/types/preflight_request_body.rb +2 -0
- data/lib/schematic/types/publish_plan_version_request_body.rb +43 -0
- data/lib/schematic/types/publish_preview_pay_in_advance_response_data.rb +15 -0
- data/lib/schematic/types/publish_preview_payment_method_response_data.rb +15 -0
- data/lib/schematic/types/publish_preview_proration_line_response_data.rb +19 -0
- data/lib/schematic/types/publish_preview_response_data.rb +53 -0
- data/lib/schematic/types/rulesengine_credit_spend_policy.rb +2 -0
- data/lib/schematic/types/subscription_change_action.rb +14 -0
- data/lib/schematic/version.rb +1 -1
- data/lib/schematic/wasm/rulesengine.wasm +0 -0
- data/lib/schematic.rb +42 -5
- data/reference.md +586 -103
- metadata +40 -3
- data/lib/schematic/plans/types/publish_plan_version_request_body.rb +0 -47
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f3a7e3345c10533337283543826d49730b9e4b04d7a6d3ee26d38a50b45dc512
|
|
4
|
+
data.tar.gz: 671ed3118b6461d3f5be1dbe2bb0c6013ad7463baa7b0bb8983ae6248a6aff2a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 077d139c90de5ddac3cb7216aadd786a2630e5465eb7edfd3c0f2d6f18f3f7c84b83b5c041f88530f2b74ab3128f895721268f0966c6adfb7f39c21bb13f0ae2
|
|
7
|
+
data.tar.gz: 83c7225c4f2762611e5d00d83a5a6ce3893c0a3cae097768b96cb70661d13067f9440b5fe56b8121734dfe4d5ada4a6b4652f9bf092f8137146962f8f4072fcf
|
data/.fern/metadata.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"cliVersion": "5.50.0",
|
|
3
3
|
"generatorName": "fernapi/fern-ruby-sdk",
|
|
4
|
-
"generatorVersion": "1.
|
|
4
|
+
"generatorVersion": "1.39.1",
|
|
5
5
|
"generatorConfig": {
|
|
6
6
|
"module": "SchematicHQ",
|
|
7
7
|
"rubocopVariableNumberStyle": "disabled",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"webrick": ">= 1.0"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
-
"originGitCommit": "
|
|
16
|
+
"originGitCommit": "5df5ee39faba7ee0d2fd40aa455ee0a1b1a00034",
|
|
17
17
|
"originGitCommitIsDirty": false,
|
|
18
18
|
"invokedBy": "ci",
|
|
19
|
-
"requestedVersion": "1.5.
|
|
19
|
+
"requestedVersion": "1.5.5",
|
|
20
20
|
"ciProvider": "github",
|
|
21
|
-
"sdkVersion": "1.5.
|
|
21
|
+
"sdkVersion": "1.5.5"
|
|
22
22
|
}
|
data/.fern/replay.lock
CHANGED
|
@@ -126,5 +126,11 @@ generations:
|
|
|
126
126
|
cli_version: unknown
|
|
127
127
|
generator_versions:
|
|
128
128
|
fernapi/fern-ruby-sdk: 1.38.1
|
|
129
|
-
|
|
129
|
+
- commit_sha: 60825ceebf79189539133a284ec196b6fbf2288a
|
|
130
|
+
tree_hash: a16b642da4f1a16eb902cc855ed189a7bf0cb1d0
|
|
131
|
+
timestamp: 2026-10-19T10:02:37.303Z
|
|
132
|
+
cli_version: unknown
|
|
133
|
+
generator_versions:
|
|
134
|
+
fernapi/fern-ruby-sdk: 1.39.1
|
|
135
|
+
current_generation: 60825ceebf79189539133a284ec196b6fbf2288a
|
|
130
136
|
patches: []
|
data/WASM_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.11.0
|
|
@@ -1607,6 +1607,429 @@ module Schematic
|
|
|
1607
1607
|
raise error_class.new(response.body, code: code, body: error_body)
|
|
1608
1608
|
end
|
|
1609
1609
|
end
|
|
1610
|
+
|
|
1611
|
+
# @param request_options [Hash]
|
|
1612
|
+
# @param params [Hash]
|
|
1613
|
+
# @option request_options [String] :base_url
|
|
1614
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1615
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1616
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1617
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1618
|
+
# @option params [String] :company_id
|
|
1619
|
+
#
|
|
1620
|
+
# @example
|
|
1621
|
+
# client.billing.get_company_native_subscription(company_id: "company_id")
|
|
1622
|
+
#
|
|
1623
|
+
# @return [Schematic::Billing::Types::GetCompanyNativeSubscriptionResponse]
|
|
1624
|
+
def get_company_native_subscription(request_options: {}, **params)
|
|
1625
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1626
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1627
|
+
base_url: request_options[:base_url],
|
|
1628
|
+
method: "GET",
|
|
1629
|
+
path: "companies/#{URI.encode_uri_component(params[:company_id].to_s)}/native-subscription",
|
|
1630
|
+
request_options: request_options
|
|
1631
|
+
)
|
|
1632
|
+
begin
|
|
1633
|
+
response = @client.send(request)
|
|
1634
|
+
rescue Net::HTTPRequestTimeout
|
|
1635
|
+
raise Schematic::Errors::TimeoutError
|
|
1636
|
+
end
|
|
1637
|
+
code = response.code.to_i
|
|
1638
|
+
if code.between?(200, 299)
|
|
1639
|
+
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::GetCompanyNativeSubscriptionResponse.load(response.body))
|
|
1640
|
+
else
|
|
1641
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1642
|
+
error_types = {
|
|
1643
|
+
401 => Schematic::Types::ApiError,
|
|
1644
|
+
403 => Schematic::Types::ApiError,
|
|
1645
|
+
404 => Schematic::Types::ApiError,
|
|
1646
|
+
500 => Schematic::Types::ApiError
|
|
1647
|
+
}
|
|
1648
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1649
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1650
|
+
end
|
|
1651
|
+
end
|
|
1652
|
+
|
|
1653
|
+
# @param request_options [Hash]
|
|
1654
|
+
# @param params [Hash]
|
|
1655
|
+
# @option request_options [String] :base_url
|
|
1656
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1657
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1658
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1659
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1660
|
+
# @option params [String, nil] :company_id
|
|
1661
|
+
# @option params [String, nil] :contract_id
|
|
1662
|
+
# @option params [Schematic::Types::InvoiceDocumentState, nil] :document_state
|
|
1663
|
+
# @option params [Integer, nil] :limit
|
|
1664
|
+
# @option params [Integer, nil] :offset
|
|
1665
|
+
#
|
|
1666
|
+
# @example
|
|
1667
|
+
# client.billing.list_native_invoices(
|
|
1668
|
+
# company_id: "company_id",
|
|
1669
|
+
# contract_id: "contract_id",
|
|
1670
|
+
# document_state: "credited",
|
|
1671
|
+
# limit: 1000000,
|
|
1672
|
+
# offset: 1000000
|
|
1673
|
+
# )
|
|
1674
|
+
#
|
|
1675
|
+
# @return [Schematic::Billing::Types::ListNativeInvoicesResponse]
|
|
1676
|
+
def list_native_invoices(request_options: {}, **params)
|
|
1677
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1678
|
+
query_params = {}
|
|
1679
|
+
query_params["company_id"] = params[:company_id] if params.key?(:company_id)
|
|
1680
|
+
query_params["contract_id"] = params[:contract_id] if params.key?(:contract_id)
|
|
1681
|
+
query_params["document_state"] = params[:document_state] if params.key?(:document_state)
|
|
1682
|
+
query_params["limit"] = params[:limit] if params.key?(:limit)
|
|
1683
|
+
query_params["offset"] = params[:offset] if params.key?(:offset)
|
|
1684
|
+
|
|
1685
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1686
|
+
base_url: request_options[:base_url],
|
|
1687
|
+
method: "GET",
|
|
1688
|
+
path: "invoices",
|
|
1689
|
+
query: query_params,
|
|
1690
|
+
request_options: request_options
|
|
1691
|
+
)
|
|
1692
|
+
begin
|
|
1693
|
+
response = @client.send(request)
|
|
1694
|
+
rescue Net::HTTPRequestTimeout
|
|
1695
|
+
raise Schematic::Errors::TimeoutError
|
|
1696
|
+
end
|
|
1697
|
+
code = response.code.to_i
|
|
1698
|
+
if code.between?(200, 299)
|
|
1699
|
+
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::ListNativeInvoicesResponse.load(response.body))
|
|
1700
|
+
else
|
|
1701
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1702
|
+
error_types = {
|
|
1703
|
+
400 => Schematic::Types::ApiError,
|
|
1704
|
+
401 => Schematic::Types::ApiError,
|
|
1705
|
+
403 => Schematic::Types::ApiError,
|
|
1706
|
+
404 => Schematic::Types::ApiError,
|
|
1707
|
+
500 => Schematic::Types::ApiError
|
|
1708
|
+
}
|
|
1709
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1710
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1711
|
+
end
|
|
1712
|
+
end
|
|
1713
|
+
|
|
1714
|
+
# @param request_options [Hash]
|
|
1715
|
+
# @param params [Hash]
|
|
1716
|
+
# @option request_options [String] :base_url
|
|
1717
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1718
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1719
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1720
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1721
|
+
# @option params [String] :invoice_id
|
|
1722
|
+
#
|
|
1723
|
+
# @example
|
|
1724
|
+
# client.billing.get_native_invoice(invoice_id: "invoice_id")
|
|
1725
|
+
#
|
|
1726
|
+
# @return [Schematic::Billing::Types::GetNativeInvoiceResponse]
|
|
1727
|
+
def get_native_invoice(request_options: {}, **params)
|
|
1728
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1729
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1730
|
+
base_url: request_options[:base_url],
|
|
1731
|
+
method: "GET",
|
|
1732
|
+
path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}",
|
|
1733
|
+
request_options: request_options
|
|
1734
|
+
)
|
|
1735
|
+
begin
|
|
1736
|
+
response = @client.send(request)
|
|
1737
|
+
rescue Net::HTTPRequestTimeout
|
|
1738
|
+
raise Schematic::Errors::TimeoutError
|
|
1739
|
+
end
|
|
1740
|
+
code = response.code.to_i
|
|
1741
|
+
if code.between?(200, 299)
|
|
1742
|
+
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::GetNativeInvoiceResponse.load(response.body))
|
|
1743
|
+
else
|
|
1744
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1745
|
+
error_types = {
|
|
1746
|
+
401 => Schematic::Types::ApiError,
|
|
1747
|
+
403 => Schematic::Types::ApiError,
|
|
1748
|
+
404 => Schematic::Types::ApiError,
|
|
1749
|
+
500 => Schematic::Types::ApiError
|
|
1750
|
+
}
|
|
1751
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1752
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1753
|
+
end
|
|
1754
|
+
end
|
|
1755
|
+
|
|
1756
|
+
# @param request_options [Hash]
|
|
1757
|
+
# @param params [Hash]
|
|
1758
|
+
# @option request_options [String] :base_url
|
|
1759
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1760
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1761
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1762
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1763
|
+
# @option params [String] :invoice_id
|
|
1764
|
+
#
|
|
1765
|
+
# @example
|
|
1766
|
+
# client.billing.export_native_invoice(invoice_id: "invoice_id")
|
|
1767
|
+
#
|
|
1768
|
+
# @return [String]
|
|
1769
|
+
def export_native_invoice(request_options: {}, **params)
|
|
1770
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1771
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1772
|
+
base_url: request_options[:base_url],
|
|
1773
|
+
method: "GET",
|
|
1774
|
+
path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}/export",
|
|
1775
|
+
request_options: request_options
|
|
1776
|
+
)
|
|
1777
|
+
begin
|
|
1778
|
+
response = @client.send(request)
|
|
1779
|
+
rescue Net::HTTPRequestTimeout
|
|
1780
|
+
raise Schematic::Errors::TimeoutError
|
|
1781
|
+
end
|
|
1782
|
+
code = response.code.to_i
|
|
1783
|
+
return response.body if code.between?(200, 299)
|
|
1784
|
+
|
|
1785
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1786
|
+
error_types = {
|
|
1787
|
+
401 => Schematic::Types::ApiError,
|
|
1788
|
+
403 => Schematic::Types::ApiError,
|
|
1789
|
+
404 => Schematic::Types::ApiError,
|
|
1790
|
+
500 => Schematic::Types::ApiError
|
|
1791
|
+
}
|
|
1792
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1793
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1794
|
+
end
|
|
1795
|
+
|
|
1796
|
+
# @param request_options [Hash]
|
|
1797
|
+
# @param params [Hash]
|
|
1798
|
+
# @option request_options [String] :base_url
|
|
1799
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1800
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1801
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1802
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1803
|
+
# @option params [String] :invoice_id
|
|
1804
|
+
#
|
|
1805
|
+
# @example
|
|
1806
|
+
# client.billing.finalize_native_invoice(invoice_id: "invoice_id")
|
|
1807
|
+
#
|
|
1808
|
+
# @return [Schematic::Billing::Types::FinalizeNativeInvoiceResponse]
|
|
1809
|
+
def finalize_native_invoice(request_options: {}, **params)
|
|
1810
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1811
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1812
|
+
base_url: request_options[:base_url],
|
|
1813
|
+
method: "POST",
|
|
1814
|
+
path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}/finalize",
|
|
1815
|
+
request_options: request_options
|
|
1816
|
+
)
|
|
1817
|
+
begin
|
|
1818
|
+
response = @client.send(request)
|
|
1819
|
+
rescue Net::HTTPRequestTimeout
|
|
1820
|
+
raise Schematic::Errors::TimeoutError
|
|
1821
|
+
end
|
|
1822
|
+
code = response.code.to_i
|
|
1823
|
+
if code.between?(200, 299)
|
|
1824
|
+
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::FinalizeNativeInvoiceResponse.load(response.body))
|
|
1825
|
+
else
|
|
1826
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1827
|
+
error_types = {
|
|
1828
|
+
400 => Schematic::Types::ApiError,
|
|
1829
|
+
401 => Schematic::Types::ApiError,
|
|
1830
|
+
403 => Schematic::Types::ApiError,
|
|
1831
|
+
404 => Schematic::Types::ApiError,
|
|
1832
|
+
500 => Schematic::Types::ApiError
|
|
1833
|
+
}
|
|
1834
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1835
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1836
|
+
end
|
|
1837
|
+
end
|
|
1838
|
+
|
|
1839
|
+
# @param request_options [Hash]
|
|
1840
|
+
# @param params [Schematic::Billing::Types::MarkInvoicePaidRequestBody]
|
|
1841
|
+
# @option request_options [String] :base_url
|
|
1842
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1843
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1844
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1845
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1846
|
+
# @option params [String] :invoice_id
|
|
1847
|
+
#
|
|
1848
|
+
# @example
|
|
1849
|
+
# client.billing.mark_native_invoice_paid(
|
|
1850
|
+
# invoice_id: "invoice_id",
|
|
1851
|
+
# idempotency_key: "idempotency_key"
|
|
1852
|
+
# )
|
|
1853
|
+
#
|
|
1854
|
+
# @return [Schematic::Billing::Types::MarkNativeInvoicePaidResponse]
|
|
1855
|
+
def mark_native_invoice_paid(request_options: {}, **params)
|
|
1856
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1857
|
+
request_data = Schematic::Billing::Types::MarkInvoicePaidRequestBody.new(params).to_h
|
|
1858
|
+
non_body_param_names = %w[invoice_id]
|
|
1859
|
+
body = request_data.except(*non_body_param_names)
|
|
1860
|
+
|
|
1861
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1862
|
+
base_url: request_options[:base_url],
|
|
1863
|
+
method: "POST",
|
|
1864
|
+
path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}/mark-paid",
|
|
1865
|
+
body: body,
|
|
1866
|
+
request_options: request_options
|
|
1867
|
+
)
|
|
1868
|
+
begin
|
|
1869
|
+
response = @client.send(request)
|
|
1870
|
+
rescue Net::HTTPRequestTimeout
|
|
1871
|
+
raise Schematic::Errors::TimeoutError
|
|
1872
|
+
end
|
|
1873
|
+
code = response.code.to_i
|
|
1874
|
+
if code.between?(200, 299)
|
|
1875
|
+
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::MarkNativeInvoicePaidResponse.load(response.body))
|
|
1876
|
+
else
|
|
1877
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1878
|
+
error_types = {
|
|
1879
|
+
400 => Schematic::Types::ApiError,
|
|
1880
|
+
401 => Schematic::Types::ApiError,
|
|
1881
|
+
403 => Schematic::Types::ApiError,
|
|
1882
|
+
404 => Schematic::Types::ApiError,
|
|
1883
|
+
500 => Schematic::Types::ApiError
|
|
1884
|
+
}
|
|
1885
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1886
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1887
|
+
end
|
|
1888
|
+
end
|
|
1889
|
+
|
|
1890
|
+
# @param request_options [Hash]
|
|
1891
|
+
# @param params [Hash]
|
|
1892
|
+
# @option request_options [String] :base_url
|
|
1893
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1894
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1895
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1896
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1897
|
+
# @option params [String] :invoice_id
|
|
1898
|
+
#
|
|
1899
|
+
# @example
|
|
1900
|
+
# client.billing.download_native_invoice_pdf(invoice_id: "invoice_id")
|
|
1901
|
+
#
|
|
1902
|
+
# @return [String]
|
|
1903
|
+
def download_native_invoice_pdf(request_options: {}, **params)
|
|
1904
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1905
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1906
|
+
base_url: request_options[:base_url],
|
|
1907
|
+
method: "GET",
|
|
1908
|
+
path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}/pdf",
|
|
1909
|
+
request_options: request_options
|
|
1910
|
+
)
|
|
1911
|
+
begin
|
|
1912
|
+
response = @client.send(request)
|
|
1913
|
+
rescue Net::HTTPRequestTimeout
|
|
1914
|
+
raise Schematic::Errors::TimeoutError
|
|
1915
|
+
end
|
|
1916
|
+
code = response.code.to_i
|
|
1917
|
+
return response.body if code.between?(200, 299)
|
|
1918
|
+
|
|
1919
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1920
|
+
error_types = {
|
|
1921
|
+
401 => Schematic::Types::ApiError,
|
|
1922
|
+
403 => Schematic::Types::ApiError,
|
|
1923
|
+
404 => Schematic::Types::ApiError,
|
|
1924
|
+
500 => Schematic::Types::ApiError
|
|
1925
|
+
}
|
|
1926
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1927
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1928
|
+
end
|
|
1929
|
+
|
|
1930
|
+
# @param request_options [Hash]
|
|
1931
|
+
# @param params [Hash]
|
|
1932
|
+
# @option request_options [String] :base_url
|
|
1933
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1934
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1935
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1936
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1937
|
+
# @option params [String] :invoice_id
|
|
1938
|
+
#
|
|
1939
|
+
# @example
|
|
1940
|
+
# client.billing.void_native_invoice(invoice_id: "invoice_id")
|
|
1941
|
+
#
|
|
1942
|
+
# @return [Schematic::Billing::Types::VoidNativeInvoiceResponse]
|
|
1943
|
+
def void_native_invoice(request_options: {}, **params)
|
|
1944
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1945
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1946
|
+
base_url: request_options[:base_url],
|
|
1947
|
+
method: "POST",
|
|
1948
|
+
path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}/void",
|
|
1949
|
+
request_options: request_options
|
|
1950
|
+
)
|
|
1951
|
+
begin
|
|
1952
|
+
response = @client.send(request)
|
|
1953
|
+
rescue Net::HTTPRequestTimeout
|
|
1954
|
+
raise Schematic::Errors::TimeoutError
|
|
1955
|
+
end
|
|
1956
|
+
code = response.code.to_i
|
|
1957
|
+
if code.between?(200, 299)
|
|
1958
|
+
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::VoidNativeInvoiceResponse.load(response.body))
|
|
1959
|
+
else
|
|
1960
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1961
|
+
error_types = {
|
|
1962
|
+
400 => Schematic::Types::ApiError,
|
|
1963
|
+
401 => Schematic::Types::ApiError,
|
|
1964
|
+
403 => Schematic::Types::ApiError,
|
|
1965
|
+
404 => Schematic::Types::ApiError,
|
|
1966
|
+
500 => Schematic::Types::ApiError
|
|
1967
|
+
}
|
|
1968
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1969
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1970
|
+
end
|
|
1971
|
+
end
|
|
1972
|
+
|
|
1973
|
+
# @param request_options [Hash]
|
|
1974
|
+
# @param params [Hash]
|
|
1975
|
+
# @option request_options [String] :base_url
|
|
1976
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1977
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1978
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1979
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1980
|
+
# @option params [String, nil] :company_id
|
|
1981
|
+
# @option params [String, nil] :contract_id
|
|
1982
|
+
# @option params [Schematic::Types::InvoiceDocumentState, nil] :document_state
|
|
1983
|
+
# @option params [Integer, nil] :limit
|
|
1984
|
+
# @option params [Integer, nil] :offset
|
|
1985
|
+
#
|
|
1986
|
+
# @example
|
|
1987
|
+
# client.billing.count_native_invoices(
|
|
1988
|
+
# company_id: "company_id",
|
|
1989
|
+
# contract_id: "contract_id",
|
|
1990
|
+
# document_state: "credited",
|
|
1991
|
+
# limit: 1000000,
|
|
1992
|
+
# offset: 1000000
|
|
1993
|
+
# )
|
|
1994
|
+
#
|
|
1995
|
+
# @return [Schematic::Billing::Types::CountNativeInvoicesResponse]
|
|
1996
|
+
def count_native_invoices(request_options: {}, **params)
|
|
1997
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1998
|
+
query_params = {}
|
|
1999
|
+
query_params["company_id"] = params[:company_id] if params.key?(:company_id)
|
|
2000
|
+
query_params["contract_id"] = params[:contract_id] if params.key?(:contract_id)
|
|
2001
|
+
query_params["document_state"] = params[:document_state] if params.key?(:document_state)
|
|
2002
|
+
query_params["limit"] = params[:limit] if params.key?(:limit)
|
|
2003
|
+
query_params["offset"] = params[:offset] if params.key?(:offset)
|
|
2004
|
+
|
|
2005
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
2006
|
+
base_url: request_options[:base_url],
|
|
2007
|
+
method: "GET",
|
|
2008
|
+
path: "invoices/count",
|
|
2009
|
+
query: query_params,
|
|
2010
|
+
request_options: request_options
|
|
2011
|
+
)
|
|
2012
|
+
begin
|
|
2013
|
+
response = @client.send(request)
|
|
2014
|
+
rescue Net::HTTPRequestTimeout
|
|
2015
|
+
raise Schematic::Errors::TimeoutError
|
|
2016
|
+
end
|
|
2017
|
+
code = response.code.to_i
|
|
2018
|
+
if code.between?(200, 299)
|
|
2019
|
+
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::CountNativeInvoicesResponse.load(response.body))
|
|
2020
|
+
else
|
|
2021
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
2022
|
+
error_types = {
|
|
2023
|
+
400 => Schematic::Types::ApiError,
|
|
2024
|
+
401 => Schematic::Types::ApiError,
|
|
2025
|
+
403 => Schematic::Types::ApiError,
|
|
2026
|
+
404 => Schematic::Types::ApiError,
|
|
2027
|
+
500 => Schematic::Types::ApiError
|
|
2028
|
+
}
|
|
2029
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
2030
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
2031
|
+
end
|
|
2032
|
+
end
|
|
1610
2033
|
end
|
|
1611
2034
|
end
|
|
1612
2035
|
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Billing
|
|
5
|
+
module Types
|
|
6
|
+
# Input parameters
|
|
7
|
+
class CountNativeInvoicesParams < Internal::Types::Model
|
|
8
|
+
field :company_id, -> { String }, optional: true, nullable: false
|
|
9
|
+
|
|
10
|
+
field :contract_id, -> { String }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :document_state, -> { Schematic::Types::InvoiceDocumentState }, optional: true, nullable: false
|
|
13
|
+
|
|
14
|
+
field :limit, -> { Integer }, optional: true, nullable: false
|
|
15
|
+
|
|
16
|
+
field :offset, -> { Integer }, optional: true, nullable: false
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Billing
|
|
5
|
+
module Types
|
|
6
|
+
class CountNativeInvoicesRequest < Internal::Types::Model
|
|
7
|
+
field :company_id, -> { String }, optional: true, nullable: false
|
|
8
|
+
|
|
9
|
+
field :contract_id, -> { String }, optional: true, nullable: false
|
|
10
|
+
|
|
11
|
+
field :document_state, -> { Schematic::Types::InvoiceDocumentState }, optional: true, nullable: false
|
|
12
|
+
|
|
13
|
+
field :limit, -> { Integer }, optional: true, nullable: false
|
|
14
|
+
|
|
15
|
+
field :offset, -> { Integer }, optional: true, nullable: false
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Billing
|
|
5
|
+
module Types
|
|
6
|
+
class CountNativeInvoicesResponse < Internal::Types::Model
|
|
7
|
+
field :data, -> { Schematic::Types::CountResponse }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :params, -> { Schematic::Billing::Types::CountNativeInvoicesParams }, optional: false, nullable: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Billing
|
|
5
|
+
module Types
|
|
6
|
+
class FinalizeNativeInvoiceResponse < Internal::Types::Model
|
|
7
|
+
field :data, -> { Schematic::Types::BillingInvoiceDetailResponseData }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Billing
|
|
5
|
+
module Types
|
|
6
|
+
class GetCompanyNativeSubscriptionResponse < Internal::Types::Model
|
|
7
|
+
field :data, -> { Schematic::Types::BillingNativeSubscriptionResponseData }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Billing
|
|
5
|
+
module Types
|
|
6
|
+
class GetNativeInvoiceResponse < Internal::Types::Model
|
|
7
|
+
field :data, -> { Schematic::Types::BillingInvoiceDetailResponseData }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Billing
|
|
5
|
+
module Types
|
|
6
|
+
# Input parameters
|
|
7
|
+
class ListNativeInvoicesParams < Internal::Types::Model
|
|
8
|
+
field :company_id, -> { String }, optional: true, nullable: false
|
|
9
|
+
|
|
10
|
+
field :contract_id, -> { String }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :document_state, -> { Schematic::Types::InvoiceDocumentState }, optional: true, nullable: false
|
|
13
|
+
|
|
14
|
+
field :limit, -> { Integer }, optional: true, nullable: false
|
|
15
|
+
|
|
16
|
+
field :offset, -> { Integer }, optional: true, nullable: false
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Billing
|
|
5
|
+
module Types
|
|
6
|
+
class ListNativeInvoicesRequest < Internal::Types::Model
|
|
7
|
+
field :company_id, -> { String }, optional: true, nullable: false
|
|
8
|
+
|
|
9
|
+
field :contract_id, -> { String }, optional: true, nullable: false
|
|
10
|
+
|
|
11
|
+
field :document_state, -> { Schematic::Types::InvoiceDocumentState }, optional: true, nullable: false
|
|
12
|
+
|
|
13
|
+
field :limit, -> { Integer }, optional: true, nullable: false
|
|
14
|
+
|
|
15
|
+
field :offset, -> { Integer }, optional: true, nullable: false
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Billing
|
|
5
|
+
module Types
|
|
6
|
+
class ListNativeInvoicesResponse < Internal::Types::Model
|
|
7
|
+
field :data, -> { Internal::Types::Array[Schematic::Types::BillingInvoiceResponseData] }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :params, -> { Schematic::Billing::Types::ListNativeInvoicesParams }, optional: false, nullable: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Billing
|
|
5
|
+
module Types
|
|
6
|
+
class MarkInvoicePaidRequestBody < Internal::Types::Model
|
|
7
|
+
field :invoice_id, -> { String }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :amount, -> { Integer }, optional: true, nullable: false
|
|
10
|
+
|
|
11
|
+
field :idempotency_key, -> { String }, optional: false, nullable: false
|
|
12
|
+
|
|
13
|
+
field :reference, -> { String }, optional: true, nullable: false
|
|
14
|
+
|
|
15
|
+
field :settled_at, -> { String }, optional: true, nullable: false
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Billing
|
|
5
|
+
module Types
|
|
6
|
+
class MarkNativeInvoicePaidResponse < Internal::Types::Model
|
|
7
|
+
field :data, -> { Schematic::Types::BillingInvoiceDetailResponseData }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|