rabbit-slide-niku-elixir-conf-japan-2017-04-01-lt 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6f3a2b48a7f2cb28004b3aaaffca95e58cabf21a
4
+ data.tar.gz: 6cf050253cf0d513c59f46ffdf6425e516367efe
5
+ SHA512:
6
+ metadata.gz: 24119dcc72962f715a0e0fbbed5dfe06bb53a1e0077c01b34602ac1607a7932a11cb09ca3c95e5355536756a8b68cb7550088e861ef7f7bb80caefd7e09aba32
7
+ data.tar.gz: a7d2189f032727e0620dcf3b8c4ede780fdae701f18897be26903fa68ddc2ccb2ca7bd526205304a066918d60d5cea2357e6fcd9fb5d39d4410f5ca294543637
data/.rabbit ADDED
@@ -0,0 +1 @@
1
+ elixir-conf-japan-2017-04-01-lt.md
@@ -0,0 +1,23 @@
1
+ # Elixir client from OpenAPI(Swagger) definition
2
+
3
+ Elixir client from OpenAPI(Swagger) definition
4
+
5
+ ## 作者向け
6
+
7
+ ### 表示
8
+
9
+ rake
10
+
11
+ ### 公開
12
+
13
+ rake publish
14
+
15
+ ## 閲覧者向け
16
+
17
+ ### インストール
18
+
19
+ gem install rabbit-slide-niku-elixir-conf-japan-2017-04-01-lt
20
+
21
+ ### 表示
22
+
23
+ rabbit rabbit-slide-niku-elixir-conf-japan-2017-04-01-lt.gem
@@ -0,0 +1,17 @@
1
+ require "rabbit/task/slide"
2
+
3
+ # Edit ./config.yaml to customize meta data
4
+
5
+ spec = nil
6
+ Rabbit::Task::Slide.new do |task|
7
+ spec = task.spec
8
+ # spec.files += Dir.glob("doc/**/*.*")
9
+ # spec.files -= Dir.glob("private/**/*.*")
10
+ # spec.add_runtime_dependency("YOUR THEME")
11
+ end
12
+
13
+ desc "Tag #{spec.version}"
14
+ task :tag do
15
+ sh("git", "tag", "-a", spec.version.to_s, "-m", "Publish #{spec.version}")
16
+ sh("git", "push", "--tags")
17
+ end
Binary file
Binary file
Binary file
@@ -0,0 +1,19 @@
1
+ ---
2
+ id: elixir-conf-japan-2017-04-01-lt
3
+ base_name: elixir-conf-japan-2017-04-01-lt
4
+ tags: [elixir, swagger, openapi]
5
+ presentation_date: 2017-04-01
6
+ version: 1.0.0
7
+ licenses: [MIT]
8
+ slideshare_id:
9
+ speaker_deck_id:
10
+ ustream_id:
11
+ vimeo_id:
12
+ youtube_id:
13
+ author:
14
+ markup_language: :markdown
15
+ name: niku
16
+ email: niku@niku.name
17
+ rubygems_user: niku
18
+ slideshare_user:
19
+ speaker_deck_user:
@@ -0,0 +1,237 @@
1
+ # Elixir client from OpenAPI(Swagger) definition
2
+
3
+ author
4
+ : niku
5
+
6
+ date
7
+ : 2017/04/01
8
+
9
+ allotted-time
10
+ : 5m
11
+
12
+ # About Me
13
+
14
+ twitter: niku_name
15
+ github: niku
16
+
17
+ ![](niku.png){:relative_height='80'}
18
+
19
+ Live in Sapporo City, Hokkaido
20
+
21
+ # About Me
22
+
23
+ A member of Sapporo.beam
24
+
25
+ - Local meetup for ErlangVM
26
+ - In Sapporo City, Hokkaido
27
+ - On every thursday
28
+ - Since 2014-02-12
29
+ - Next 161th
30
+
31
+ # About Me
32
+
33
+ An elixir-lang contributer
34
+
35
+ ```
36
+ /Users/niku/src/elixir-head% git log --author=niku
37
+ commit a4028e73604807b9e13a5404a98e9f51d2a1eb0d
38
+ Author: niku <niku@niku.name>
39
+ Date: Mon Dec 12 17:27:28 2016 +0900
40
+
41
+ Make the example a valid mix project (#5555)
42
+
43
+ commit 5b9b186d4b6f78f83211821bb4453897be14c13b
44
+ Author: niku <niku@niku.name>
45
+ Date: Sun Aug 3 22:58:55 2014 +0900
46
+
47
+ Improve IEx docs about .iex.exs
48
+
49
+ commit e68f617e2add9772082b09c4e35cc03c2cc5bd04
50
+ Author: niku <niku@niku.name>
51
+ Date: Tue Jul 29 23:46:52 2014 +0900
52
+
53
+ Remove duplicate test
54
+ ```
55
+
56
+ # Elixir
57
+
58
+ I ♡ Elixir and ErlangVM.
59
+
60
+ # A hard thing
61
+
62
+ In many cases, Official SDK for ErlangVM haven't been provided (yet).
63
+
64
+ ![](aws-sdk.png){:relative_height='100'}
65
+
66
+ # Should I make a elixir client to each service?
67
+
68
+ (╯ಠ~ಠ)╯︵ ┻━┻
69
+
70
+ # OpenAPI(Swagger)
71
+
72
+ [https://github.com/OAI/OpenAPI-Specification](https://github.com/OAI/OpenAPI-Specification)
73
+
74
+ > language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service
75
+
76
+ # OpenAPI definition example
77
+
78
+ write in yaml or json
79
+
80
+ ```yaml
81
+ swagger: '2.0'
82
+ info:
83
+ version: 0.1.0
84
+ title: Simple API
85
+ paths:
86
+ /:
87
+ get:
88
+ responses:
89
+ 200:
90
+ description: OK
91
+ ```
92
+
93
+ # OpenAPI definition example
94
+
95
+ ![](swagger-definition.png){:relative_height='100'}
96
+
97
+ # Generate from OpenAPI definition
98
+
99
+ [https://github.com/swagger-api/swagger-codegen#template-creator](https://github.com/swagger-api/swagger-codegen#template-creator)
100
+
101
+ ![](swagger-codegen-template-creator.png){:relative_height='100'}
102
+
103
+ # OpenAPI online editor
104
+
105
+ [http://editor.swagger.io/](http://editor.swagger.io/)
106
+
107
+ ![](swagger-editor-1.png){:relative_height='100'}
108
+
109
+ # OpenAPI online editor
110
+
111
+ You can download an elixir client generated from OpenAPI definition
112
+
113
+ ![](swagger-editor-2.png)
114
+
115
+ # An elixir client generated from OpenAPI definition
116
+
117
+ ```
118
+ /Users/niku/Downloads/elixir-client% tree
119
+ .
120
+ ├── README.md
121
+ ├── config
122
+ │   └── config.exs
123
+ ├── lib
124
+ │   └── swagger_petstore
125
+ │   ├── api
126
+ │   │   ├── pet.ex
127
+ │   │   ├── store.ex
128
+ │   │   └── user.ex
129
+ │   └── model
130
+ │   ├── apiResponse.ex
131
+ │   ├── category.ex
132
+ │   ├── order.ex
133
+ │   ├── pet.ex
134
+ │   ├── tag.ex
135
+ │   └── user.ex
136
+ ├── mix.exs
137
+ └── test
138
+ └── test_helper.exs
139
+
140
+ 6 directories, 13 files
141
+ ```
142
+
143
+ # Use an elixir client
144
+
145
+ Add new pet (definition)
146
+
147
+ ![](add_pet.png){:relative_height='100'}
148
+
149
+ # Use an elixir client
150
+
151
+ Add new pet (code)
152
+
153
+ named `ElixirConfJa2017`
154
+
155
+ ```ruby
156
+ SwaggerPetstore.Api.Pet.add_pet(%{"name" => "ElixirConfJa2017"})
157
+ ```
158
+
159
+ # Use an elixir client
160
+
161
+ ```ruby
162
+ /Users/niku/Downloads/elixir-client% mix deps.get
163
+ (...snip...)
164
+ /Users/niku/Downloads/elixir-client% mix run -e \
165
+ % 'IO.inspect SwaggerPetstore.Api.Pet.add_pet(%{"name" => "ElixirConfJa2017"})'
166
+ %Tesla.Env{body: %{"id" => 9072482292156441678, "name" => "ElixirConfJa2017",
167
+ "photoUrls" => [], "tags" => []},
168
+ headers: %{"access-control-allow-headers" => "Content-Type, api_key, Authorization",
169
+ "access-control-allow-methods" => "GET, POST, DELETE, PUT",
170
+ "access-control-allow-origin" => "*", "connection" => "close",
171
+ "content-type" => "application/json",
172
+ "date" => "Fri, 31 Mar 2017 14:47:18 GMT",
173
+ "server" => "Jetty(9.2.9.v20150224)"}, method: :post, opts: [], query: [],
174
+ status: 200, url: "http://petstore.swagger.io/v2/pet"}
175
+ ```
176
+
177
+ Get an pet ID `9072482292156441678`
178
+
179
+ # Use elixir client
180
+
181
+ Get the pet by ID (definition)
182
+
183
+ ![](get_pet.png){:relative_height='100'}
184
+
185
+ # Use elixir client
186
+
187
+ Get the pet by ID (code)
188
+
189
+ ID `9072482292156441678`
190
+
191
+ ```ruby
192
+ SwaggerPetstore.Api.Pet.get_pet_by_id(9072482292156441678)
193
+ ```
194
+
195
+ # Use elixir client
196
+
197
+ ```ruby
198
+ /Users/niku/Downloads/elixir-client% mix run -e \
199
+ 'IO.inspect SwaggerPetstore.Api.Pet.get_pet_by_id(9072482292156441678)'
200
+ %Tesla.Env{body: %{"id" => 9072482292156441678, "name" => "ElixirConfJa2017",
201
+ "photoUrls" => [], "tags" => []},
202
+ headers: %{"access-control-allow-headers" => "Content-Type, api_key, Authorization",
203
+ "access-control-allow-methods" => "GET, POST, DELETE, PUT",
204
+ "access-control-allow-origin" => "*", "connection" => "close",
205
+ "content-type" => "application/json",
206
+ "date" => "Fri, 31 Mar 2017 14:53:28 GMT",
207
+ "server" => "Jetty(9.2.9.v20150224)"}, method: :get, opts: [], query: [],
208
+ status: 200, url: "http://petstore.swagger.io/v2/pet/9072482292156441678"}
209
+ ```
210
+
211
+ It seems work well.
212
+
213
+ # Brand-new feature (not yet released)
214
+
215
+ View API Document with using `h/1`
216
+
217
+ ![](brand-new-feature.png){:relative_height='30'}
218
+
219
+ ```ruby
220
+ iex(1)> h SwaggerPetstore.Api.Store.get_inventory
221
+
222
+ def get_inventory()
223
+
224
+ Returns pet inventories by status
225
+
226
+ Returns a map of status codes to quantities
227
+ ```
228
+
229
+ # Conclusion
230
+
231
+ - For web service provider
232
+ - Please provide us SDK of ErlangVM
233
+ - Or else OpenAPI definition
234
+ - For elixir user
235
+ - It is *very experimental* now
236
+ - However, please try it
237
+ - Please let me know if it dosn't work well
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rabbit-slide-niku-elixir-conf-japan-2017-04-01-lt
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - niku
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-04-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rabbit
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 2.0.2
27
+ description: Elixir client from OpenAPI(Swagger) definition
28
+ email:
29
+ - niku@niku.name
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".rabbit"
35
+ - README.md
36
+ - Rakefile
37
+ - add_pet.png
38
+ - aws-sdk.png
39
+ - brand-new-feature.png
40
+ - config.yaml
41
+ - elixir-conf-japan-2017-04-01-lt.md
42
+ - find_by_tags.png
43
+ - get_pet.png
44
+ - niku.png
45
+ - pdf/elixir-conf-japan-2017-04-01-lt-elixir-conf-japan-2017-04-01-lt.pdf
46
+ - swagger-codegen-template-creator.png
47
+ - swagger-definition.png
48
+ - swagger-editor-1.png
49
+ - swagger-editor-2.png
50
+ homepage: http://slide.rabbit-shocker.org/authors/niku/elixir-conf-japan-2017-04-01-lt/
51
+ licenses:
52
+ - MIT
53
+ metadata: {}
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubyforge_project:
70
+ rubygems_version: 2.6.8
71
+ signing_key:
72
+ specification_version: 4
73
+ summary: Elixir client from OpenAPI(Swagger) definition
74
+ test_files: []