Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block-based interface to the iOS SDK's REST API. #24

Merged
merged 21 commits into from
Jan 10, 2012
Merged

Block-based interface to the iOS SDK's REST API. #24

merged 21 commits into from
Jan 10, 2012

Conversation

jhersh
Copy link
Contributor

@jhersh jhersh commented Jan 3, 2012

I wrote a new block-based interface for issuing and receiving responses to REST requests sent through the iOS SDK. It's contained within a new Blocks category on SFRestAPI.

The block methods exposed here should follow exactly the methods defined in SFRestAPI with one exception: my version of requestForRetrieveWithObjectType:objectId:fieldList: takes an NSArray instead of a comma-separated NSString for the fieldList. My version performs the comma-separation automatically and also eliminates duplicate fields specified in the array.

Using a block method to describe global:

    completeBlock:^(NSDictionary *results) {
        NSLog(@"results %@", results);
    }];

Or to run a query:

failBlock:nil 
completeBlock:^(NSDictionary *results) {
        NSLog(@"results %@", results);
    }];

@khawkins
Copy link
Contributor

khawkins commented Jan 4, 2012

Hey Jonathan, what's the significance of the 'V' in the 'SFV' prefix that you're using?

Conflicts:
	native/SalesforceSDK/SalesforceSDK/Classes/SFRestAPI+Blocks.m
	native/SalesforceSDK/SalesforceSDK/Classes/SynthesizeSingleton.h
@khawkins
Copy link
Contributor

khawkins commented Jan 4, 2012

In addition to unit tests, we'll want to add AppleDoc-formatted documentation for all public members/interfaces.

@jhersh
Copy link
Contributor Author

jhersh commented Jan 4, 2012

Just refactored the block methods to use a category and eliminate the need for a singleton. Should hopefully reduce unit test requirements too.

SFV = Salesforce Viewer. It was named as such because this originally started as something I wrote for myself for use in SFV. :) This latest refactoring removes any references to SFV.

@khawkins
Copy link
Contributor

khawkins commented Jan 4, 2012

Ah, Salesforce Viewer. It's all clear to me now. :)

@NachoMan
Copy link

NachoMan commented Jan 4, 2012

You might want to return the request that was created, instead of (void). That way you have a way to cancel the operation if necessary.

@jhersh
Copy link
Contributor Author

jhersh commented Jan 4, 2012

Unit tests and docs should now be in place. How's it all looking?

@khawkins
Copy link
Contributor

khawkins commented Jan 4, 2012

It's looking pretty good; I'm still poking through some of the details. One of the things I think would be good would be to change the SFV prefix on the block types, just because it doesn't have any particular context in this case.

@jhersh
Copy link
Contributor Author

jhersh commented Jan 4, 2012

Whoops, right you are. Should be fixed now

@khawkins
Copy link
Contributor

khawkins commented Jan 5, 2012

There are some compile-time errors in the unit tests. If you "Build for Testing", you'll see them; they're all pretty straightforward to fix, I think.

@khawkins
Copy link
Contributor

khawkins commented Jan 5, 2012

This is looking good to me. Unit tests are passing. @tstellanova-sfdc did you have any further comments/suggestions/scrutinies?

@tstellanova-sfdc
Copy link
Contributor

Test coverage is looking good. I'll merge these changes in and then see about adding tests for cancel and timeout.

Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants