etsy OAuth complete, getting error in response block however

This commit is contained in:
Okechi Onyeje 2016-06-01 06:10:51 -04:00
parent 3cd0da8977
commit 0ab59c5d7b
6 changed files with 160 additions and 12 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -67,5 +67,133 @@
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/NetworksTableViewController.swift"
timestampString = "486467691.902354"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "399"
endingLineNumber = "399"
landmarkName = "tableView(_:didSelectRowAtIndexPath:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/EtsyRESTAPIManager.swift"
timestampString = "486467803.784775"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "52"
endingLineNumber = "52"
landmarkName = "authorizeApp(_:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/EtsyRESTAPIManager.swift"
timestampString = "486467838.042152"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "66"
endingLineNumber = "66"
landmarkName = "authorizeApp(_:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/EtsyRESTAPIManager.swift"
timestampString = "486468123.916868"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "82"
endingLineNumber = "82"
landmarkName = "authorizeApp(_:)"
landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.EtsyRESTAPIManager.authorizeApp (__ObjC.UIViewController) -&gt; ()"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/EtsyRESTAPIManager.swift"
timestampString = "486468325.641074"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "82"
endingLineNumber = "82"
offsetFromSymbolStart = "1371">
</Location>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Vendoo.EtsyRESTAPIManager.(authorizeApp (__ObjC.UIViewController) -&gt; ()).(closure #3)"
moduleName = "Vendoo"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/okechi/Documents/iOs%20Practice/Vendoo/Vendoo_bb/Vendoo/Vendoo/EtsyRESTAPIManager.swift"
timestampString = "486468325.641241"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "84"
endingLineNumber = "84"
offsetFromSymbolStart = "23">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/EtsyRESTAPIManager.swift"
timestampString = "486468325.45733"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "86"
endingLineNumber = "86"
landmarkName = "authorizeApp(_:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Vendoo/EtsyRESTAPIManager.swift"
timestampString = "486468341.941555"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "84"
endingLineNumber = "84"
landmarkName = "authorizeApp(_:)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@ -48,23 +48,24 @@ class EtsyRESTAPIManager: NSObject {
//Mark: - OAuth Methods
extension EtsyRESTAPIManager {
//makes application ready for use with users ebay account
//makes application ready for use with users etsy account
func authorizeApp(viewcontroller: UIViewController){
/*
let oauthswift = OAuth1Swift(parameters: ["consumerKey":"snbs78qkfy3yqq6yhe6yv49b","consumerSecret":"4sbva4oqb6", "requestTokenUrl" : "https://openapi.etsy.com/v2/oauth/request_token?scope=listings_w%20listings_r%20listings_d%20transactions_r%20transactions_w",
"authorizeUrl": "",
"accessTokenUrl": ""])
"authorizeUrl": "https://www.etsy.com/oauth/signin?",
"accessTokenUrl": "https://openapi.etsy.com/v2/oauth/access_token?"])
//oauthswift.authorize_url_handler = SafariURLHandler(viewController: viewcontroller)
oauthswift!.authorize_url_handler = SafariURLHandler(viewController: viewcontroller)
oauthswift!.client.get("https://openapi.etsy.com/v2/oauth/request_token?scope=listings_w%20listings_r%20listings_d%20transactions_r%20transactions_w",
success: {
data, response in
let dataString = NSString(data: data, encoding: NSUTF8StringEncoding)
print(dataString!)
print(response)
@ -78,14 +79,16 @@ extension EtsyRESTAPIManager {
}
)
oauthswift!.authorizeWithCallbackURL( NSURL(string: "oauth-swift://oauth-callback/etsy")!, success: {
oauthswift!.authorizeWithCallbackURL( NSURL(string: "vendoo://oauth-callback/etsy")!, success: {
credential, response, parameters in
print(credential.oauth_token)
print(credential.oauth_token_secret)
print(response)
}, failure: { error in
print(error.localizedDescription)
print(error)
})
*/
//once everything is authorized save true value to the authorization boolean
/*

View File

@ -30,6 +30,16 @@
<string>fb504150909777657</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>com.Kroleo.Vendoo</string>
<key>CFBundleURLSchemes</key>
<array>
<string>vendoo</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>

View File

@ -92,11 +92,18 @@ extension ListingPreviewViewController {
@IBAction func publishItem(sender: AnyObject) {
//publish items to facebook if it is selected
if(self.networksDictionary["facebook"] == true){
let str = "**"+self.itemTitle.text!+"**"+"\n\n"+"Sellng for: "+self.itemPrice.text!+"\n\n"+self.itemDescription.text!
let parameters = ["message":str]
self.graphManager.makePOSTResquest("me/feed", params: parameters)
}else if(self.networksDictionary["etsy"] == true){
}
}
@IBAction func draftItem(sender: AnyObject) {