@@ -23,7 +23,7 @@ class << self
2323 #
2424 # @return [Hash{Symbol=>Hash{Symbol=>Object}}]
2525 def known_fields
26- @known_fields ||= ( self < FinchAPI ::BaseModel ? superclass . known_fields . dup : { } )
26+ @known_fields ||= ( self < FinchAPI ::Internal :: Type :: BaseModel ? superclass . known_fields . dup : { } )
2727 end
2828
2929 # @api private
@@ -67,10 +67,10 @@ def fields
6767 const = if required && !nilable
6868 info . fetch (
6969 :const ,
70- FinchAPI ::Internal ::Util :: OMIT
70+ FinchAPI ::Internal ::OMIT
7171 )
7272 else
73- FinchAPI ::Internal ::Util :: OMIT
73+ FinchAPI ::Internal ::OMIT
7474 end
7575
7676 [ name_sym , setter ] . each { undef_method ( _1 ) } if known_fields . key? ( name_sym )
@@ -89,7 +89,7 @@ def fields
8989
9090 define_method ( name_sym ) do
9191 target = type_fn . call
92- value = @data . fetch ( name_sym ) { const == FinchAPI ::Internal ::Util :: OMIT ? nil : const }
92+ value = @data . fetch ( name_sym ) { const == FinchAPI ::Internal ::OMIT ? nil : const }
9393 state = { strictness : :strong , exactness : { yes : 0 , no : 0 , maybe : 0 } , branched : 0 }
9494 if ( nilable || !required ) && value . nil?
9595 nil
@@ -105,7 +105,7 @@ def fields
105105 # rubocop:disable Layout/LineLength
106106 message = "Failed to parse #{ cls } .#{ __method__ } from #{ value . class } to #{ target . inspect } . To get the unparsed API response, use #{ cls } [:#{ __method__ } ]."
107107 # rubocop:enable Layout/LineLength
108- raise FinchAPI ::ConversionError . new ( message )
108+ raise FinchAPI ::Errors :: ConversionError . new ( message )
109109 end
110110 end
111111
@@ -175,7 +175,7 @@ def optional(name_sym, type_info, spec = {})
175175 # @param other [Object]
176176 #
177177 # @return [Boolean]
178- def ==( other ) = other . is_a? ( Class ) && other <= FinchAPI ::BaseModel && other . fields == fields
178+ def ==( other ) = other . is_a? ( Class ) && other <= FinchAPI ::Internal :: Type :: BaseModel && other . fields == fields
179179 end
180180
181181 # @param other [Object]
@@ -186,7 +186,7 @@ def ==(other) = self.class == other.class && @data == other.to_h
186186 class << self
187187 # @api private
188188 #
189- # @param value [FinchAPI::BaseModel, Hash{Object=>Object}, Object]
189+ # @param value [FinchAPI::Internal::Type:: BaseModel, Hash{Object=>Object}, Object]
190190 #
191191 # @param state [Hash{Symbol=>Object}] .
192192 #
@@ -196,7 +196,7 @@ class << self
196196 #
197197 # @option state [Integer] :branched
198198 #
199- # @return [FinchAPI::BaseModel, Object]
199+ # @return [FinchAPI::Internal::Type:: BaseModel, Object]
200200 def coerce ( value , state :)
201201 exactness = state . fetch ( :exactness )
202202
@@ -221,7 +221,7 @@ def coerce(value, state:)
221221 api_name , nilable , const = field . fetch_values ( :api_name , :nilable , :const )
222222
223223 unless val . key? ( api_name )
224- if required && mode != :dump && const == FinchAPI ::Internal ::Util :: OMIT
224+ if required && mode != :dump && const == FinchAPI ::Internal ::OMIT
225225 exactness [ nilable ? :maybe : :no ] += 1
226226 else
227227 exactness [ :yes ] += 1
@@ -255,7 +255,7 @@ def coerce(value, state:)
255255
256256 # @api private
257257 #
258- # @param value [FinchAPI::BaseModel, Object]
258+ # @param value [FinchAPI::Internal::Type:: BaseModel, Object]
259259 #
260260 # @return [Hash{Object=>Object}, Object]
261261 def dump ( value )
@@ -284,7 +284,7 @@ def dump(value)
284284
285285 known_fields . each_value do |field |
286286 mode , api_name , const = field . fetch_values ( :mode , :api_name , :const )
287- next if mode == :coerce || acc . key? ( api_name ) || const == FinchAPI ::Internal ::Util :: OMIT
287+ next if mode == :coerce || acc . key? ( api_name ) || const == FinchAPI ::Internal ::OMIT
288288 acc . store ( api_name , const )
289289 end
290290
@@ -351,13 +351,13 @@ def to_yaml(*a) = self.class.dump(self).to_yaml(*a)
351351
352352 # Create a new instance of a model.
353353 #
354- # @param data [Hash{Symbol=>Object}, FinchAPI::BaseModel]
354+ # @param data [Hash{Symbol=>Object}, FinchAPI::Internal::Type:: BaseModel]
355355 def initialize ( data = { } )
356356 case FinchAPI ::Internal ::Util . coerce_hash ( data )
357357 in Hash => coerced
358358 @data = coerced
359359 else
360- raise ArgumentError . new ( "Expected a #{ Hash } or #{ FinchAPI ::BaseModel } , got #{ data . inspect } " )
360+ raise ArgumentError . new ( "Expected a #{ Hash } or #{ FinchAPI ::Internal :: Type :: BaseModel } , got #{ data . inspect } " )
361361 end
362362 end
363363
0 commit comments