ilkbyte 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,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 86bb565d76b250c69e664d87fa30d90a8b1bafcad0fdadfcf75dbd9d1f0e6df2
4
+ data.tar.gz: 176a76ce80387505c5c6764bf98b0934ec94f8d6945e08d7d014f51d492984cb
5
+ SHA512:
6
+ metadata.gz: 5b71352e73c55c6a4adf059f26d2d5bb6346a0f2a48a84f4396c8603007ec5dd4d4227f745ac6096d588c722a24f7624d9f990340fd781a0865a32d895ca0fca
7
+ data.tar.gz: b5024689d80753ddfbf9c940373861c59fef2df912ca291fab0c3e9663be8529642a4871cae3219aa97548c206108514b8f021a6344b8dbedd733b6a47579730
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/*
9
+ /tmp/
10
+ /pkg/*.gem
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in ilkbyte.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
8
+ gem 'httpclient', '~> 2.8', '>= 2.8.3'
@@ -0,0 +1,39 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ilkbyte (0.1.0)
5
+ bundler
6
+ httpclient
7
+ rake
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ diff-lcs (1.4.4)
13
+ httpclient (2.8.3)
14
+ rake (12.3.3)
15
+ rspec (3.10.0)
16
+ rspec-core (~> 3.10.0)
17
+ rspec-expectations (~> 3.10.0)
18
+ rspec-mocks (~> 3.10.0)
19
+ rspec-core (3.10.0)
20
+ rspec-support (~> 3.10.0)
21
+ rspec-expectations (3.10.0)
22
+ diff-lcs (>= 1.2.0, < 2.0)
23
+ rspec-support (~> 3.10.0)
24
+ rspec-mocks (3.10.0)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.10.0)
27
+ rspec-support (3.10.0)
28
+
29
+ PLATFORMS
30
+ ruby
31
+
32
+ DEPENDENCIES
33
+ httpclient (~> 2.8, >= 2.8.3)
34
+ ilkbyte!
35
+ rake (~> 12.0)
36
+ rspec (~> 3.0)
37
+
38
+ BUNDLED WITH
39
+ 2.1.4
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 ilkbyte.com
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.
@@ -0,0 +1,89 @@
1
+ # Ilkbyte
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ilkbyte`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ Also you can find [API documentation](https://apidocs.ilkbyte.com/docs/1.0/overview) here.
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'ilkbyte'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle install
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install ilkbyte
21
+ ## Configuration
22
+
23
+ ```ruby
24
+ AccessKey = "Your Api Access Key"
25
+ SecretKey = "Your Api Secret Key"
26
+ Ilkbyte::Base.new.setOption(AccessKey,SecretKey)
27
+ ```
28
+ If you don't do this, you'll give **401 not authorized** error.
29
+
30
+ ## Usage
31
+
32
+ ```ruby
33
+ require 'ilkbyte'
34
+
35
+ def myMethod()
36
+ Ilkbyte::Server.new.create
37
+ end
38
+ ```
39
+
40
+ ## Functions Usage
41
+ ### Server
42
+ ```ruby
43
+ Ilkbyte::Server.new.create
44
+ Ilkbyte::Server.new.config({
45
+ "username" => @username,
46
+ "password" => @password,
47
+ "name" => @name,
48
+ "os_id" => @os_id,
49
+ "app_id" => @app_id,
50
+ "package_id" => @package_id,
51
+ "sshkey" => @sshkey
52
+ })
53
+ Ilkbyte::Server.new.all
54
+ Ilkbyte::Server.new.active
55
+ Ilkbyte::Server.new.show(server_name)
56
+ Ilkbyte::Server.new.power(server_name,"shutdown")
57
+ Ilkbyte::Server.new.ip(server_name)
58
+ Ilkbyte::Server.new.ipRdns(server_name, "127.0.0.1", "test.ni.net.tr")
59
+ Ilkbyte::Server.new.ipLogs(server_name)
60
+ ```
61
+ ### Domain
62
+ ```ruby
63
+ Ilkbyte::Domain.new.all
64
+ Ilkbyte::Domain.new.create("your-domain-name")
65
+ Ilkbyte::Domain.new.show("your-domain-name")
66
+ Ilkbyte::Domain.new.add("your-domain-name",{
67
+ "record_name" => @record_name,
68
+ "record_type" => @record_type,
69
+ "record_content" => @record_content,
70
+ "record_priority" => @priority
71
+ })
72
+ Ilkbyte::Domain.new.update("your-domain-name",{
73
+ "record_id" => @record_id,
74
+ "record_content" => @record_content,
75
+ "record_priority" => @priority
76
+ })
77
+ Ilkbyte::Domain.new.delete("your-domain-name")
78
+ Ilkbyte::Domain.new.push("your-domain-name")
79
+ ```
80
+ ## Development
81
+
82
+ 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.
83
+
84
+ 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).
85
+
86
+ ## Contributing
87
+
88
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ilkbyte.
89
+
@@ -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
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "ilkbyte"
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(__FILE__)
@@ -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
@@ -0,0 +1,30 @@
1
+ require_relative 'lib/ilkbyte/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "ilkbyte"
5
+ spec.version = Ilkbyte::VERSION
6
+ spec.authors = ["yclyldrm"]
7
+ spec.email = ["yucellyildirim@gmail.com"]
8
+
9
+ spec.summary = %q{A gem for api-ilkbyte}
10
+ spec.description = %q{Including functions to use api-ilkbyte}
11
+ spec.homepage = "https://github.com/ilkbyte/api-ruby"
12
+ spec.license = "MIT"
13
+
14
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = "https://github.com/ilkbyte/api-ruby"
18
+
19
+ # Specify which files should be added to the gem when it is released.
20
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
+ end
24
+ spec.bindir = "exe"
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+ spec.add_runtime_dependency "httpclient"
28
+ spec.add_dependency "bundler"
29
+ spec.add_dependency "rake"
30
+ end
@@ -0,0 +1,36 @@
1
+ require "ilkbyte/version"
2
+ require 'httpclient'
3
+ require 'json'
4
+
5
+ module Ilkbyte
6
+ class Error < StandardError; end
7
+ class Base
8
+ $baseUrl = "https://api.ilkbyte.com"
9
+ def setOption(access,secret)
10
+ $option = {"access" => access,"secret" => secret}
11
+ end
12
+ def request(url = nil, param = {})
13
+ @query = {"access" => $option["access"],"secret" => $option["secret"]}
14
+ param.each do |key,value|
15
+ @query.store(key,value)
16
+ end
17
+ puts @query
18
+ apiUrl = $baseUrl + url
19
+ begin
20
+ client = HTTPClient.new
21
+ response = client.get(apiUrl,@query)
22
+ JSON.parse(response.body)
23
+ rescue StandardError => e
24
+ response = {
25
+ "status" => false,
26
+ "response" => nil,
27
+ "message" => e.message
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ require_relative 'ilkbyte/server'
35
+ require_relative 'ilkbyte/domain'
36
+ require_relative 'ilkbyte/account'
@@ -0,0 +1,7 @@
1
+ module Ilkbyte
2
+ class Account < Base
3
+ def account()
4
+ request("/account")
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,34 @@
1
+ module Ilkbyte
2
+ class Domain < Base
3
+ def all()
4
+ request("/domain/list")
5
+ end
6
+
7
+ def create(domain)
8
+ query = {
9
+ "domain" => domain
10
+ }
11
+ request("/domain/create",query)
12
+ end
13
+
14
+ def show(domain)
15
+ request("/domain/manage/#{domain}/show")
16
+ end
17
+
18
+ def add(domain,query)
19
+ request("/domain/manage/#{domain}/add",query)
20
+ end
21
+
22
+ def update(domain,query)
23
+ request("/domain/manage/#{domain}/uptade",query)
24
+ end
25
+
26
+ def delete(domain)
27
+ request("/domain/manage/#{domain}/delete")
28
+ end
29
+
30
+ def push(domain)
31
+ request("/domain/manage/#{domain}/push")
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,48 @@
1
+ module Ilkbyte
2
+ class Server < Base
3
+ def create()
4
+ request("/server/create")
5
+ end
6
+
7
+ def config(query)
8
+ request("/server/create/config",query)
9
+ end
10
+
11
+ def all()
12
+ request("/server/list/all")
13
+ end
14
+
15
+ def active()
16
+ request("/server/list")
17
+ end
18
+
19
+ def show(server_name)
20
+ request("/server/manage/#{server_name}/show")
21
+ end
22
+
23
+ def power(server_name,power)
24
+ query = {"set" => power}
25
+ request("/server/manage/#{server_name}/power",query)
26
+ end
27
+
28
+ def monitor(server_name)
29
+ request("/server/manage/#{server_name}/monitor")
30
+ end
31
+
32
+ def ipRdns(server_name,ip,rdns)
33
+ query = [
34
+ "ip" => ip,
35
+ "rdns" => rdns
36
+ ]
37
+ request("/server/manage/#{server_name}/ip/rdns",query)
38
+ end
39
+
40
+ def ip(server_name)
41
+ request("/server/manage/#{server_name}/ip/list")
42
+ end
43
+
44
+ def ipLogs(server_name)
45
+ request("/server/manage/#{server_name}/ip/logs")
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,3 @@
1
+ module Ilkbyte
2
+ VERSION = "0.1.0".freeze
3
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ilkbyte
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - yclyldrm
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-11-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httpclient
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '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'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Including functions to use api-ilkbyte
56
+ email:
57
+ - yucellyildirim@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - Gemfile.lock
65
+ - LICENSE
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - ilkbyte.gemspec
71
+ - lib/ilkbyte.rb
72
+ - lib/ilkbyte/account.rb
73
+ - lib/ilkbyte/domain.rb
74
+ - lib/ilkbyte/server.rb
75
+ - lib/ilkbyte/version.rb
76
+ - pkg/ilkbyte-0.1.0.gem
77
+ homepage: https://github.com/ilkbyte/api-ruby
78
+ licenses:
79
+ - MIT
80
+ metadata:
81
+ homepage_uri: https://github.com/ilkbyte/api-ruby
82
+ source_code_uri: https://github.com/ilkbyte/api-ruby
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: 2.3.0
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubygems_version: 3.1.4
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: A gem for api-ilkbyte
102
+ test_files: []