bondora 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8eafedaec58c0c820be6b99f0d282f937d49affd
4
+ data.tar.gz: afdaf58a680c62c8f061f813018bf907a1941319
5
+ SHA512:
6
+ metadata.gz: dc3277f8a6b3be5fca3457cbb4cb630a1fe2999385800b1ab7a4f68e525bdb9c4f073b8a5f119605a717bf9f966b4bda0e14b64a1171cad07b0952fc7f883b89
7
+ data.tar.gz: 16dd0278a86128c5a7ce852940e10e485448bd579e3604df0e562b1ad27a561792be16e352b82d6ede05cfa92df55f5dce18d7a180eb324d0224e65140da01b4
data/.gitignore ADDED
@@ -0,0 +1,36 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ ## Specific to RubyMotion:
14
+ .dat*
15
+ .repl_history
16
+ build/
17
+
18
+ ## Documentation cache and generated files:
19
+ /.yardoc/
20
+ /_yardoc/
21
+ /doc/
22
+ /rdoc/
23
+
24
+ ## Environment normalization:
25
+ /.bundle/
26
+ /vendor/bundle
27
+ /lib/bundler/man/
28
+
29
+ # for a library or gem, you might want to ignore these files since the code is
30
+ # intended to run in multiple environments; otherwise, check them in:
31
+ # Gemfile.lock
32
+ # .ruby-version
33
+ # .ruby-gemset
34
+
35
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
+ .rvmrc
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at christian@trademesh.de. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bondora.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,44 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bondora (0.1.0)
5
+ httparty (~> 0.13.0)
6
+ json (~> 1.8, >= 1.8.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ diff-lcs (1.2.5)
12
+ httparty (0.13.7)
13
+ json (~> 1.8)
14
+ multi_xml (>= 0.5.2)
15
+ json (1.8.3)
16
+ multi_xml (0.5.5)
17
+ rake (10.5.0)
18
+ rspec (3.4.0)
19
+ rspec-core (~> 3.4.0)
20
+ rspec-expectations (~> 3.4.0)
21
+ rspec-mocks (~> 3.4.0)
22
+ rspec-core (3.4.4)
23
+ rspec-support (~> 3.4.0)
24
+ rspec-expectations (3.4.0)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.4.0)
27
+ rspec-mocks (3.4.1)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.4.0)
30
+ rspec-support (3.4.1)
31
+ yard (0.8.7.6)
32
+
33
+ PLATFORMS
34
+ ruby
35
+
36
+ DEPENDENCIES
37
+ bondora!
38
+ bundler (~> 1.11)
39
+ rake (~> 10.0)
40
+ rspec (~> 3.2)
41
+ yard (~> 0.8.7.6, >= 0.8)
42
+
43
+ BUNDLED WITH
44
+ 1.11.2
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Christian Schritt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # Bondora
2
+
3
+ Ruby interface to bondora.com's REST API
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'bondora'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install bondora
20
+
21
+ ## Prerequisites
22
+
23
+ The OAuth authorization flow is not implemented. To use the module you need to have an authorization code for your application from Bondora.
24
+ Contributions to make this right are welcome.
25
+
26
+ ## Usage
27
+
28
+ ```ruby
29
+ # create new client
30
+ client = Bondora::API.new('AUTHORIZATION_CODE')
31
+
32
+ # get list of investments
33
+ client.investments
34
+
35
+ # get account balance
36
+ client.balance
37
+
38
+ # get list of auctions
39
+ client.auctions
40
+
41
+ # get information on specific auction
42
+ client.auction(AUCTION_ID)
43
+ ```
44
+
45
+ ## Development
46
+
47
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
48
+
49
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
50
+
51
+ ## Contributing
52
+
53
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bondora. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
54
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "bondora"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/bondora.gemspec ADDED
@@ -0,0 +1,38 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bondora/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bondora"
8
+ spec.version = Bondora::VERSION
9
+ spec.authors = ["Christian Schritt"]
10
+ spec.email = ["christian@trademesh.de"]
11
+
12
+ spec.summary = "Ruby module to access bondora.com's REST API"
13
+ spec.homepage = "https://github.com/cschritt/bondora"
14
+ spec.licenses = "MIT"
15
+
16
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
+ # delete this section to allow pushing this gem to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
+ end
23
+
24
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ # gem dependencies
30
+ spec.add_dependency "httparty", "~> 0.13.0"
31
+ spec.add_dependency "json", "~> 1.8", ">= 1.8.0"
32
+
33
+ # development dependencies
34
+ spec.add_development_dependency "bundler", "~> 1.11"
35
+ spec.add_development_dependency "rake", "~> 10.0"
36
+ spec.add_development_dependency "rspec", "~> 3.2"
37
+ spec.add_development_dependency "yard", "~> 0.8.7.6", ">=0.8"
38
+ end
data/lib/bondora.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "httparty"
2
+ require "bondora/api"
3
+ require "bondora/version"
4
+
5
+ module Bondora
6
+ # Your code goes here...
7
+ end
@@ -0,0 +1,113 @@
1
+ module Bondora
2
+ class API
3
+ include HTTParty
4
+ base_uri 'https://api.bondora.com/api/v1'
5
+
6
+ def initialize(auth_code)
7
+ self.class.headers 'Authorization' => "Bearer #{auth_code}"
8
+ end
9
+
10
+
11
+ # Get all auctions
12
+ #
13
+ # @return [String] all auctions as JSON string.
14
+ def auctions
15
+ self.class.get('/auctions').to_json
16
+ end
17
+
18
+ # Get auction for specified auction
19
+ #
20
+ # @return [String] specified auction as JSON string.
21
+ def auction(auction_id)
22
+ self.class.get("/auction/#{auction_id}").to_json
23
+ end
24
+
25
+ # Get all secondary market offers
26
+ #
27
+ # @return [String] all secondary market offers as JSON string.
28
+ def secondarymarket
29
+ self.class.get('/secondarymarket').to_json
30
+ end
31
+
32
+ # Get secondary market item details
33
+ #
34
+ # @return [String] secondary market item details as JSON string.
35
+ def secondarymarket_item(item_id)
36
+ self.class.get("/secondarymarket/#{item_id}").to_json
37
+ end
38
+
39
+ # Get loanpart details
40
+ #
41
+ # @return [String] loanpart details as JSON string.
42
+ def loanpart(loanpart_id)
43
+ self.class.get("/loanpart/#{loanpart_id}").to_json
44
+ end
45
+
46
+ # Get account balance details
47
+ #
48
+ # @return [String] account balance details as JSON string.
49
+ def balance
50
+ self.class.get('/account/balance').to_json
51
+ end
52
+
53
+ # Get account investments
54
+ #
55
+ # @return [String] investments as JSON string.
56
+ def investments
57
+ self.class.get('/account/investments').to_json
58
+ end
59
+
60
+
61
+ =begin
62
+ # seems not to work
63
+ def eventlog(date_from, date_to, type, ip_address, page_size, page_nr)
64
+ options = { query: {
65
+ date_from: date_from,
66
+ date_to: date_to,
67
+ type: type,
68
+ ip_address: ip_address,
69
+ page_size: page_size,
70
+ page_nr: page_nr
71
+ }
72
+ }
73
+
74
+ self.class.get("/eventlog", options)
75
+ end
76
+ =end
77
+
78
+ # Get bids
79
+ #
80
+ # @return [String] bids as JSON string.
81
+ def bids
82
+ self.class.get('/bids').to_json
83
+ end
84
+
85
+ # Get bid details
86
+ #
87
+ # @return [String] bid details as JSON string.
88
+ def bid(bid_id)
89
+ self.class.get("/bid/#{bid_id}").to_json
90
+ end
91
+
92
+ # Get loandatasets
93
+ #
94
+ # @return [String] loandatasets as JSON string.
95
+ def loandataset
96
+ self.class.get('/loandataset').to_json
97
+ end
98
+
99
+ # Get reports
100
+ #
101
+ # @return [String] reports as JSON string.
102
+ def reports
103
+ self.class.get('/reports').to_json
104
+ end
105
+
106
+ # Get report details
107
+ #
108
+ # @return [String] report details as JSON string.
109
+ def report(report_id)
110
+ self.class.get("/report/#{report_id}").to_json
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,3 @@
1
+ module Bondora
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,155 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bondora
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Christian Schritt
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-03-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.13.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.13.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 1.8.0
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '1.8'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 1.8.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.11'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.11'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '10.0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '10.0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rspec
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '3.2'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '3.2'
89
+ - !ruby/object:Gem::Dependency
90
+ name: yard
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: 0.8.7.6
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0.8'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - "~>"
104
+ - !ruby/object:Gem::Version
105
+ version: 0.8.7.6
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0.8'
109
+ description:
110
+ email:
111
+ - christian@trademesh.de
112
+ executables: []
113
+ extensions: []
114
+ extra_rdoc_files: []
115
+ files:
116
+ - ".gitignore"
117
+ - CODE_OF_CONDUCT.md
118
+ - Gemfile
119
+ - Gemfile.lock
120
+ - LICENSE.md
121
+ - README.md
122
+ - Rakefile
123
+ - bin/console
124
+ - bin/setup
125
+ - bondora.gemspec
126
+ - lib/bondora.rb
127
+ - lib/bondora/api.rb
128
+ - lib/bondora/version.rb
129
+ homepage: https://github.com/cschritt/bondora
130
+ licenses:
131
+ - MIT
132
+ metadata:
133
+ allowed_push_host: https://rubygems.org
134
+ post_install_message:
135
+ rdoc_options: []
136
+ require_paths:
137
+ - lib
138
+ required_ruby_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ requirements: []
149
+ rubyforge_project:
150
+ rubygems_version: 2.5.1
151
+ signing_key:
152
+ specification_version: 4
153
+ summary: Ruby module to access bondora.com's REST API
154
+ test_files: []
155
+ has_rdoc: