plamo 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cb94f3cd95aaec8494e7b8fd1d45cc0788927fc246b7d4838497de54b414382
4
- data.tar.gz: 4a61dd385a36c3758d66d91daabe9bac37bf1ad56dc755353e26847e479ee073
3
+ metadata.gz: cab3539112c672ea5eb45491df5a5b740bbf1fe19f8ec35adfdad9d937128bd8
4
+ data.tar.gz: 1016de83b7ad33261e4dbaaf46490c7ecb2387b003d4854e3836226ee87c358b
5
5
  SHA512:
6
- metadata.gz: e8667d402ecf5aac08f13592c38127bb3c28a0a4cf88d923d1a18225202f09dcd8b81690c920ff20d69085b417adb0019e096d479e9d1f05cefcc1e23cc17bf5
7
- data.tar.gz: dd4cf943ce9f7aecd568e9ef37f33c954d044c77ca94d31a152e0afdc926064aa825898cd95d9d7221f1edbc54313e33a604fe68c2504d905ca0f069db1f32d1
6
+ metadata.gz: 58e897b1567398794880bdbbd9e74c1afcf13180f747817cf3ced1af6d711a352aa26a93d0776e9fb7ef2c8723df806bda411c5718b22c2830a65d2824f918b1
7
+ data.tar.gz: ab5390f33a0a24c42d4131c6b970f68a21a3fd028ebe842af7551a0bac3332a5fdfd84f3f17f14c22fb11af8c29b7e905e181a575ae9042ecf199e052b5e295b
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # plamo-ruby
2
- plamo-ruby is libplamo wrapper for Ruby.
2
+ plamo-ruby is [libplamo](https://github.com/plamo/libplamo) wrapper for Ruby.
3
3
  ## Installation
4
- Please install libplamo before using plamo-ruby.
4
+ Please install [libplamo](https://github.com/plamo/libplamo) before using plamo-ruby.
5
5
  ## License
6
6
  MIT License
@@ -22,7 +22,12 @@ static VALUE initialize(VALUE self, VALUE rb_scheme, VALUE rb_version, VALUE rb_
22
22
  : sym_http_1_1 == rb_version ? PlamoHttpVersionHttp11
23
23
  : sym_http_1_0 == rb_version ? PlamoHttpVersionHttp10
24
24
  : PlamoHttpVersionHttp09;
25
- const char *method = StringValueCStr(rb_method);
25
+ PlamoHttpMethod method;
26
+ if (RB_TYPE_P(rb_method, RUBY_T_FIXNUM)) {
27
+ method.defined_http_method = NUM2SIZET(rb_method);
28
+ } else {
29
+ method.undefined_http_method = StringValueCStr(rb_method);
30
+ }
26
31
  const char *path = StringValueCStr(rb_path);
27
32
  Wrapper *plamo_http_query_wrapper;
28
33
  Data_Get_Struct(rb_query, Wrapper, plamo_http_query_wrapper);
@@ -58,7 +63,28 @@ static VALUE version(VALUE self) {
58
63
  static VALUE method(VALUE self) {
59
64
  Wrapper *wrapper;
60
65
  Data_Get_Struct(self, Wrapper, wrapper);
61
- return rb_str_new2(plamo_string_get_char(((PlamoRequest*)wrapper->inner)->method));
66
+ PlamoDefinedHttpMethod method = ((PlamoRequest*)wrapper->inner)->method.defined_http_method;
67
+ if (method == PLAMO_HTTP_METHOD_GET) {
68
+ return rb_str_new2("GET");
69
+ } else if (method == PLAMO_HTTP_METHOD_POST) {
70
+ return rb_str_new2("POST");
71
+ } else if (method == PLAMO_HTTP_METHOD_PUT) {
72
+ return rb_str_new2("PUT");
73
+ } else if (method == PLAMO_HTTP_METHOD_DELETE) {
74
+ return rb_str_new2("DELETE");
75
+ } else if (method == PLAMO_HTTP_METHOD_HEAD) {
76
+ return rb_str_new2("HEAD");
77
+ } else if (method == PLAMO_HTTP_METHOD_CONNECT) {
78
+ return rb_str_new2("CONNECT");
79
+ } else if (method == PLAMO_HTTP_METHOD_OPTIONS) {
80
+ return rb_str_new2("OPTIONS");
81
+ } else if (method == PLAMO_HTTP_METHOD_TRACE) {
82
+ return rb_str_new2("TRACE");
83
+ } else if (method == PLAMO_HTTP_METHOD_PATCH) {
84
+ return rb_str_new2("PATCH");
85
+ } else {
86
+ return rb_str_new2(((PlamoRequest*)wrapper->inner)->method.undefined_http_method);
87
+ }
62
88
  }
63
89
 
64
90
  static VALUE path(VALUE self) {
data/lib/plamo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Plamo
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plamo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shogo Otake
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-13 00:00:00.000000000 Z
11
+ date: 2019-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
- rubygems_version: 3.0.4
115
+ rubygems_version: 3.0.6
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: Ruby Bindings for libplamo