dsj_thrift 0.0.1
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.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/dsj_thrift.gemspec +24 -0
- data/lib/dsj_thrift.rb +8 -0
- data/lib/dsj_thrift/diningcity.rb +146 -0
- data/lib/dsj_thrift/diningcity_constants.rb +11 -0
- data/lib/dsj_thrift/diningcity_types.rb +58 -0
- data/lib/dsj_thrift/version.rb +3 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4b937fb96d7a8dc64567d10910131d98204e8c36
|
4
|
+
data.tar.gz: 0c9df9fcd5cd48b2d8ac889f280e353d01565cfd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0474d251680dc3a89f46b7c1303dac5111be4e0ec46da8529b5b511f75c3aee0cb491dbbcdc218018f1243b0243fe771f533f39ce181361031d97928ef0485ce
|
7
|
+
data.tar.gz: 9450b86bf580cbc1d72202c61f0d51a3c21be0fc0616918d1878bde4f33017f30801a41006ae802ae86d974459fa20c1670a7b5bba6694f63b9a247549e95828
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 menghuanwd
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# DsjThrift
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'dsj_thrift'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install dsj_thrift
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( https://github.com/[my-github-username]/dsj_thrift/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/dsj_thrift.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'dsj_thrift/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "dsj_thrift"
|
8
|
+
spec.version = DsjThrift::VERSION
|
9
|
+
spec.authors = ["menghuanwd"]
|
10
|
+
spec.email = ["651019063@qq.com"]
|
11
|
+
spec.summary = %q{鼎食聚}
|
12
|
+
spec.description = %q{鼎食聚餐厅搜索服务}
|
13
|
+
spec.homepage = "https://github.com/menghuanwd/dsj_thrift"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "thrift"
|
24
|
+
end
|
data/lib/dsj_thrift.rb
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift Compiler (0.9.1)
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'thrift'
|
8
|
+
require 'diningcity_types'
|
9
|
+
|
10
|
+
module Dsj
|
11
|
+
module Diningcity
|
12
|
+
class Client
|
13
|
+
include ::Thrift::Client
|
14
|
+
|
15
|
+
def GetRestaurantById(id)
|
16
|
+
send_GetRestaurantById(id)
|
17
|
+
return recv_GetRestaurantById()
|
18
|
+
end
|
19
|
+
|
20
|
+
def send_GetRestaurantById(id)
|
21
|
+
send_message('GetRestaurantById', GetRestaurantById_args, :id => id)
|
22
|
+
end
|
23
|
+
|
24
|
+
def recv_GetRestaurantById()
|
25
|
+
result = receive_message(GetRestaurantById_result)
|
26
|
+
return result.success unless result.success.nil?
|
27
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'GetRestaurantById failed: unknown result')
|
28
|
+
end
|
29
|
+
|
30
|
+
def do_search(keyword, region, price_range, location, cuisines, extra, language)
|
31
|
+
send_do_search(keyword, region, price_range, location, cuisines, extra, language)
|
32
|
+
return recv_do_search()
|
33
|
+
end
|
34
|
+
|
35
|
+
def send_do_search(keyword, region, price_range, location, cuisines, extra, language)
|
36
|
+
send_message('do_search', Do_search_args, :keyword => keyword, :region => region, :price_range => price_range, :location => location, :cuisines => cuisines, :extra => extra, :language => language)
|
37
|
+
end
|
38
|
+
|
39
|
+
def recv_do_search()
|
40
|
+
result = receive_message(Do_search_result)
|
41
|
+
return result.success unless result.success.nil?
|
42
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'do_search failed: unknown result')
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
class Processor
|
48
|
+
include ::Thrift::Processor
|
49
|
+
|
50
|
+
def process_GetRestaurantById(seqid, iprot, oprot)
|
51
|
+
args = read_args(iprot, GetRestaurantById_args)
|
52
|
+
result = GetRestaurantById_result.new()
|
53
|
+
result.success = @handler.GetRestaurantById(args.id)
|
54
|
+
write_result(result, oprot, 'GetRestaurantById', seqid)
|
55
|
+
end
|
56
|
+
|
57
|
+
def process_do_search(seqid, iprot, oprot)
|
58
|
+
args = read_args(iprot, Do_search_args)
|
59
|
+
result = Do_search_result.new()
|
60
|
+
result.success = @handler.do_search(args.keyword, args.region, args.price_range, args.location, args.cuisines, args.extra, args.language)
|
61
|
+
write_result(result, oprot, 'do_search', seqid)
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
# HELPER FUNCTIONS AND STRUCTURES
|
67
|
+
|
68
|
+
class GetRestaurantById_args
|
69
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
70
|
+
ID = 1
|
71
|
+
|
72
|
+
FIELDS = {
|
73
|
+
ID => {:type => ::Thrift::Types::I32, :name => 'id'}
|
74
|
+
}
|
75
|
+
|
76
|
+
def struct_fields; FIELDS; end
|
77
|
+
|
78
|
+
def validate
|
79
|
+
end
|
80
|
+
|
81
|
+
::Thrift::Struct.generate_accessors self
|
82
|
+
end
|
83
|
+
|
84
|
+
class GetRestaurantById_result
|
85
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
86
|
+
SUCCESS = 0
|
87
|
+
|
88
|
+
FIELDS = {
|
89
|
+
SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::Dsj::Restaurant}
|
90
|
+
}
|
91
|
+
|
92
|
+
def struct_fields; FIELDS; end
|
93
|
+
|
94
|
+
def validate
|
95
|
+
end
|
96
|
+
|
97
|
+
::Thrift::Struct.generate_accessors self
|
98
|
+
end
|
99
|
+
|
100
|
+
class Do_search_args
|
101
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
102
|
+
KEYWORD = 1
|
103
|
+
REGION = 2
|
104
|
+
PRICE_RANGE = 3
|
105
|
+
LOCATION = 4
|
106
|
+
CUISINES = 5
|
107
|
+
EXTRA = 6
|
108
|
+
LANGUAGE = 7
|
109
|
+
|
110
|
+
FIELDS = {
|
111
|
+
KEYWORD => {:type => ::Thrift::Types::STRING, :name => 'keyword'},
|
112
|
+
REGION => {:type => ::Thrift::Types::I64, :name => 'region'},
|
113
|
+
PRICE_RANGE => {:type => ::Thrift::Types::LIST, :name => 'price_range', :element => {:type => ::Thrift::Types::DOUBLE}},
|
114
|
+
LOCATION => {:type => ::Thrift::Types::LIST, :name => 'location', :element => {:type => ::Thrift::Types::STRING}},
|
115
|
+
CUISINES => {:type => ::Thrift::Types::LIST, :name => 'cuisines', :element => {:type => ::Thrift::Types::STRING}},
|
116
|
+
EXTRA => {:type => ::Thrift::Types::LIST, :name => 'extra', :element => {:type => ::Thrift::Types::STRING}},
|
117
|
+
LANGUAGE => {:type => ::Thrift::Types::STRING, :name => 'language'}
|
118
|
+
}
|
119
|
+
|
120
|
+
def struct_fields; FIELDS; end
|
121
|
+
|
122
|
+
def validate
|
123
|
+
end
|
124
|
+
|
125
|
+
::Thrift::Struct.generate_accessors self
|
126
|
+
end
|
127
|
+
|
128
|
+
class Do_search_result
|
129
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
130
|
+
SUCCESS = 0
|
131
|
+
|
132
|
+
FIELDS = {
|
133
|
+
SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Dsj::EsRestaurant}}
|
134
|
+
}
|
135
|
+
|
136
|
+
def struct_fields; FIELDS; end
|
137
|
+
|
138
|
+
def validate
|
139
|
+
end
|
140
|
+
|
141
|
+
::Thrift::Struct.generate_accessors self
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift Compiler (0.9.1)
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'thrift'
|
8
|
+
|
9
|
+
module Dsj
|
10
|
+
class Restaurant
|
11
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
12
|
+
ID = 1
|
13
|
+
NAME = 2
|
14
|
+
ADDRESS = 3
|
15
|
+
|
16
|
+
FIELDS = {
|
17
|
+
ID => {:type => ::Thrift::Types::I32, :name => 'id'},
|
18
|
+
NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
|
19
|
+
ADDRESS => {:type => ::Thrift::Types::STRING, :name => 'address'}
|
20
|
+
}
|
21
|
+
|
22
|
+
def struct_fields; FIELDS; end
|
23
|
+
|
24
|
+
def validate
|
25
|
+
end
|
26
|
+
|
27
|
+
::Thrift::Struct.generate_accessors self
|
28
|
+
end
|
29
|
+
|
30
|
+
class EsRestaurant
|
31
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
32
|
+
ID = 1
|
33
|
+
NAME = 2
|
34
|
+
ADDRESS = 3
|
35
|
+
REGION_ID = 4
|
36
|
+
PHONE = 5
|
37
|
+
AVG_PRICE = 6
|
38
|
+
LOGO = 7
|
39
|
+
|
40
|
+
FIELDS = {
|
41
|
+
ID => {:type => ::Thrift::Types::I32, :name => 'id'},
|
42
|
+
NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
|
43
|
+
ADDRESS => {:type => ::Thrift::Types::STRING, :name => 'address'},
|
44
|
+
REGION_ID => {:type => ::Thrift::Types::I64, :name => 'region_id'},
|
45
|
+
PHONE => {:type => ::Thrift::Types::STRING, :name => 'phone'},
|
46
|
+
AVG_PRICE => {:type => ::Thrift::Types::DOUBLE, :name => 'avg_price'},
|
47
|
+
LOGO => {:type => ::Thrift::Types::STRING, :name => 'logo'}
|
48
|
+
}
|
49
|
+
|
50
|
+
def struct_fields; FIELDS; end
|
51
|
+
|
52
|
+
def validate
|
53
|
+
end
|
54
|
+
|
55
|
+
::Thrift::Struct.generate_accessors self
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dsj_thrift
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- menghuanwd
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
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: thrift
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: "鼎食聚餐厅搜索服务"
|
56
|
+
email:
|
57
|
+
- 651019063@qq.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- dsj_thrift.gemspec
|
68
|
+
- lib/dsj_thrift.rb
|
69
|
+
- lib/dsj_thrift/diningcity.rb
|
70
|
+
- lib/dsj_thrift/diningcity_constants.rb
|
71
|
+
- lib/dsj_thrift/diningcity_types.rb
|
72
|
+
- lib/dsj_thrift/version.rb
|
73
|
+
homepage: https://github.com/menghuanwd/dsj_thrift
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.2.2
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: "鼎食聚"
|
97
|
+
test_files: []
|