bitodeme 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: 054db3ffb0a816ebcf1a29a3122be47fef657b23
4
+ data.tar.gz: 578c58d1d341a0c9857eb89db6d8f058134710d8
5
+ SHA512:
6
+ metadata.gz: 4f39409034167326d5a05bc62f401137ee2a3f73dd6aff58f18fc5949f57a38701aa747757d5a6f71ffb4df945219f624211384b75a60dcc502c7200881d6169
7
+ data.tar.gz: 13948b09a6426531b51131aa5bda1dbc8b81ccfb8e570f586615c72e8337dccd67bee8799ec64ac8ad1f7d7cd4134ed10b620899bd77e83140fe629d2bf713e3
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ .env
14
+ .byebug_history
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.3
5
+ before_install: gem install bundler -v 1.16.0
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in bitodeme.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 BitÖdeme Ödeme Hizmetleri Yazılım Arge Danışmanlık Ticaret Limited Şirketi
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,166 @@
1
+ # Bitodeme
2
+
3
+ Bitodeme official Ruby client.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'bitodeme'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install bitodeme
20
+
21
+ Then set environment vars:
22
+
23
+ ```shell
24
+ export BITODEME_HOSTNAME=alpha.bitodeme.com; # Bitodeme Domain
25
+ export BITODEME_CLIENT_ID=clientidentifier; # API key
26
+ export BITODEME_CLIENT_SECRET=clientsecret; # API secret
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ### Currency
32
+
33
+ Fetch all currencies
34
+ ```ruby
35
+ currencies = Bitodeme.currencies
36
+ ```
37
+
38
+ Fetch all updated currencies after given time in milli seconds
39
+ ```ruby
40
+ updated_currencies = Bitodeme.currencies(since: 1604131436476)
41
+ ```
42
+
43
+ Pagination
44
+ ```ruby
45
+ last_10_currencies = Bitodeme.currencies(page: 1, per_page: 10)
46
+ ```
47
+
48
+ ### Deposit (Unconfirmed deposits only)
49
+
50
+ Fetch all unconfirmed deposits
51
+
52
+ ```ruby
53
+ deposits = Bitodeme.deposits
54
+ ```
55
+
56
+ ### Funds
57
+
58
+ Fetch all funds
59
+ ```ruby
60
+ funds = Bitodeme.funds
61
+ ```
62
+
63
+ Fetch all updated funds after given time
64
+ ```ruby
65
+ updated_funds = Bitodeme.funds(since: 1513418293)
66
+ ```
67
+
68
+ ### FundAddress
69
+
70
+ Fetch all fund addresses
71
+ ```ruby
72
+ fund_addresses = Bitodeme.fund_addresses
73
+ ```
74
+
75
+ Fetch all updated fund_addresses after given time
76
+ ```ruby
77
+ updated_fund_addresses = Bitodeme.fund_addresses(since: 1513418293)
78
+ ```
79
+
80
+ ### Invoice
81
+
82
+ Fetch an invoice information
83
+ ```ruby
84
+ invoice = Bitodeme.invoice('id')
85
+ ```
86
+
87
+ Build & create an invoice
88
+ ```ruby
89
+ invoice =
90
+ Bitodeme.build_invoice(
91
+ name: 'Virtual game gold',
92
+ description: 'Buy a game gold',
93
+ original_amount: 16.7,
94
+ original_currency_code: 'USD',
95
+ external_id: 'SomeUniqId',
96
+ purchasable: {}
97
+ )
98
+
99
+ invoice = Bitodeme.create_invoice(invoice)
100
+ ```
101
+
102
+ ### Transaction Logs
103
+
104
+ Fetch all transaction logs (deposits, withdrawals and fees)
105
+ ```ruby
106
+ transaction_logs = Bitodeme.transaction_logs
107
+ ```
108
+
109
+ Find a transaction_log
110
+ ```ruby
111
+ transaction_log = Bitodeme.transaction_log('id')
112
+ ```
113
+
114
+ ### Withdrawal (Send money)
115
+
116
+ Build & create a withdrawal (send money)
117
+ ```ruby
118
+ fund_id = '12b241a7-941e-43a8-878e-a467809e988e'
119
+ withdrawal =
120
+ Bitodeme.build_withdrawal(
121
+ amount: 16.7,
122
+ address: 'USD',
123
+ fund_id: fund_id,
124
+ otp_value: 123456 # otp value from Google Authenticator
125
+ )
126
+
127
+ withdrawal = Bitodeme.create_withdrawal(withdrawal)
128
+ ```
129
+
130
+ ### Notes
131
+
132
+ All plural methods support `pagination`(`per_page` and `page`) and `since` query parameters
133
+
134
+ ## Standalone Usage
135
+
136
+ In project root folder:
137
+ ```shell
138
+ # Create an env file
139
+ # Edit yout .env file from alpha.bitodeme.com client credentials
140
+ cp .env.example .env
141
+
142
+ # Bundle
143
+ bundle
144
+
145
+ # Run console
146
+ bin/console
147
+ ```
148
+
149
+ ## Development
150
+
151
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
152
+
153
+ 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).
154
+
155
+ ## Contributing
156
+
157
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bitodeme-integrations/bitodeme_rb.
158
+
159
+ ## References
160
+
161
+ API Documentation: https://documenter.getpostman.com/collection/view/2573284-8bf78c4a-b63d-f7a8-b5e1-ca41f93f0057?_ga=2.141003697.2000527121.1513419149-568055913.1505417138
162
+
163
+ ## License
164
+
165
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
166
+
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,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'dotenv/load'
4
+ require 'bundler/setup'
5
+ require 'bitodeme'
6
+ require 'pry'
7
+
8
+ Pry.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/bitodeme.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'bitodeme/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'bitodeme'
7
+ spec.version = Bitodeme::VERSION
8
+ spec.authors = ['Bitodeme Integrations Team']
9
+ spec.email = ['integrations@bitodeme.com']
10
+ spec.summary = 'Bitodeme REST API Client'
11
+ spec.description = 'Ruby client for Bitodeme REST API'
12
+ spec.homepage = 'https://github.com/bitodeme-integrations/bitodeme_rb'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
+ f.match(%r{^(test|spec|features)/})
17
+ end
18
+ spec.bindir = 'exe'
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.14'
23
+ spec.add_development_dependency 'rake', '~> 10.0'
24
+ spec.add_development_dependency 'rspec', '~> 3.0'
25
+ spec.add_development_dependency 'simplecov', '~> 0.15'
26
+ spec.add_development_dependency 'pry', '~> 0.11'
27
+
28
+ spec.add_dependency 'dotenv', '~> 2.2', '>= 2.2'
29
+ spec.add_dependency 'faraday', '~> 0.13'
30
+ spec.add_dependency 'faraday_middleware', '~> 0.12'
31
+ end
@@ -0,0 +1,3 @@
1
+ module Bitodeme
2
+ VERSION = '0.1.0'.freeze
3
+ end
data/lib/bitodeme.rb ADDED
@@ -0,0 +1,49 @@
1
+ require 'json'
2
+ require 'faraday'
3
+ require 'faraday_middleware'
4
+ require 'bitodeme/version'
5
+ require 'bitodeme/error'
6
+ require 'bitodeme/configuration'
7
+ require 'bitodeme/auth'
8
+ require 'bitodeme/conn'
9
+ require 'bitodeme/resources/base'
10
+ require 'bitodeme/resources/currency'
11
+ require 'bitodeme/resources/deposit'
12
+ require 'bitodeme/resources/fund'
13
+ require 'bitodeme/resources/fund_address'
14
+ require 'bitodeme/resources/invoice'
15
+ require 'bitodeme/resources/transaction_log'
16
+ require 'bitodeme/resources/withdrawal'
17
+
18
+ # Base module for Bitodome Client
19
+ module Bitodeme
20
+ extend SingleForwardable
21
+
22
+ @Currency = Bitodeme::Resource::Currency
23
+ @Deposit = Bitodeme::Resource::Deposit
24
+ @Fund = Bitodeme::Resource::Fund
25
+ @FundAddress = Bitodeme::Resource::FundAddress
26
+ @Invoice = Bitodeme::Resource::Invoice
27
+ @TransactionLog = Bitodeme::Resource::TransactionLog
28
+ @Withdrawal = Bitodeme::Resource::Withdrawal
29
+
30
+ def_delegator :@Currency, :all, :currencies
31
+ def_delegator :@Deposit, :all, :deposits
32
+ def_delegator :@Fund, :find, :fund
33
+ def_delegator :@Fund, :all, :funds
34
+ def_delegator :@FundAddress, :find, :fund_address
35
+ def_delegator :@FundAddress, :all, :fund_addresses
36
+ def_delegator :@Invoice, :build, :build_invoice
37
+ def_delegator :@Invoice, :create, :create_invoice
38
+ def_delegator :@Invoice, :find, :invoice
39
+ def_delegator :@TransactionLog, :find, :transaction_log
40
+ def_delegator :@TransactionLog, :all, :transaction_logs
41
+ def_delegator :@Withdrawal, :build, :build_withdrawal
42
+ def_delegator :@Withdrawal, :create, :create_withdrawal
43
+
44
+ def config
45
+ Bitodeme::Configuration.instance
46
+ end
47
+
48
+ module_function :config
49
+ end
metadata ADDED
@@ -0,0 +1,174 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bitodeme
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Bitodeme Integrations Team
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-12-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.14'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.15'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.15'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.11'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.11'
83
+ - !ruby/object:Gem::Dependency
84
+ name: dotenv
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.2'
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '2.2'
93
+ type: :runtime
94
+ prerelease: false
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '2.2'
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '2.2'
103
+ - !ruby/object:Gem::Dependency
104
+ name: faraday
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '0.13'
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '0.13'
117
+ - !ruby/object:Gem::Dependency
118
+ name: faraday_middleware
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '0.12'
124
+ type: :runtime
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '0.12'
131
+ description: Ruby client for Bitodeme REST API
132
+ email:
133
+ - integrations@bitodeme.com
134
+ executables: []
135
+ extensions: []
136
+ extra_rdoc_files: []
137
+ files:
138
+ - ".gitignore"
139
+ - ".rspec"
140
+ - ".travis.yml"
141
+ - Gemfile
142
+ - LICENSE.txt
143
+ - README.md
144
+ - Rakefile
145
+ - bin/console
146
+ - bin/setup
147
+ - bitodeme.gemspec
148
+ - lib/bitodeme.rb
149
+ - lib/bitodeme/version.rb
150
+ homepage: https://github.com/bitodeme-integrations/bitodeme_rb
151
+ licenses:
152
+ - MIT
153
+ metadata: {}
154
+ post_install_message:
155
+ rdoc_options: []
156
+ require_paths:
157
+ - lib
158
+ required_ruby_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ required_rubygems_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ requirements: []
169
+ rubyforge_project:
170
+ rubygems_version: 2.6.14
171
+ signing_key:
172
+ specification_version: 4
173
+ summary: Bitodeme REST API Client
174
+ test_files: []