Skip to content
This repository has been archived by the owner on Mar 22, 2019. It is now read-only.

Commit

Permalink
add Ruby on Rails Fidor API Demo Application (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
neumayr authored and Klaus Meyer committed Apr 27, 2018
1 parent 8fcc7a9 commit 3bdfafe
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 17 deletions.
20 changes: 12 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
# Changelog Fidor Admin API Schema

See [commit messages](https://github.com/fidor/fidor_starter_kits/commits/) for details.

##2016-04
## 2018-04

* add Ruby on Rails Fidor API Demo Application

## 2016-04

* add PHP advanced example

##2016-01
## 2016-01

* remove client_secret usage in params => moved to BasicAuth header

##2015-06
## 2015-06

* fix usage of access_token in api URLs, now set in Authorization Header

##2015-01
## 2015-01

*fix proper TLS handling for node example
* fix proper TLS handling for node example

##2014-12
## 2014-12

* make starter kits use all required oauth params: state, response_type, grant_type


##2014-11
## 2014-11

* init with plain oauth examples for php, ruby, nodejs, golang, java
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014 Georg Leciejewski
Copyright (c) 2018 Fidor Solutions AG

MIT License

Expand Down
7 changes: 4 additions & 3 deletions fidor_starter_kits.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ require 'fidor_starter_kits/version'
Gem::Specification.new do |spec|
spec.name = "fidor_starter_kits"
spec.version = FidorStarterKits::VERSION
spec.authors = ["Georg Leciejewski"]
spec.email = ["dev@fidor.de"]
spec.authors = ["Fidor Solutions AG"]
spec.email = ["connect@fidor.com"]
spec.summary = %q{BETA - Starter Kits for building fidor apps.}
spec.description = %q{Fidor application examples for different languages. They rely on the BETA Version of the API so things may change.}
spec.homepage = ""
Expand All @@ -19,7 +19,8 @@ Gem::Specification.new do |spec|
spec.require_paths = ['lib']

spec.add_runtime_dependency "rubyzip"
spec.add_development_dependency "bundler", "~> 1.5"
spec.add_development_dependency "bundler", "~> 1.16"
spec.add_development_dependency "rake"
spec.add_development_dependency 'rspec'
spec.add_development_dependency 'byebug'
end
6 changes: 3 additions & 3 deletions lib/fidor_starter_kits.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

module FidorStarterKits

STARTER_KITS = %w{ node_tx golang_transactions php_oauth_plain ruby_oauth_plain java_servlet php_advanced }
STARTER_KITS = %w{ ruby_on_rails_api_demo ruby_oauth_plain php_oauth_plain php_advanced golang_transactions java_servlet node_tx }

class << self

Expand Down Expand Up @@ -40,7 +40,7 @@ def build(opts)
FileUtils.copy_entry example_src_path, tmp_src_dir

# read example files and replace placeholder with id/secret
example_files = File.join(tmp_src_dir, "**", "[Ee]xample.*")
example_files = File.join(tmp_src_dir, "**", "{[Ee]xample.*,app.json,.env}")

Dir.glob(example_files) do |example_file|
content = File.read(example_file)
Expand All @@ -53,7 +53,7 @@ def build(opts)
# create zip file in tmp dir
zip_file_path = File.join(tmp_src_dir, "#{app_name}.zip")
Zip::File.open(zip_file_path, Zip::File::CREATE) do |zipfile|
Dir.glob(File.join(tmp_src_dir, '**', '**'), File::FNM_DOTMATCH).each do |file|
Dir.glob(File.join(tmp_src_dir, '**', '**'), File::FNM_DOTMATCH).each do |file|
zipfile.add(file.sub("#{tmp_src_dir}/", ''), file) unless file.end_with? '.'
end
end
Expand Down
1 change: 1 addition & 0 deletions spec/fidor_starter_kits_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@

it 'loads the json meta data' do
conf = FidorStarterKits.all
expect(conf["ruby_on_rails_api_demo"]["display_name"]).to eq("Ruby on Rails Fidor API Demo Application")
expect(conf["golang_transactions"]["display_name"]).to eq("Go Transactions")
expect(conf["node_tx"]["description"]).to eq("NodeJS app getting transactions and accounts. Handling oAuth login.")
expect(conf["php_oauth_plain"]["app_name"]).to eq("php_oauth_plain")
Expand Down
3 changes: 1 addition & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))

