BaseAPI

@interface BaseAPI : NSObject <RipeAPI, BrandAPI, BuildAPI, SizeAPI>

This class contains the main API class that should be extended by other APIs.

  • The Ripe instance that is using the API.

    Declaration

    Objective-C

    @property (assign, readwrite, atomic) Ripe *_Nonnull owner;

    Swift

    var owner: Ripe { get set }
  • An options map that can be used to configure the API.

    Declaration

    Objective-C

    @property (assign, readwrite, atomic) NSDictionary *_Nonnull options;

    Swift

    var options: [AnyHashable : Any] { get set }
  • Base constructor for the API.

    Declaration

    Objective-C

    - (nonnull id)initWithOwner:(nonnull Ripe *)owner
                        options:(nonnull NSDictionary *)options;

    Swift

    init(owner: Ripe, options: [AnyHashable : Any] = [:])

    Parameters

    owner

    The Ripe instance that will use this API.

    options

    An options map that can be used to configure the API.

    Return Value

    The API instance created.

  • Returns the configuration information of the owner’s current model. To retrieve the configuration of a specific model the method getConfig:callback: should be used.

    To retrieve the configuration of a specific model the method -[BrandAPI getConfig:callback:] should be used.

    Declaration

    Objective-C

    - (void)getConfig:(nonnull void (^)(NSDictionary *_Nonnull))callback;

    Parameters

    callback

    A callback that will be called with the configuration as argument.

  • Returns the configuration information of a specific brand and model. If no model is provided

    then returns the information of the owner’s current model.

    The options map accepts the following parameters:

    • brand - The brand of the model

    • model - The name of the model

    • country - The country where the model will be provided, some materials/colors might not be available.

    • flag - A specific flag that may change the provided materials/colors available.

    • filter - If the configuration should be filtered by the country and/or flag (defaults TRUE).

    Declaration

    Objective-C

    - (void)getConfig:(NSDictionary *_Nullable)options
             callback:(nonnull void (^)(NSDictionary *_Nonnull))callback;

    Parameters

    options

    A map with options

    callback

    A callback that will be called with the configuration as argument.

  • Returns the configuration information of the owner’s current model.

    To retrieve the configuration of a specific model the method -[BrandAPI getConfigP:callback:] should be used.

    Declaration

    Objective-C

    - (nonnull Promise *)getConfigP;

    Return Value

    A Promise that will be resolved with the configuration.

  • Returns the configuration information of a specific brand and model. If no model is provided

    then returns the information of the owner’s current model.

    The options map accepts the following keys:

    • brand - The brand of the model.

    • model - The name of the model.

    • country - The country where the model will be provided, some materials/colors might not be available.

    • flag - A specific flag that may change the provided materials/colors available.

    • filter - If the configuration should be filtered by the country and/or flag (defaults TRUE).

    Declaration

    Objective-C

    - (nonnull Promise *)getConfigP:(nonnull NSDictionary *)options;

    Parameters

    options

    A map with options.

    Return Value

    A Promise that will be resolved with the configuration.

  • Provides a list of all the available size scales.

    This can be used to know what scales are available for size conversions.

    Declaration

    Objective-C

    - (void)getSizes:(nonnull void (^)(NSDictionary *_Nonnull))callback;

    Parameters

    callback

    A block that receives the size scales list as parameter.

  • Provides a list of all the available size scales.

    This can be used to know what scales are available for size conversions.

    Declaration

    Objective-C

    - (void)getSizes:(nonnull NSDictionary *)options
            callback:(nonnull void (^)(NSDictionary *_Nonnull))callback;

    Parameters

    options

    A map with options to configure the request.

    callback

    A block that receives the size scales list as parameter.

  • Provides a list of all the available size scales.

    This can be used to know what scales are available for size conversions.

    Declaration

    Objective-C

    - (nonnull Promise *)getSizesP;

    Return Value

    A Promise that will be resolved with the size scales list.

  • Provides a list of all the available size scales.

    This can be used to know what scales are available for size conversions.

    Declaration

    Objective-C

    - (nonnull Promise *)getSizesP:(nonnull NSDictionary *)options;

    Parameters

    options

    A map with options to configure the request.

    Return Value

    A Promise that will be resolved with the size scales list.

  • Converts a size value from the native scale to the corresponding value in the specified scale.

    The available scales, genders and sizes can be obtained with the method -[SizeAPI getSizes:]

    Declaration

    Objective-C

    - (void)sizeToNative:(nonnull NSString *)scale
                   value:(double)value
                  gender:(nonnull NSString *)gender
                callback:(nonnull void (^)(NSDictionary *_Nonnull))callback;

    Parameters

    scale

    The scale which one wants to convert to.

    value

    The value which one wants to convert.

    gender

    The gender of the scale and value to be converted.

    callback

    A block that receives the converted value as parameter.

  • Converts a size value from the native scale to the corresponding value in the specified scale.

    The available scales, genders and sizes can be obtained with the method -[SizeAPI getSizes:]

    Declaration

    Objective-C

    - (void)sizeToNative:(nonnull NSString *)scale
                   value:(double)value
                  gender:(nonnull NSString *)gender
                 options:(nonnull NSDictionary *)options
                callback:(nonnull void (^)(NSDictionary *_Nonnull))callback;

    Parameters

    scale

    The scale which one wants to convert to.

    value

    The value which one wants to convert.

    gender

    The gender of the scale and value to be converted.

    options

    A map with options to configure the request.

    callback

    A block that receives the converted value as parameter.

  • Converts a size value from the native scale to the corresponding value in the specified scale.

    The available scales, genders and sizes can be obtained with the method -[SizeAPI getSizesP:]

    Declaration

    Objective-C

    - (nonnull Promise *)sizeToNativeP:(nonnull NSString *)scale
                                 value:(double)value
                                gender:(nonnull NSString *)gender;

    Parameters

    scale

    The scale which one wants to convert to.

    value

    The value which one wants to convert.

    gender

    The gender of the scale and value to be converted.

    Return Value

    A Promise that will resolve with the converted value.

  • Converts a size value from the native scale to the corresponding value in the specified scale.

    The available scales, genders and sizes can be obtained with the method -[SizeAPI getSizesP:]

    Declaration

    Objective-C

    - (nonnull Promise *)sizeToNativeP:(nonnull NSString *)scale
                                 value:(double)value
                                gender:(nonnull NSString *)gender
                               options:(nonnull NSDictionary *)options;

    Parameters

    scale

    The scale which one wants to convert to.

    value

    The value which one wants to convert.

    gender

    The gender of the scale and value to be converted.

    options

    A map with options to configure the request.

    Return Value

    A Promise that will resolve with the converted value.

  • Converts multiple size values from the native scale to the corresponding values in the specified scales.

    The available scales, genders and sizes can be obtained with the method -[SizeAPI getSizes:]

    Declaration

    Objective-C

    - (void)sizeToNativeB:(nonnull NSArray *)scales
                   values:(nonnull NSArray *)values
                  genders:(nonnull NSArray *)genders
                 callback:(nonnull void (^)(NSArray *_Nonnull))callback;

    Parameters

    scales

    A list of scales to convert to.

    values

    A list of values to convert.

    genders

    A list of genders corresponding to the values.

    callback

    A block that receives a list with the converted values as an argument.

  • Converts multiple size values from the native scale to the corresponding values in the specified scales.

    The available scales, genders and sizes can be obtained with the method -[SizeAPI getSizes:]

    Declaration

    Objective-C

    - (void)sizeToNativeB:(nonnull NSArray *)scales
                   values:(nonnull NSArray *)values
                  genders:(nonnull NSArray *)genders
                  options:(nonnull NSDictionary *)options
                 callback:(nonnull void (^)(NSArray *_Nonnull))callback;

    Parameters

    scales

    A list of scales to convert to.

    values

    A list of values to convert.

    genders

    A list of genders corresponding to the values.

    options

    A map with options to configure the request.

    callback

    A block that receives a list with the converted values as an argument.

  • Converts multiple size values from the native scale to the corresponding values in the specified scales.

    The available scales, genders and sizes can be obtained with the method -[SizeAPI getSizesP:]

    Declaration

    Objective-C

    - (nonnull Promise *)sizeToNativeBP:(nonnull NSArray *)scales
                                 values:(nonnull NSArray *)values
                                genders:(nonnull NSArray *)genders;

    Parameters

    scales

    A list of scales to convert to.

    values

    A list of values to convert.

    genders

    A list of genders corresponding to the values.

    Return Value

    A Promise that will resolve with a list with the converted values.

  • Converts multiple size values from the native scale to the corresponding values in the specified scales.

    The available scales, genders and sizes can be obtained with the method -[SizeAPI getSizesP:]

    Declaration

    Objective-C

    - (nonnull Promise *)sizeToNativeBP:(nonnull NSArray *)scales
                                 values:(nonnull NSArray *)values
                                genders:(nonnull NSArray *)genders
                                options:(nonnull NSDictionary *)options;

    Parameters

    scales

    A list of scales to convert to.

    values

    A list of values to convert.

    genders

    A list of genders corresponding to the values.

    options

    A map with options to configure the request.

    Return Value

    A Promise that will resolve with a list with the converted values.

  • Converts a size value in the specified scale to the corresponding native size.

    The available scales, genders and sizes can be obtained with the method -[SizeAPI getSizes:]

    Declaration

    Objective-C

    - (void)nativeToSize:(nonnull NSString *)scale
                   value:(double)value
                  gender:(nonnull NSString *)gender
                callback:(nonnull void (^)(NSDictionary *_Nonnull))callback;

    Parameters

    scale

    The scale which one wants to convert from.

    value

    The value which one wants to convert.

    gender

    The gender of the scale and value to be converted.

    callback

    A block that receives the native value as parameter.

  • Converts a size value in the specified scale to the corresponding native size.

    The available scales, genders and sizes can be obtained with the method -[SizeAPI getSizes:]

    Declaration

    Objective-C

    - (void)nativeToSize:(nonnull NSString *)scale
                   value:(double)value
                  gender:(nonnull NSString *)gender
                 options:(nonnull NSDictionary *)options
                callback:(nonnull void (^)(NSDictionary *_Nonnull))callback;

    Parameters

    scale

    The scale which one wants to convert from.

    value

    The value which one wants to convert.

    gender

    The gender of the scale and value to be converted.

    options

    A map with options to configure the request.

    callback

    A block that receives the native value as parameter.

  • Converts a size value in the specified scale to the corresponding native size.

    The available scales, genders and sizes can be obtained with the method -[SizeAPI getSizesP:]

    Declaration

    Objective-C

    - (nonnull Promise *)nativeToSizeP:(nonnull NSString *)scale
                                 value:(double)value
                                gender:(nonnull NSString *)gender;

    Parameters

    scale

    The scale which one wants to convert from.

    value

    The value which one wants to convert.

    gender

    The gender of the scale and value to be converted.

    Return Value

    A Promise that will resolve with the native value.

  • Converts a size value in the specified scale to the corresponding native size.

    The available scales, genders and sizes can be obtained with the method -[SizeAPI getSizesP:]

    Declaration

    Objective-C

    - (nonnull Promise *)nativeToSizeP:(nonnull NSString *)scale
                                 value:(double)value
                                gender:(nonnull NSString *)gender
                               options:(nonnull NSDictionary *)options;

    Parameters

    scale

    The scale which one wants to convert from.

    value

    The value which one wants to convert.

    gender

    The gender of the scale and value to be converted.

    Return Value

    A Promise that will resolve with the native value.

  • Converts multiple size values to the corresponding native size.

    The available scales, genders and sizes can be obtained with the method -[SizeAPI getSizes:]

    Declaration

    Objective-C

    - (void)nativeToSizeB:(nonnull NSArray *)scales
                   values:(nonnull NSArray *)values
                  genders:(nonnull NSArray *)genders
                 callback:(nonnull void (^)(NSArray *_Nonnull))callback;

    Parameters

    scales

    A list of scales to convert from.

    values

    A list of values to convert.

    genders

    A list of genders corresponding to the values.

    callback

    A block that receives a list with the native values as an argument.

  • Converts multiple size values to the corresponding native size.

    The available scales, genders and sizes can be obtained with the method -[SizeAPI getSizes:]

    Declaration

    Objective-C

    - (void)nativeToSizeB:(nonnull NSArray *)scales
                   values:(nonnull NSArray *)values
                  genders:(nonnull NSArray *)genders
                  options:(nonnull NSDictionary *)options
                 callback:(nonnull void (^)(NSArray *_Nonnull))callback;

    Parameters

    scales

    A list of scales to convert to.

    values

    A list of values to convert.

    genders

    A list of genders corresponding to the values.

    options

    A map with options to configure the request.

    callback

    A block that receives a list with the converted values as an argument.

  • Converts multiple size values to the corresponding native size.

    The available scales, genders and sizes can be obtained with the method -[SizeAPI getSizes:]

    Declaration

    Objective-C

    - (nonnull Promise *)nativeToSizeBP:(nonnull NSArray *)scales
                                 values:(nonnull NSArray *)values
                                genders:(nonnull NSArray *)genders;

    Parameters

    scales

    A list of scales to convert from.

    values

    A list of values to convert.

    genders

    A list of genders corresponding to the values.

    Return Value

    A Promise that will resolve with a list with the native values.

  • Converts multiple size values to the corresponding native size.

    The available scales, genders and sizes can be obtained with the method -[SizeAPI getSizesP:]

    Declaration

    Objective-C

    - (nonnull Promise *)nativeToSizeBP:(nonnull NSArray *)scales
                                 values:(nonnull NSArray *)values
                                genders:(nonnull NSArray *)genders
                                options:(nonnull NSDictionary *)options;

    Parameters

    scales

    A list of scales to convert to.

    values

    A list of values to convert.

    genders

    A list of genders corresponding to the values.

    options

    A map with options to configure the request.

    Return Value

    A Promise that will resolve with a list with the native values.