okra-ruby 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,15 @@
1
+ require_relative "base/base.rb"
2
+ require 'json'
3
+
4
+ class Widget < Base
5
+
6
+ def create_widget_link(data)
7
+ base_url = okra_object.base_url
8
+ #certain that the required parameters are passed
9
+ required_params = ["name", "countries", "billable_products", "color", "support_email"]
10
+ check_passed_parameters(required_params, data)
11
+ payload = data.to_json
12
+ response = post_request("#{base_url}/links/new", payload)
13
+ return response
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module Okra
2
+ VERSION = "0.1.0"
3
+ end
data/lib/okra_sdk.rb ADDED
@@ -0,0 +1,77 @@
1
+ require_relative "okra/version"
2
+ require_relative "okra/error"
3
+ require_relative "okra/okra_modules/base_endpoints"
4
+ require_relative "okra/okra_products/auth"
5
+ require_relative "okra/okra_products/identity"
6
+ require_relative "okra/okra_products/bank"
7
+ require_relative "okra/okra_products/balance"
8
+ require_relative "okra/okra_products/account"
9
+ require_relative "okra/okra_products/transactions"
10
+ require_relative "okra/okra_products/income"
11
+ require_relative "okra/okra_products/revenue"
12
+ require_relative "okra/okra_products/payment"
13
+ require_relative "okra/okra_products/assets_and_liabilities"
14
+ require_relative "okra/okra_products/other_products"
15
+ require_relative "okra/okra_products/customer"
16
+ require_relative "okra/okra_products/widget"
17
+
18
+
19
+ class OkraSDK
20
+
21
+ attr_accessor :public_key, :secret_key, :production, :url
22
+
23
+
24
+ #method to initialize Okra object
25
+
26
+ def initialize(public_key=nil, secret_key=nil, production=false)
27
+ @public_key = public_key
28
+ @secret_key = secret_key
29
+ @production = production
30
+
31
+ okra_sandbox_url = BASE_ENDPOINTS::OKRA_SANDBOX_URL
32
+ okra_live_url = BASE_ENDPOINTS::OKRA_LIVE_URL
33
+
34
+ #set okra url to sandbox or live if we are in production or development
35
+
36
+ if production ==false
37
+ @url = okra_sandbox_url
38
+ else
39
+ @url = okra_live_url
40
+ end
41
+
42
+ def base_url
43
+ return url
44
+ end
45
+
46
+ #check if we set our public, secret keys to the environment variable
47
+
48
+ if (public_key.nil?)
49
+ @public_key = ENV['OKRA_PUBLIC_KEY']
50
+ else
51
+ @public_key = public_key
52
+ end
53
+
54
+ if (secret_key.nil?)
55
+ @secret_key = ENV['OKRA_SECRET_KEY']
56
+ else
57
+ @secret_key = secret_key
58
+ end
59
+
60
+ warn "Warning: To ensure your okra api keys are safe, It is best to always set your keys in the environment variable"
61
+
62
+ #raise this error if no public key is passed
63
+
64
+ unless !@public_key.nil?
65
+
66
+ raise OkraBadKeyError, "No public key supplied and couldn't find any in environment variables. Make sure to set public key as an environment variable OKRA_PUBLIC_KEY"
67
+ end
68
+
69
+ #raise this error if no secret key is passed
70
+
71
+ unless !@secret_key.nil?
72
+
73
+ raise OkraBadKeyError, "No secret key supplied and couldn't find any in environment variables. Make sure to set secret key as an environment variable OKRA_SECRET_KEY"
74
+ end
75
+
76
+ end
77
+ end
data/okra-ruby.gemspec ADDED
@@ -0,0 +1,29 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "okra/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "okra-ruby"
8
+ spec.version = Okra::VERSION
9
+ spec.authors = ["Iphytech"]
10
+ spec.email = ["ifavour902@gmail.com"]
11
+
12
+ spec.summary = %q{Ruby SDK for Okra}
13
+ spec.description = %q{Ruby gem for Okra API. Read more on the documentation.}
14
+ spec.homepage = 'https://okra.ng/'
15
+ spec.license = "MIT"
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.17"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rspec", "~> 3.0"
29
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: okra-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Iphytech
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-05-21 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.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
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
+ description: Ruby gem for Okra API. Read more on the documentation.
56
+ email:
57
+ - ifavour902@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - CODE_OF_CONDUCT.md
66
+ - Gemfile
67
+ - Gemfile.lock
68
+ - LICENSE.txt
69
+ - README.md
70
+ - Rakefile
71
+ - bin/console
72
+ - bin/setup
73
+ - lib/okra/error.rb
74
+ - lib/okra/okra_modules/base_endpoints.rb
75
+ - lib/okra/okra_products/account.rb
76
+ - lib/okra/okra_products/assets_and_liabilities.rb
77
+ - lib/okra/okra_products/auth.rb
78
+ - lib/okra/okra_products/balance.rb
79
+ - lib/okra/okra_products/bank.rb
80
+ - lib/okra/okra_products/base/base.rb
81
+ - lib/okra/okra_products/customer.rb
82
+ - lib/okra/okra_products/identity.rb
83
+ - lib/okra/okra_products/income.rb
84
+ - lib/okra/okra_products/other_products.rb
85
+ - lib/okra/okra_products/payment.rb
86
+ - lib/okra/okra_products/revenue.rb
87
+ - lib/okra/okra_products/transactions.rb
88
+ - lib/okra/okra_products/widget.rb
89
+ - lib/okra/version.rb
90
+ - lib/okra_sdk.rb
91
+ - okra-ruby.gemspec
92
+ homepage: https://okra.ng/
93
+ licenses:
94
+ - MIT
95
+ metadata: {}
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ requirements: []
111
+ rubygems_version: 3.0.3
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: Ruby SDK for Okra
115
+ test_files: []