lolp 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.sample +3 -0
- data/.gitignore +1 -0
- data/.travis.yml +12 -0
- data/README.md +21 -4
- data/Rakefile +9 -1
- data/lib/lolp.rb +15 -2
- data/lib/lolp/client.rb +14 -0
- data/lib/lolp/configuration.rb +21 -0
- data/lib/lolp/connection.rb +38 -0
- data/lib/lolp/project.rb +23 -0
- data/lib/lolp/version.rb +1 -1
- data/lolp.gemspec +7 -0
- metadata +93 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb1500ac42d14da38d81a8d5521cf0d580125bc4
|
4
|
+
data.tar.gz: 450ff321402cab445420574c1df406296b13f906
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcd507fecf933954c0a97751958de93e16a8080ccc2eb81c11e1c8ba29dc0f1a1b8b6ac9968995d4041c585bb629ba8f706431cf7bd583785e7f3b6c050cdc09
|
7
|
+
data.tar.gz: 98d64a900dc4795bde7867d4a164afdd8432d92a1d17a662f16a622da8c49bd5a7ec82c42d9154f30ff5be04cac7127ca2d00a7eb73dfbe9fc8c0ef4cc9a98c3
|
data/.env.sample
ADDED
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
|
1
|
+
<p align="center"><img src="https://raw.githubusercontent.com/pepabo/lolp.rb/images/lolipop-logo-by-gmo-pepabo.png" width="300" alt="lolp" /></p><p align="center"><strong>lolp</strong>: Simple ruby wrapper for Lolipop! API.</p> <br /> <br />
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://img.shields.io/gem/v/lolp.svg?style=flat-square)](https://rubygems.org/gems/lolp)
|
4
|
+
[![Build Status](https://img.shields.io/travis/pepabo/lolp.rb.svg?style=flat-square)](https://travis-ci.org/pepabo/lolp.rb)
|
4
5
|
|
5
6
|
## Installation
|
6
7
|
|
@@ -20,7 +21,23 @@ Or install it yourself as:
|
|
20
21
|
|
21
22
|
## Usage
|
22
23
|
|
23
|
-
|
24
|
+
```ruby
|
25
|
+
Lolp.configure do |config|
|
26
|
+
config.api_endpoint = 'LOLIPOP MC API ENDPOINT'
|
27
|
+
config.username = 'LOLIPOP MC USERNAME'
|
28
|
+
config.password = 'LOLIPOP MC PASSWORD'
|
29
|
+
end
|
30
|
+
```
|
31
|
+
|
32
|
+
### Projects
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
Lolp.projects
|
36
|
+
Lolp.create_project(:rails) # :wordpress, :php, ...
|
37
|
+
Lolp.delete_project('jungly-naha-2778')
|
38
|
+
Lolp.create_custom_domain('jungly-naha-2778.lolipop.ohr','example.com')
|
39
|
+
Lolp.delete_custom_domain('jungly-naha-2778.lolipop.ohr','example.com')
|
40
|
+
```
|
24
41
|
|
25
42
|
## Development
|
26
43
|
|
@@ -30,5 +47,5 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
30
47
|
|
31
48
|
## Contributing
|
32
49
|
|
33
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/linyows/lolp.
|
34
50
|
|
51
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/pepabo/lolp.rb.
|
data/Rakefile
CHANGED
data/lib/lolp.rb
CHANGED
@@ -1,5 +1,18 @@
|
|
1
|
-
require
|
1
|
+
require 'lolp/version'
|
2
|
+
require 'lolp/client'
|
2
3
|
|
3
4
|
module Lolp
|
4
|
-
|
5
|
+
class << self
|
6
|
+
def client
|
7
|
+
@client ||= Lolp::Client.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def method_missing(method_name, *args, &block)
|
11
|
+
if client.respond_to?(method_name)
|
12
|
+
return client.send(method_name, *args, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
super
|
16
|
+
end
|
17
|
+
end
|
5
18
|
end
|
data/lib/lolp/client.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'lolp/connection'
|
2
|
+
require 'lolp/project'
|
3
|
+
require 'lolp/configuration'
|
4
|
+
|
5
|
+
module Lolp
|
6
|
+
class Client
|
7
|
+
include Lolp::Project
|
8
|
+
include Lolp::Configuration
|
9
|
+
|
10
|
+
def connection
|
11
|
+
@connection ||= Lolp::Connection.new(config)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Lolp
|
2
|
+
module Configuration
|
3
|
+
def config
|
4
|
+
@config ||= Config.new
|
5
|
+
end
|
6
|
+
|
7
|
+
def configure
|
8
|
+
yield config
|
9
|
+
end
|
10
|
+
|
11
|
+
class Config
|
12
|
+
attr_accessor :api_endpoint, :username, :password
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
@api_endpoint = ENV['LOLIPOP_MC_API_ENDPOINT'] || 'https://mc.lolipop.jp/api'
|
16
|
+
@username = ENV['LOLIPOP_MC_USERNAME']
|
17
|
+
@password = ENV['LOLIPOP_MC_PASSWORD']
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'faraday_middleware'
|
3
|
+
|
4
|
+
module Lolp
|
5
|
+
class Connection
|
6
|
+
def initialize(config)
|
7
|
+
@config = config
|
8
|
+
authenticate
|
9
|
+
@connection = connection
|
10
|
+
end
|
11
|
+
|
12
|
+
def get(path)
|
13
|
+
@connection.get(path)
|
14
|
+
end
|
15
|
+
|
16
|
+
def post(path, params = {})
|
17
|
+
@connection.post(path, params)
|
18
|
+
end
|
19
|
+
|
20
|
+
def delete(path, params = {})
|
21
|
+
@connection.delete(path, params)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def connection
|
27
|
+
Faraday.new(url: @config.api_endpoint, headers: { Authorization: "Bearer #{@token}" }) do |faraday|
|
28
|
+
faraday.request :json
|
29
|
+
faraday.response :json, content_type: /\bjson$/
|
30
|
+
faraday.adapter Faraday.default_adapter
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def authenticate
|
35
|
+
@token ||= connection.post('login', username: @config.username, password: @config.password).body
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/lolp/project.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Lolp
|
2
|
+
module Project
|
3
|
+
def projects
|
4
|
+
connection.get('projects')
|
5
|
+
end
|
6
|
+
|
7
|
+
def create_project(template, params = {})
|
8
|
+
connection.post('projects', params.merge(haco_type: template))
|
9
|
+
end
|
10
|
+
|
11
|
+
def delete_project(name)
|
12
|
+
connection.delete("projects/#{name}")
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_custom_domain(domain, custom_domain)
|
16
|
+
connection.post("projects/#{domain}/custom-domains", domain: custom_domain)
|
17
|
+
end
|
18
|
+
|
19
|
+
def delete_custom_domain(domain, custom_domain)
|
20
|
+
connection.delete("projects/#{domain}/custom-domains/#{custom_domain}")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/lolp/version.rb
CHANGED
data/lolp.gemspec
CHANGED
@@ -31,4 +31,11 @@ Gem::Specification.new do |spec|
|
|
31
31
|
|
32
32
|
spec.add_development_dependency "bundler", "~> 1.14"
|
33
33
|
spec.add_development_dependency "rake", "~> 10.0"
|
34
|
+
spec.add_dependency "faraday"
|
35
|
+
spec.add_dependency "faraday_middleware"
|
36
|
+
|
37
|
+
spec.add_development_dependency "minitest"
|
38
|
+
spec.add_development_dependency "vcr"
|
39
|
+
spec.add_development_dependency "pry"
|
40
|
+
spec.add_development_dependency "dotenv"
|
34
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lolp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- linyows
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,90 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: faraday
|
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
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: faraday_middleware
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: vcr
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: dotenv
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
41
125
|
description: Simple ruby wrapper for Lolipop! API.
|
42
126
|
email:
|
43
127
|
- linyows@gmail.com
|
@@ -45,11 +129,17 @@ executables: []
|
|
45
129
|
extensions: []
|
46
130
|
extra_rdoc_files: []
|
47
131
|
files:
|
132
|
+
- ".env.sample"
|
48
133
|
- ".gitignore"
|
134
|
+
- ".travis.yml"
|
49
135
|
- Gemfile
|
50
136
|
- README.md
|
51
137
|
- Rakefile
|
52
138
|
- lib/lolp.rb
|
139
|
+
- lib/lolp/client.rb
|
140
|
+
- lib/lolp/configuration.rb
|
141
|
+
- lib/lolp/connection.rb
|
142
|
+
- lib/lolp/project.rb
|
53
143
|
- lib/lolp/version.rb
|
54
144
|
- lolp.gemspec
|
55
145
|
homepage: https://lolipop.jp
|
@@ -71,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
161
|
version: '0'
|
72
162
|
requirements: []
|
73
163
|
rubyforge_project:
|
74
|
-
rubygems_version: 2.
|
164
|
+
rubygems_version: 2.6.13
|
75
165
|
signing_key:
|
76
166
|
specification_version: 4
|
77
167
|
summary: The lolipop! client
|