@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
1515<!-- x-release-please-start-version -->
1616
1717``` ruby
18- gem " amocrm" , " ~> 0.3 .0"
18+ gem " amocrm" , " ~> 0.4 .0"
1919```
2020
2121<!-- x-release-please-end -->
@@ -31,7 +31,7 @@ amocrm = Amocrm::Client.new(
3131 subdomain: " My-Subdomain"
3232)
3333
34- response = amocrm.v4.leads.unsorted.create_forms (
34+ response = amocrm.v4.unsorted_leads_create_forms (
3535 body: [{metadata: {}, source_name: " source_name" , source_uid: " source_uid" }]
3636)
3737
@@ -44,7 +44,7 @@ When the library is unable to connect to the API, or if the API returns a non-su
4444
4545``` ruby
4646begin
47- unsorted = amocrm.v4.leads.unsorted.create_forms (
47+ v4 = amocrm.v4.unsorted_leads_create_forms (
4848 body: [{metadata: {}, source_name: " source_name" , source_uid: " source_uid" }]
4949 )
5050rescue Amocrm ::Errors ::APIConnectionError => e
@@ -90,7 +90,7 @@ amocrm = Amocrm::Client.new(
9090)
9191
9292# Or, configure per-request:
93- amocrm.v4.leads.unsorted.create_forms (
93+ amocrm.v4.unsorted_leads_create_forms (
9494 body: [{metadata: {}, source_name: " source_name" , source_uid: " source_uid" }],
9595 request_options: {max_retries: 5 }
9696)
@@ -108,7 +108,7 @@ amocrm = Amocrm::Client.new(
108108)
109109
110110# Or, configure per-request:
111- amocrm.v4.leads.unsorted.create_forms (
111+ amocrm.v4.unsorted_leads_create_forms (
112112 body: [{metadata: {}, source_name: " source_name" , source_uid: " source_uid" }],
113113 request_options: {timeout: 5 }
114114)
@@ -142,7 +142,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete
142142
143143``` ruby
144144response =
145- amocrm.v4.leads.unsorted.create_forms (
145+ amocrm.v4.unsorted_leads_create_forms (
146146 body: [{metadata: {}, source_name: " source_name" , source_uid: " source_uid" }],
147147 request_options: {
148148 extra_query: {my_query_parameter: value},
@@ -189,10 +189,10 @@ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitio
189189You can provide typesafe request parameters like so:
190190
191191``` ruby
192- amocrm.v4.leads.unsorted.create_forms (
192+ amocrm.v4.unsorted_leads_create_forms (
193193 body: [
194- Amocrm ::V4 :: Leads :: UnsortedCreateFormsParams ::Body .new (
195- metadata: Amocrm ::V4 :: Leads :: UnsortedCreateFormsParams ::Body ::Metadata .new ,
194+ Amocrm ::V4UnsortedLeadsCreateFormsParams ::Body .new (
195+ metadata: Amocrm ::V4UnsortedLeadsCreateFormsParams ::Body ::Metadata .new ,
196196 source_name: " source_name" ,
197197 source_uid: " source_uid"
198198 )
@@ -204,21 +204,49 @@ Or, equivalently:
204204
205205``` ruby
206206# Hashes work, but are not typesafe:
207- amocrm.v4.leads.unsorted.create_forms (
207+ amocrm.v4.unsorted_leads_create_forms (
208208 body: [{metadata: {}, source_name: " source_name" , source_uid: " source_uid" }]
209209)
210210
211211# You can also splat a full Params class:
212- params = Amocrm ::V4 :: Leads :: UnsortedCreateFormsParams .new (
212+ params = Amocrm ::V4UnsortedLeadsCreateFormsParams .new (
213213 body: [
214- Amocrm ::V4 :: Leads :: UnsortedCreateFormsParams ::Body .new (
215- metadata: Amocrm ::V4 :: Leads :: UnsortedCreateFormsParams ::Body ::Metadata .new ,
214+ Amocrm ::V4UnsortedLeadsCreateFormsParams ::Body .new (
215+ metadata: Amocrm ::V4UnsortedLeadsCreateFormsParams ::Body ::Metadata .new ,
216216 source_name: " source_name" ,
217217 source_uid: " source_uid"
218218 )
219219 ]
220220)
221- amocrm.v4.leads.unsorted.create_forms(** params)
221+ amocrm.v4.unsorted_leads_create_forms(** params)
222+ ```
223+
224+ ### Enums
225+
226+ Since this library does not depend on ` sorbet-runtime ` , it cannot provide [ ` T::Enum ` ] ( https://sorbet.org/docs/tenum ) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:
227+
228+ ``` ruby
229+ # :segments
230+ puts (Amocrm ::V4CustomersModeSetModeParams ::Mode ::SEGMENTS )
231+
232+ # Revealed type: `T.all(Amocrm::V4CustomersModeSetModeParams::Mode, Symbol)`
233+ T .reveal_type(Amocrm ::V4CustomersModeSetModeParams ::Mode ::SEGMENTS )
234+ ```
235+
236+ Enum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:
237+
238+ ``` ruby
239+ # Using the enum constants preserves the tagged type information:
240+ amocrm.v4.customers_mode_set_mode(
241+ mode: Amocrm ::V4CustomersModeSetModeParams ::Mode ::SEGMENTS ,
242+ # …
243+ )
244+
245+ # Literal values are also permissible:
246+ amocrm.v4.customers_mode_set_mode(
247+ mode: :segments ,
248+ # …
249+ )
222250```
223251
224252## Versioning
0 commit comments