Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add consumer key & shared secret for OAuth signing.

  • Loading branch information...
commit 28be81e58feaf734a18a4ddd534e8ad132206181 1 parent 1ea4af0
@lenards lenards authored
Showing with 34 additions and 2 deletions.
  1. +9 −2 libechonest/src/ENAPI.h
  2. +25 −0 libechonest/src/ENAPI.m
View
11 libechonest/src/ENAPI.h
@@ -36,11 +36,18 @@ extern NSString * const ENSortWeight;
extern NSString * const ENSortFrequency;
@interface ENAPI : NSObject {
-
+
}
+ (void)initWithApiKey:(NSString *)apiKey;
+/**
+ * Consumer key and shared secret are required if calling OAuth secured endpoints. Example: "sandbox/access"
+ */
++ (void)initWithApiKey:(NSString *)apiKey ConsumerKey:(NSString *)consumerKey AndSharedSecret:(NSString *)secret;
+ (NSString *)apiKey;
-
++ (NSString *)consumerKey;
++ (void)setConsumerKey:(NSString *)key;
++ (NSString *)sharedSecret;
++ (void)setSharedSecret:(NSString *)secret;
@end
View
25 libechonest/src/ENAPI.m
@@ -26,6 +26,8 @@
NSString * const ENSortFrequency = @"frequency";
static NSString *EN_API_KEY = nil;
+static NSString *EN_CONSUMER_KEY = nil;
+static NSString *EN_SHARED_SECRET = nil;
@implementation ENAPI
@@ -33,8 +35,31 @@ + (void)initWithApiKey:(NSString *)apiKey {
EN_API_KEY = [apiKey retain];
}
++ (void)initWithApiKey:(NSString *)apiKey ConsumerKey:(NSString *)consumerKey
+ AndSharedSecret:(NSString *)secret {
+ [ENAPI initWithApiKey:apiKey];
+ [ENAPI setConsumerKey:consumerKey];
+ [ENAPI setSharedSecret:secret];
+}
+
+ (NSString *)apiKey {
return EN_API_KEY;
}
++ (NSString *)consumerKey {
+ return EN_CONSUMER_KEY;
+}
+
++ (void)setConsumerKey:(NSString *)key {
+ EN_CONSUMER_KEY = [key retain];
+}
+
++ (NSString *)sharedSecret {
+ return EN_SHARED_SECRET;
+}
+
++ (void)setSharedSecret:(NSString *)secret {
+ EN_SHARED_SECRET = [secret retain];
+}
+
@end
Please sign in to comment.
Something went wrong with that request. Please try again.