marianitadn/foregit — pull request #4 by marianitadn (2014-05-31 12:51:17+00:00)
Title: Create API binding to Foreman 

## Need

```gherkin
As a developer
I want to create a API class to connect to the Foreman instance
So that I can download/upload the configuration files
```

## Deliverables
- an API binding class which can be used to download or upload resources configurations between Foreman and the local project

## Solution

#### Prerequisites
- [Settings class example](https://github.com/theforeman/smart-proxy/blob/develop/lib/proxy/settings.rb)
- [how to use apipie-bindings for Foreman](https://github.com/theforeman/puppet-foreman/blob/master/lib/puppet/provider/foreman_smartproxy/rest_v2.rb#L11-L21) & [call example](https://github.com/theforeman/puppet-foreman/blob/master/lib/puppet/provider/foreman_smartproxy/rest_v2.rb#L42-L45)
- [How to define an API class](https://github.com/opscode/chef/blob/master/lib/chef/api_client.rb)

#### TODO
- [ ] create config file to store API credentials (and other configurations which we will need later on)
- [ ] create main API class to connect through apipie-bindings to Foreman API
- [ ] create class to download configuration from Foreman through API endpoints - [example](https://github.com/opscode/chef/blob/master/lib/chef/knife/download.rb)
- [ ] create class to upload configuration to Foreman through API endpoints (the same as above but with POST/PUT/PATCH) - [example](https://github.com/opscode/chef/blob/master/lib/chef/knife/upload.rb)

#### Files
- lib/foreman/api.rb
- lib/foreman/download.rb
- lib/foreman/upload.rb
- config/settings.yaml
- lib/settings.rb

#### Notes
- [peculiar aspect relevant this story]

#### #ETA [0-2]p