require 'rspec'
require 'byebug'
require 'fidor_starter_kits'
RSpec.configure do |config|
end
6 changes: 6 additions & 0 deletions starter_kits/ruby_on_rails_api_demo/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FIDOR_API_CALLBACK=<APP_URL>/auth/callback
FIDOR_API_CLIENT_ID=<CLIENT_ID>
FIDOR_API_CLIENT_SECRET=<CLIENT_SECRET>
FIDOR_API_LOGGING=true
FIDOR_API_URL=<FIDOR_API_URL>
FIDOR_OAUTH_URL=<FIDOR_OAUTH_URL>
9 changes: 9 additions & 0 deletions starter_kits/ruby_on_rails_api_demo/.fidor_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"display_name" : "Ruby on Rails Fidor API Demo Application",
"description" : "Demo Application for the `fidor_api` gem",
"description-de" : "Demo Application for the `fidor_api` gem",
"app_name": "ruby_on_rails_api_demo",
"app_url": "http://localhost:4000",
"callback_urls": "http://localhost:4000/auth/callback",
"language" : "ruby"
}
11 changes: 11 additions & 0 deletions starter_kits/ruby_on_rails_api_demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Fidor API Demo

This [Rails](http://rubyonrails.org) application demonstrates the capabilities of Fidor Bank API powered by the [fidor_api](https://github.com/fidor/fidor_api) ruby library.

## Production Setup & Deployment

Please read the detailed setup instructions on https://github.com/fidor/fidor_api_demo

### Heroku deployment

Copy the generated `app.json` file to the fidor_api_demo directory, this will prefill all required environment variables.
48 changes: 48 additions & 0 deletions starter_kits/ruby_on_rails_api_demo/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "Fidor API Demo",
"description": "This application demonstrates the capabilities of Fidor Bank API powered by the `fidor_api` ruby library.",
"repository": "https://github.com/fidor/fidor_api_demo",
"keywords": ["fidor", "api", "demo", "rails"],
"env": {
"FIDOR_API_CALLBACK": {
"description": "The customer is redirected back to this URL during the oAuth flow",
"value": "<APP_URL>/auth/callback"
},
"FIDOR_API_CLIENT_ID": {
"description": "The unique ID assigned to your application by fidor",
"value": "<CLIENT_ID>"
},
"FIDOR_API_CLIENT_SECRET": {
"description": "The secret assigned to your application by fidor",
"value": "<CLIENT_SECRET>"
},
"FIDOR_API_LOGGING": {
"description": "Whether the `fidor_api` gem should log all requests done against the Fidor API",
"value": "true"
},
"FIDOR_API_URL": {
"description": "The API endpoint which the `fidor_api` gem should use for regular requests",
"value": "<FIDOR_API_URL>"
},
"FIDOR_OAUTH_URL": {
"description": "The API endpoint which the `fidor_api` gem should use for oAuth requests",
"value": "<FIDOR_OAUTH_URL>"
},
"RAILS_ENV": {
"description": "Runs the rails application in production mode",
"value": "production"
},
"RAILS_LOG_TO_STDOUT": {
"description": "Tells rails to log to STDOUT instead of a local logfile",
"value": "true"
},
"RAILS_SERVE_STATIC_FILES": {
"description": "Tells rails to service static files by the application server",
"value": "true"
},
"SECRET_KEY_BASE": {
"description": "A secret key used for different encryptions and checksums in rails",
"generator": "secret"
}
}
}

0 comments on commit 3bdfafe

Please sign in to comment.