ruby-kong 0.1.0a

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
+ SHA1:
3
+ metadata.gz: 38da78f7fbf5b4b7e64f9ca4317aa0f0ac1b707e
4
+ data.tar.gz: 5fe527e25b2d3e1697b5f65e6324196da0fdfe4c
5
+ SHA512:
6
+ metadata.gz: a72a54f57878ed063f423eedba18613782cde6cec7cf335d3723097bdd03ef5c1cd05470b5af58f9065e34a709dbf9ed6175977ec536896c9cfa898d06099632
7
+ data.tar.gz: 71bd1d46bfe5c2839796c83ac5c952b76d4b7d9b7d1f0702d7e1de9bc0d85f43dc904a1667e5c55b4aee6b338e146a75589d1e12d1afc5a97df29ad62b54ccba
@@ -0,0 +1,40 @@
1
+ ---
2
+ engines:
3
+ bundler-audit:
4
+ enabled: true
5
+ duplication:
6
+ enabled: false
7
+ config:
8
+ languages:
9
+ - ruby
10
+ - javascript
11
+ - python
12
+ - php
13
+ fixme:
14
+ enabled: true
15
+ rubocop:
16
+ enabled: true
17
+ checks:
18
+ Rubocop/Metrics/ClassLength:
19
+ enabled: false
20
+ Rubocop/Style/NumericLiterals:
21
+ enabled: false
22
+ Rubocop/Style/FrozenStringLiteralComment:
23
+ enabled: false
24
+ Rubocop/Metrics/LineLength:
25
+ enabled: false
26
+ Rubocop/Metrics/MethodLength:
27
+ enabled: false
28
+
29
+ ratings:
30
+ paths:
31
+ - Gemfile.lock
32
+ - "**.inc"
33
+ - "**.js"
34
+ - "**.jsx"
35
+ - "**.module"
36
+ - "**.php"
37
+ - "**.py"
38
+ - "**.rb"
39
+ exclude_paths:
40
+ - spec/
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /*.gem
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,99 @@
1
+ #
2
+ # Overrides
3
+ #
4
+ AbcSize:
5
+ Severity: refactor
6
+ AlignHash:
7
+ EnforcedHashRocketStyle: table
8
+ EnforcedColonStyle: table
9
+ BlockNesting:
10
+ Severity: refactor
11
+ ClassLength:
12
+ Severity: refactor
13
+ ClassCheck:
14
+ EnforcedStyle: kind_of?
15
+ CollectionMethods:
16
+ PreferredMethods:
17
+ find: detect
18
+ find_all: select
19
+ map: collect
20
+ reduce: inject
21
+ CyclomaticComplexity:
22
+ Severity: refactor
23
+ FormatString:
24
+ EnforcedStyle: percent
25
+ HashSyntax:
26
+ EnforcedStyle: hash_rockets
27
+ LineLength:
28
+ Max: 80
29
+ Severity: refactor
30
+ MethodLength:
31
+ Max: 25
32
+ Severity: refactor
33
+ ParameterLists:
34
+ Severity: refactor
35
+ PerceivedComplexity:
36
+ Severity: refactor
37
+ RedundantReturn:
38
+ AllowMultipleReturnValues: true
39
+ SignalException:
40
+ EnforcedStyle: only_raise
41
+ SingleLineMethods:
42
+ AllowIfMethodIsEmpty: false
43
+ SpaceInsideHashLiteralBraces:
44
+ EnforcedStyle: no_space
45
+ TrivialAccessors:
46
+ AllowPredicates: true
47
+ AllCops:
48
+ TargetRubyVersion: 2.3
49
+ #
50
+ # Enabled/Disabled
51
+ #
52
+ ClassAndModuleChildren:
53
+ Enabled: false
54
+ DefEndAlignment:
55
+ AutoCorrect: true
56
+ Documentation:
57
+ Enabled: false
58
+ Encoding:
59
+ Enabled: false
60
+ EndAlignment:
61
+ AutoCorrect: true
62
+ ExtraSpacing:
63
+ AutoCorrect: false # https://github.com/bbatsov/rubocop/issues/2280
64
+ FindEach:
65
+ Enabled: false
66
+ GuardClause:
67
+ Enabled: false
68
+ IfUnlessModifier:
69
+ Enabled: false
70
+ NumericLiterals:
71
+ AutoCorrect: false
72
+ ParallelAssignment:
73
+ Enabled: false
74
+ PerlBackrefs:
75
+ Enabled: false
76
+ ReadWriteAttribute:
77
+ AutoCorrect: false
78
+ RescueModifier:
79
+ AutoCorrect: false
80
+ SingleLineBlockParams:
81
+ Enabled: false
82
+ SpaceBeforeFirstArg:
83
+ Enabled: false
84
+ SpecialGlobalVars:
85
+ AutoCorrect: false
86
+ StringLiterals:
87
+ Enabled: false
88
+ StringLiteralsInInterpolation:
89
+ Enabled: false
90
+ TrailingCommaInLiteral:
91
+ Enabled: false
92
+ WhileUntilModifier:
93
+ Enabled: false
94
+ WordArray:
95
+ AutoCorrect: false
96
+ Style/AccessorMethodName:
97
+ Enabled: false
98
+ Style/FileName:
99
+ Enabled: false
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.0
4
+ before_install: gem install bundler -v 1.11.2
5
+
6
+ addons:
7
+ code_climate:
8
+ repo_token: d622e6d00f1c188ec2a1bd89994cc40a22e9c8b8227f7021d5f5873b82cb233c
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ruby-kong.gemspec
4
+ gemspec
5
+
6
+ gem 'pry'
7
+ gem 'rake'
8
+ gem "codeclimate-test-reporter", :group => :test, :require => nil
@@ -0,0 +1,71 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ruby-kong (0.1.0)
5
+ unirest (= 1.1.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.3.8)
11
+ codeclimate-test-reporter (0.5.0)
12
+ simplecov (>= 0.7.1, < 1.0.0)
13
+ coderay (1.1.1)
14
+ crack (0.4.3)
15
+ safe_yaml (~> 1.0.0)
16
+ diff-lcs (1.2.5)
17
+ docile (1.1.5)
18
+ hashdiff (0.3.0)
19
+ json (1.8.3)
20
+ method_source (0.8.2)
21
+ mime-types (1.25.1)
22
+ pry (0.10.3)
23
+ coderay (~> 1.1.0)
24
+ method_source (~> 0.8.1)
25
+ slop (~> 3.4)
26
+ rake (10.5.0)
27
+ rest-client (1.6.9)
28
+ mime-types (~> 1.16)
29
+ rspec (3.4.0)
30
+ rspec-core (~> 3.4.0)
31
+ rspec-expectations (~> 3.4.0)
32
+ rspec-mocks (~> 3.4.0)
33
+ rspec-core (3.4.4)
34
+ rspec-support (~> 3.4.0)
35
+ rspec-expectations (3.4.0)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.4.0)
38
+ rspec-mocks (3.4.1)
39
+ diff-lcs (>= 1.2.0, < 2.0)
40
+ rspec-support (~> 3.4.0)
41
+ rspec-support (3.4.1)
42
+ safe_yaml (1.0.4)
43
+ simplecov (0.11.2)
44
+ docile (~> 1.1.0)
45
+ json (~> 1.8)
46
+ simplecov-html (~> 0.10.0)
47
+ simplecov-html (0.10.0)
48
+ slop (3.6.0)
49
+ unirest (1.1.2)
50
+ addressable (~> 2.3.5)
51
+ json (~> 1.8.1)
52
+ rest-client (~> 1.6.7)
53
+ webmock (1.24.2)
54
+ addressable (>= 2.3.6)
55
+ crack (>= 0.3.2)
56
+ hashdiff
57
+
58
+ PLATFORMS
59
+ ruby
60
+
61
+ DEPENDENCIES
62
+ bundler (~> 1.11)
63
+ codeclimate-test-reporter
64
+ pry
65
+ rake
66
+ rspec (~> 3.0)
67
+ ruby-kong!
68
+ webmock (= 1.24.2)
69
+
70
+ BUNDLED WITH
71
+ 1.11.2
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Dang Tung Lam
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.
@@ -0,0 +1,12 @@
1
+ ruby-kong
2
+ =========
3
+
4
+ [![Build Status](https://travis-ci.org/tunglam14/ruby-kong.svg?branch=master)](https://travis-ci.org/tunglam14/ruby-kong)
5
+ [![Code Climate](https://codeclimate.com/github/tunglam14/ruby-kong/badges/gpa.svg)](https://codeclimate.com/github/tunglam14/ruby-kong)
6
+ [![Test Coverage](https://codeclimate.com/github/tunglam14/ruby-kong/badges/coverage.svg)](https://codeclimate.com/github/tunglam14/ruby-kong/coverage)
7
+ [![Dependency Status](https://gemnasium.com/tunglam14/ruby-kong.svg)](https://gemnasium.com/tunglam14/ruby-kong)
8
+
9
+
10
+ ```
11
+ Under development... check it out later
12
+ ```
@@ -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 "ruby/kong"
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
@@ -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,12 @@
1
+ require 'pry'
2
+
3
+ require 'ruby-kong/version'
4
+ require 'ruby-kong/spec'
5
+ require 'ruby-kong/utils'
6
+ require 'ruby-kong/stub'
7
+ require 'ruby-kong/request'
8
+ require 'ruby-kong/kong'
9
+ require 'ruby-kong/node'
10
+ require 'ruby-kong/api'
11
+ require 'ruby-kong/consumer'
12
+ require 'ruby-kong/plugin'
@@ -0,0 +1,47 @@
1
+ require 'ruby-kong/request/api'
2
+
3
+ module RubyKong
4
+ module Api
5
+ class << self
6
+ # Params: upstream_url:, request_host: nil, request_path: nil, name: nil,
7
+ # preserve_host: false, strip_request_path: false
8
+ #
9
+ # Usage: RubyKong::Api.create upstream_url: 'https://api.shipit.vn/v1/',
10
+ # request_host: 'api.shipit.vn',
11
+ # name: 'shipit'
12
+ def create(*args)
13
+ RubyKong::Request::Api.create args[0]
14
+ end
15
+
16
+ # Params: id, name, request_host, request_path, upstream_url, size, offset
17
+ #
18
+ # Usage: RubyKong::Api.list
19
+ def list(*args)
20
+ RubyKong::Request::Api.list args[0]
21
+ end
22
+
23
+ # Params: id, name
24
+ #
25
+ # Usage: RubyKong::Api.retrieve name: 'shipit'
26
+ def retrieve(*args)
27
+ RubyKong::Request::Api.retrieve args[0]
28
+ end
29
+
30
+ # Params: id, name
31
+ #
32
+ # Usage: RubyKong::Api.update name: 'shipit',
33
+ # upstream_url: 'https://api.shipit.vn/v2/'
34
+ def update(*args)
35
+ RubyKong::Request::Api.update args[0]
36
+ end
37
+
38
+ # Params: id, name
39
+ #
40
+ # Usage: RubyKong::Api.update name: 'shipit',
41
+ # upstream_url: 'https://api.shipit.vn/v2/'
42
+ def delete(*args)
43
+ RubyKong::Request::Api.delete args[0]
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,43 @@
1
+ require 'ruby-kong/request/consumer'
2
+
3
+ module RubyKong
4
+ module Consumer
5
+ class << self
6
+ # Params: username, custom_id
7
+ #
8
+ # Usage: RubyKong::Consumer.create username: 'lamdt'
9
+ def create(*args)
10
+ RubyKong::Request::Consumer.create args[0]
11
+ end
12
+
13
+ # Params: id, username, custom_id, size, offset
14
+ #
15
+ # Usage: RubyKong::Consumer.list
16
+ def list(*args)
17
+ RubyKong::Request::Consumer.list args[0]
18
+ end
19
+
20
+ # Params: id, username
21
+ #
22
+ # Usage: RubyKong::Consumer.retrieve username: 'lamdt'
23
+ def retrieve(*args)
24
+ RubyKong::Request::Consumer.retrieve args[0]
25
+ end
26
+
27
+ # Params: custom_id, username
28
+ #
29
+ # Usage: RubyKong::Consumer.update username: 'lamdt',
30
+ # custom_id: 123
31
+ def update(*args)
32
+ RubyKong::Request::Consumer.update args[0]
33
+ end
34
+
35
+ # Params: id, username
36
+ #
37
+ # Usage: RubyKong::Consumer.delete username: 'lamdt'
38
+ def delete(*args)
39
+ RubyKong::Request::Consumer.delete args[0]
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,7 @@
1
+ module RubyKong
2
+ class << self
3
+ def new(kong_url = 'http://123.31.11.81:8001')
4
+ RubyKong.url = kong_url
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ require 'ruby-kong/request/node'
2
+
3
+ module RubyKong
4
+ module Node
5
+ class << self
6
+ def info
7
+ RubyKong::Request::Node.get_node_info
8
+ end
9
+
10
+ def status
11
+ RubyKong::Request::Node.get_node_status
12
+ end
13
+ end
14
+ end
15
+ end