Monday, January 14, 2013

Re: API Help / Component / Vendor / Plugin?

Just think, how many ways are there to cook steak?
Broil, Fry, Smoke, BBQ etc. and they all taste equally as good.

For example, I have the Facebook Graph API packaged as a vendor file, and the actual interaction with the object is handled as a Singleton. ( Tight Deadline on that )

Another example, is I have our credit card gateways wrapped in our own API using a facade pattern to abstract the functionality that we needed, and so we would be able to switch out our gateways ( or load balance ) without affecting the functional code that is using the card charging system ( I had more time to do this )

I would take a step back on integrating the API as a component, due to the fact that you are locking yourself into interacting with the API on the controller level.

If might be a better idea, to package the API as a vendor, and integrate its functionality in your MODEL layer, so you can leverage the API in more layers of your application.

I could be wrong, but that's just my opinion at first glance.

On Jan 14, 2013, at 4:07 PM, Advantage+ <movepixels@gmail.com> wrote:

I need to integrate a FitBit API class into Cake and I have never done this before so just looking for some tips to point me in the right direction.
 
 
Modify the file name to Fitbit.php place in Controllers / Components and :
class FitbitComponent extends Component {
……
}
 
Reference it in the needed controller:
public $components = array('Fitbit');
 
and call its methods as normal?
 
$profile = $this->Fitbit-> getProfile();
Do what ever……..
 
Any insight to get me going would be greatly appreciated.
 
Thanks,
Dave
 

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
--- 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: