diff --git a/Demo/Podfile.lock b/Demo/Podfile.lock index 60960d7..8eb7bb7 100644 --- a/Demo/Podfile.lock +++ b/Demo/Podfile.lock @@ -22,16 +22,16 @@ PODS: - AFNetworking/NSURLSession - librato-iOS (1.2.2): - AFNetworking (~> 2.0) - - Mantle (~> 1.3) - - Mantle (1.5.8): - - Mantle/extobjc (= 1.5.8) - - Mantle/extobjc (1.5.8) + - Mantle (~> 2.1) + - Mantle (2.1.0): + - Mantle/extobjc (= 2.1.0) + - Mantle/extobjc (2.1.0) DEPENDENCIES: - librato-iOS (from `../librato-iOS.podspec`) SPEC REPOS: - https://github.com/CocoaPods/Specs.git: + https://github.com/cocoapods/specs.git: - AFNetworking - Mantle @@ -41,9 +41,9 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60 - librato-iOS: ac4f9b431c771cccc0719e8bdade35648fac507d - Mantle: f03b2b606c3f0cabd80214ad8a2fed6b464a7359 + librato-iOS: e66bc97e62ef9aa7ca8b94ed318595c8b86cc81d + Mantle: 2fa750afa478cd625a94230fbf1c13462f29395b PODFILE CHECKSUM: 5817b13129eeec85d2fa75a097e506a23de0ee12 -COCOAPODS: 1.5.0 +COCOAPODS: 1.5.3 diff --git a/librato-iOS.podspec b/librato-iOS.podspec index 2c99b2e..367ce76 100644 --- a/librato-iOS.podspec +++ b/librato-iOS.podspec @@ -18,5 +18,5 @@ Pod::Spec.new do |s| s.requires_arc = true s.dependency 'AFNetworking', '~> 2.0' - s.dependency 'Mantle', '~> 1.3' + s.dependency 'Mantle', '~> 2.1' end diff --git a/librato-iOS/Metrics/LibratoGaugeMetric.m b/librato-iOS/Metrics/LibratoGaugeMetric.m index 16ee6df..5de2cbc 100644 --- a/librato-iOS/Metrics/LibratoGaugeMetric.m +++ b/librato-iOS/Metrics/LibratoGaugeMetric.m @@ -71,9 +71,7 @@ + (NSDictionary *)JSONKeyPathsByPropertyKey @"sum": sumKey, @"min": minKey, @"max": maxKey, - @"squares": squaresKey, - @"type": NSNull.null, - LibratoMetricValueKey: NSNull.null + @"squares": squaresKey }; } diff --git a/librato-iOS/Metrics/LibratoMetric.m b/librato-iOS/Metrics/LibratoMetric.m index c5a2885..e7570d0 100644 --- a/librato-iOS/Metrics/LibratoMetric.m +++ b/librato-iOS/Metrics/LibratoMetric.m @@ -61,17 +61,16 @@ + (NSDictionary *)JSONKeyPathsByPropertyKey @"name": LibratoMetricNameKey, @"value": LibratoMetricValueKey, @"measureTime": LibratoMetricMeasureTimeKey, - @"source": LibratoMetricSourceKey, - @"type": NSNull.null + @"source": LibratoMetricSourceKey }; } + (NSValueTransformer *)measureTimeJSONTransformer { - return [MTLValueTransformer reversibleTransformerWithForwardBlock:^id(NSNumber *epoch) { + return [MTLValueTransformer transformerUsingForwardBlock:^id(NSNumber *epoch, BOOL *success, NSError **error) { return [NSDate dateWithTimeIntervalSince1970:epoch.integerValue]; - } reverseBlock:^id(NSDate *date) { + } reverseBlock:^id(NSDate *date, BOOL *success, NSError **error) { return @(floor(date.timeIntervalSince1970)); }]; } @@ -79,10 +78,10 @@ + (NSValueTransformer *)measureTimeJSONTransformer + (NSValueTransformer *)nameJSONTransformer { - return [MTLValueTransformer reversibleTransformerWithForwardBlock:^id(NSString *name) { + return [MTLValueTransformer transformerUsingForwardBlock:^id(NSString *name, BOOL *success, NSError **error) { NSAssert(name.length > 0, @"Measurements must be named"); return name.alm_sanitizedForMetric; - } reverseBlock:^id(NSString *name) { + } reverseBlock:^id(NSString *name, BOOL *success, NSError **error) { return name.alm_sanitizedForMetric; }]; } @@ -90,9 +89,9 @@ + (NSValueTransformer *)nameJSONTransformer + (NSValueTransformer *)sourceJSONTransformer { - return [MTLValueTransformer reversibleTransformerWithForwardBlock:^id(NSString *source) { + return [MTLValueTransformer transformerUsingForwardBlock:^id(NSString *source, BOOL *success, NSError **error) { return source.alm_sanitizedForMetric; - } reverseBlock:^id(NSString *source) { + } reverseBlock:^id(NSString *source, BOOL *success, NSError **error) { return (source.length ? source.alm_sanitizedForMetric : nil); }]; } @@ -100,10 +99,10 @@ + (NSValueTransformer *)sourceJSONTransformer + (NSValueTransformer *)valueJSONTransformer { - return [MTLValueTransformer reversibleTransformerWithForwardBlock:^id(NSNumber *value) { + return [MTLValueTransformer transformerUsingForwardBlock:^id(NSNumber *value, BOOL *success, NSError **error) { NSAssert([self.class isValidValue:value], @"Boolean is not a valid metric value"); return value; - } reverseBlock:^id(NSNumber *value) { + } reverseBlock:^id(NSNumber *value, BOOL *success, NSError **error) { return value; }]; } @@ -113,7 +112,7 @@ + (NSValueTransformer *)valueJSONTransformer - (NSDictionary *)JSONDictionary { NSArray *nonNullableKeys = @[@"source"]; - __block NSMutableDictionary *jsonDict = [MTLJSONAdapter JSONDictionaryFromModel:self].mutableCopy; + __block NSMutableDictionary *jsonDict = [MTLJSONAdapter JSONDictionaryFromModel:self error:nil].mutableCopy; [nonNullableKeys enumerateObjectsUsingBlock:^(NSString *key, NSUInteger idx, BOOL *stop) { if ([jsonDict.allKeys containsObject:key] && (jsonDict[key] == NSNull.null || jsonDict[key] == nil)) {