events_jp 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: aa46dc3f92bad52d01ec465962d34d643fa4fd1a
4
+ data.tar.gz: 04075bee0623b0b34026044ed558a53807b34d8f
5
+ SHA512:
6
+ metadata.gz: c262668484937007471f45c148043af1fe882a9b4809b7ae52c82cde8085229e31a9ea9782890c3c47cd7b690c15e1015ba763b53be7e12677fad27498054115
7
+ data.tar.gz: 150444b006e1d7b9c0e38dbbcfc357b8b57cb4993b52888cca8731812227d1230bab2b6c3e826927d31df6df0ce2638d44e0cc8f53faf817ae843e4c0c194539
data/.gitignore ADDED
@@ -0,0 +1,20 @@
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
+ .idea/
19
+ *.iml
20
+ .rspec
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.3
4
+ - 2.1.0
5
+ - 2.0.0
6
+ env:
7
+ global:
8
+ secure:
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :test do
6
+ gem 'coveralls', require: false
7
+ gem 'codeclimate-test-reporter', require: false
8
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 deeeki
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,80 @@
1
+ # events_jp
2
+
3
+ A Ruby wrapper for atnd/connpass/doorkeeper/zusaar API
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'events_jp'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install events_jp
18
+
19
+ ## Usage
20
+
21
+ ### Search events
22
+
23
+ ```ruby
24
+ res = EventsJp.get_event(keyword: 'Ruby')
25
+ events.each do |e|
26
+ puts "#{e.service} - #{e.title}"
27
+ end
28
+ ```
29
+
30
+ * Unfortunately, Doorkeeper don't support keyword search....
31
+
32
+ ### Get all events
33
+
34
+ ```ruby
35
+ res = EventsJp.get_event(service_limit: 100)
36
+ events.each do |e|
37
+ puts "#{e.service} - #{e.title}"
38
+ end
39
+ ```
40
+
41
+ ### Complement
42
+
43
+ * The response is a [Hashie::Mash](https://github.com/intridea/hashie#mash) object (dot-accessible Hash).
44
+
45
+ ## Response Attributes
46
+
47
+ The response is as follows(similar atnd response);
48
+
49
+ - service: String(atnd/connpass/doorkeeper/zusaar)
50
+ - address: String
51
+ - catch: String(nothing in doorkeeper)
52
+ - title: String
53
+ - event_url: String
54
+ - started_at: DateTime
55
+ - ended_at: DateTime
56
+ - place: String
57
+ - lon: Float(longitude)
58
+ - lat: Float(latitude)
59
+ - limit: Integer
60
+ - accepted: Integer
61
+ - waiting: Integer
62
+
63
+ ## API reference
64
+
65
+ - [ATND API リファレンス](http://api.atnd.org/)
66
+ - [APIリファレンス - connpass](http://connpass.com/about/api/)
67
+ - [Doorkeeper API | Doorkeeper](http://www.doorkeeperhq.com/developer/api)
68
+ - [APIリファレンス|Zusaar](http://www.zusaar.com/doc/api.html)
69
+
70
+ ## Supported versions
71
+
72
+ - Ruby 2.0.0 or higher
73
+
74
+ ## Contributing
75
+
76
+ 1. Fork it
77
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
78
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
79
+ 4. Push to the branch (`git push origin my-new-feature`)
80
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.test_files = FileList['spec/**/*_spec.rb']
6
+ t.verbose = true
7
+ end
8
+
9
+ task default: :test
data/events_jp.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'events_jp/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'events_jp'
8
+ spec.version = EventsJp::VERSION
9
+ spec.authors = ['morizyun']
10
+ spec.email = ['merii.ken@gmail.com']
11
+ spec.description = %q{A Ruby wrapper for atnd/connpass/doorkeeper/zusaar API}
12
+ spec.summary = %q{A Ruby wrapper for atnd/connpass/doorkeeper/zusaar API}
13
+ spec.homepage = 'https://github.com/morizyun/events_jp'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
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.required_ruby_version = '>= 2.0.0'
22
+ spec.add_dependency 'hashie'
23
+ spec.add_development_dependency 'bundler', '~> 1.3'
24
+ spec.add_development_dependency 'rake'
25
+ spec.add_development_dependency 'fakeweb'
26
+ spec.add_development_dependency 'rspec'
27
+ end
@@ -0,0 +1,19 @@
1
+ require 'cgi'
2
+ require 'open-uri'
3
+ require 'json'
4
+ require 'hashie/mash'
5
+
6
+ module EventsJp
7
+ module Connection
8
+ def get(endpoint, opt = {})
9
+ url = opt.empty? ? endpoint : "#{endpoint}?#{build_query(opt)}"
10
+ open(url).read
11
+ end
12
+
13
+ private
14
+
15
+ def build_query(options = {})
16
+ options.to_a.map{|o| "#{o[0]}=#{CGI.escape(o[1].to_s)}" }.join('&')
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ module EventsJp
2
+ module Event
3
+ class InvalidException < Exception; end
4
+
5
+ def get_events(keyword: nil, service_limit: nil)
6
+ obj = [EventsJp::Atnd, EventsJp::Connpass, EventsJp::Doorkeeper, EventsJp::Zusaar]
7
+ obj.map do |service|
8
+ next if service == EventsJp::Doorkeeper && keyword
9
+ service.get_events(keyword: keyword, limit: service_limit)
10
+ end.flatten
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,25 @@
1
+ module EventsJp
2
+ class Atnd < EventsJp::EventObject
3
+ ENDPOINT = 'http://api.atnd.org/events/'.freeze
4
+ DEFAULT_OPT = {format: 'json', count: 100}.freeze
5
+
6
+ class << self
7
+ def get_events(keyword: nil, limit: nil)
8
+ res = []
9
+ loop do
10
+ opt = merged_option(keyword, res, DEFAULT_OPT)
11
+ tmp = convert_response(get(ENDPOINT, opt))
12
+ res += tmp
13
+ break if finish_get?(res, tmp, limit)
14
+ sleep(1)
15
+ end
16
+ res.uniq.flatten
17
+ end
18
+
19
+ def convert_response(json_str)
20
+ e = Hashie::Mash.new(JSON.parse(json_str)).events
21
+ e.map { |_| to_basic_hash(_.event) }
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ module EventsJp
2
+ class Connpass < EventsJp::EventObject
3
+ ENDPOINT = 'http://connpass.com/api/v1/event/'.freeze
4
+ DEFAULT_OPT = {order: 2, count: 100}.freeze
5
+
6
+ class << self
7
+ def get_events(keyword: nil, limit: nil)
8
+ res = []
9
+ loop do
10
+ opt = merged_option(keyword, res, DEFAULT_OPT)
11
+ tmp = convert_response(get(ENDPOINT, opt))
12
+ res += tmp
13
+ break if finish_get?(res, tmp, limit)
14
+ sleep(1)
15
+ end
16
+ res.uniq.flatten
17
+ end
18
+
19
+ def convert_response(json_str)
20
+ e = Hashie::Mash.new(JSON.parse(json_str)).events
21
+ e.map { |_| to_basic_hash(_) }
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,51 @@
1
+ module EventsJp
2
+ class Doorkeeper < EventsJp::EventObject
3
+ ENDPOINT = 'http://api.doorkeeper.jp/events'.freeze
4
+ DEFAULT_OPT = {locale: 'ja', sort: 'starts_at'}.freeze
5
+
6
+ class << self
7
+ def get_events(keyword: nil, limit: nil)
8
+ res = []
9
+ 1.upto(1000) do |page|
10
+ opt = merged_option(page, DEFAULT_OPT)
11
+ tmp = convert_response(get(ENDPOINT, opt))
12
+ res += tmp
13
+ break if finish_get?(res, tmp, limit)
14
+ sleep(1)
15
+ end
16
+ res.uniq.flatten
17
+ end
18
+
19
+ def merged_option(page, option)
20
+ opt = option.dup
21
+ opt.merge({page: page})
22
+ end
23
+
24
+ def convert_response(json_str)
25
+ j = JSON.parse(json_str)
26
+ j.map do |_|
27
+ e = Hashie::Mash.new(_).event
28
+ to_basic_hash(e)
29
+ end
30
+ end
31
+
32
+ def to_basic_hash(h)
33
+ Hashie::Mash.new({
34
+ service: service_name,
35
+ address: h[:address],
36
+ title: h[:title],
37
+ catch: nil,
38
+ event_url: h[:public_url],
39
+ started_at: parse_datetime(h[:starts_at]),
40
+ ended_at: parse_datetime(h[:ends_at]),
41
+ place: h[:venue_name],
42
+ lon: h[:long] ? h[:long].to_f : nil,
43
+ lat: h[:lat] ? h[:lat].to_f : nil,
44
+ limit: h[:ticket_limit],
45
+ accepted: h[:participants],
46
+ waiting: h[:waitlisted]
47
+ })
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,46 @@
1
+ module EventsJp
2
+ class EventObject
3
+ class ImplementationException < Exception; end
4
+ extend EventsJp::Connection
5
+
6
+ class << self
7
+ def service_name
8
+ self.name.to_s.downcase.gsub(/^(.*::)/, '')
9
+ end
10
+
11
+ def merged_option(keyword, response, option)
12
+ opt = option.dup
13
+ opt.merge!({start: (response.count + 1)})
14
+ keyword ? opt.merge!(keyword: keyword) : opt
15
+ end
16
+
17
+ def finish_get?(res, current, limit = nil)
18
+ return true if limit.to_i > 0 && res.count >= limit
19
+ return true if current.count == 0
20
+ return false
21
+ end
22
+
23
+ def to_basic_hash(h)
24
+ Hashie::Mash.new({
25
+ service: service_name,
26
+ address: h[:address],
27
+ catch: h[:catch],
28
+ title: h[:title],
29
+ event_url: h[:event_url],
30
+ started_at: parse_datetime(h[:started_at]),
31
+ ended_at: parse_datetime(h[:ended_at]),
32
+ place: h[:place],
33
+ lon: h[:lon].to_f,
34
+ lat: h[:lat].to_f,
35
+ limit: h[:limit],
36
+ accepted: h[:accepted],
37
+ waiting: h[:waiting]
38
+ })
39
+ end
40
+
41
+ def parse_datetime(dt)
42
+ dt ? DateTime.parse(dt) : nil
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,25 @@
1
+ module EventsJp
2
+ class Zusaar < EventsJp::EventObject
3
+ ENDPOINT = 'http://www.zusaar.com/api/event/'.freeze
4
+ DEFAULT_OPT = {count: 100}.freeze
5
+
6
+ class << self
7
+ def get_events(keyword: nil, limit: nil)
8
+ res = []
9
+ loop do
10
+ opt = merged_option(keyword, res, DEFAULT_OPT)
11
+ tmp = convert_response(get(ENDPOINT, opt))
12
+ res += tmp
13
+ break if finish_get?(res, tmp, limit)
14
+ sleep(1)
15
+ end
16
+ res.uniq.flatten
17
+ end
18
+
19
+ def convert_response(json_str)
20
+ e = Hashie::Mash.new(JSON.parse(json_str)).event
21
+ e.map{ |_| to_basic_hash(_) }
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ module EventsJp
2
+ VERSION = '0.0.1'
3
+ end
data/lib/events_jp.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'events_jp/version'
2
+ require 'events_jp/connection'
3
+ require 'events_jp/event'
4
+ require 'events_jp/event_object/event_object'
5
+ require 'events_jp/event_object/atnd'
6
+ require 'events_jp/event_object/connpass'
7
+ require 'events_jp/event_object/doorkeeper'
8
+ require 'events_jp/event_object/zusaar'
9
+
10
+ module EventsJp
11
+ extend EventsJp::Connection
12
+ extend EventsJp::Event
13
+ end
@@ -0,0 +1,52 @@
1
+ $:.unshift(File.expand_path('../', __FILE__))
2
+ require 'spec_helper'
3
+
4
+ describe 'EventsJp::Atnd' do
5
+ describe '.convert_response' do
6
+ before(:each) do
7
+ response = %[{"events": [{"event": {"address": "sample"}}]}]
8
+ @conv_res = EventsJp::Atnd.convert_response(response)
9
+ end
10
+
11
+ it 'converts to Array' do
12
+ expect(@conv_res.class).to eq(Array)
13
+ expect(@conv_res.first.address).to eq('sample')
14
+ end
15
+ end
16
+
17
+ describe '.get_events' do
18
+ context 'with keyword' do
19
+ before(:each) do
20
+ @res = EventsJp::Atnd.get_events(limit: 100, keyword: 'Ruby')
21
+ end
22
+
23
+ it 'returns conpass API results' do
24
+ expect(@res.count).to eq(100)
25
+ expect(@res.first.title).to eq('第16回 tottoruby')
26
+ end
27
+ end
28
+
29
+ context 'no keyword' do
30
+ before(:each) do
31
+ @res = EventsJp::Atnd.get_events(limit: 200)
32
+ end
33
+
34
+ it 'returns conpass API results' do
35
+ expect(@res.count).to eq(200)
36
+ expect(@res.first.service).to eq('atnd')
37
+ expect(@res.first.title).to eq('[テスト] qkstudy #01')
38
+ expect(@res.first.catch).to eq('人は働くために、休みが必要である。')
39
+ expect(@res.first.event_url).to eq('http://atnd.org/events/17662')
40
+ expect(@res.first.started_at).to eq(DateTime.parse('2112-08-20T19:00:00.000+09:00'))
41
+ expect(@res.first.ended_at).to eq(DateTime.parse('2112-08-20T21:30:00.000+09:00'))
42
+ expect(@res.first.address).to eq('東京都千代田区丸の内3丁目5番1号')
43
+ expect(@res.first.place).to eq('東京国際フォーラム ホールB7')
44
+ expect(@res.first.lat).to eq(35.6769467)
45
+ expect(@res.first.lon).to eq(139.7635034)
46
+ expect(@res.first.limit).to be_nil
47
+ expect(@res.first.accepted).to eq(5)
48
+ expect(@res.first.waiting).to eq(0)
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,52 @@
1
+ $:.unshift(File.expand_path('../', __FILE__))
2
+ require 'spec_helper'
3
+
4
+ describe 'EventsJp::Conpass' do
5
+ describe '.convert_response' do
6
+ before(:each) do
7
+ response = %[{"events": [{"address": "sample"}]}]
8
+ @conv_res = EventsJp::Connpass.convert_response(response)
9
+ end
10
+
11
+ it 'converts to Array' do
12
+ expect(@conv_res.class).to eq(Array)
13
+ expect(@conv_res.first.address).to eq('sample')
14
+ end
15
+ end
16
+
17
+ describe '.get_events' do
18
+ context 'with keyword' do
19
+ before(:each) do
20
+ @res = EventsJp::Connpass.get_events(keyword: 'Ruby', limit: 100)
21
+ end
22
+
23
+ it 'returns conpass API results' do
24
+ expect(@res.count).to eq(100)
25
+ expect(@res.first.title).to eq('NDS#39 Niigata.pm tech talk')
26
+ end
27
+ end
28
+
29
+ context 'no keyword' do
30
+ before(:each) do
31
+ @res = EventsJp::Connpass.get_events(limit: 200)
32
+ end
33
+
34
+ it 'returns conpass API results' do
35
+ expect(@res.count).to be >= 199
36
+ expect(@res.first.service).to eq('connpass')
37
+ expect(@res.first.title).to eq('キイロイトリ勉強会')
38
+ expect(@res.first.catch).to eq('キイロイトリの魅力を勉強してください')
39
+ expect(@res.first.event_url).to eq('http://connpass.com/event/14/')
40
+ expect(@res.first.started_at).to eq(DateTime.parse('2038-01-18T03:13:10+09:00'))
41
+ expect(@res.first.ended_at).to eq(DateTime.parse('2038-01-18T03:14:10+09:00'))
42
+ expect(@res.first.address).to eq('東京')
43
+ expect(@res.first.place).to eq('どこか')
44
+ expect(@res.first.lat).to eq(35.6894875)
45
+ expect(@res.first.lon).to eq(139.6917064)
46
+ expect(@res.first.limit).to eq(10)
47
+ expect(@res.first.accepted).to eq(2)
48
+ expect(@res.first.waiting).to eq(0)
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,39 @@
1
+ $:.unshift(File.expand_path('../', __FILE__))
2
+ require 'spec_helper'
3
+
4
+ describe 'EventsJp::Doorkeeper' do
5
+ describe '.convert_response' do
6
+ before(:each) do
7
+ response = %[[{"event":{"address": "sample"}}]]
8
+ @conv_res = EventsJp::Doorkeeper.convert_response(response)
9
+ end
10
+
11
+ it 'converts to Array' do
12
+ expect(@conv_res.class).to eq(Array)
13
+ expect(@conv_res.first.address).to eq('sample')
14
+ end
15
+ end
16
+
17
+ describe '.get_events' do
18
+ before(:each) do
19
+ @res = EventsJp::Doorkeeper.get_events(limit: 50)
20
+ end
21
+
22
+ it 'returns doorkeeper API results' do
23
+ expect(@res.count).to eq(50)
24
+ expect(@res.first.service).to eq('doorkeeper')
25
+ expect(@res.first.catch).to be_nil
26
+ expect(@res.first.title).to eq('大切な人の未来へ贈る タイムカプセルレター(2017年に再会!アースデイ東京2014企画プロジェクト版)')
27
+ expect(@res.first.event_url).to eq('http://asobiba.doorkeeper.jp/events/10448')
28
+ expect(@res.first.started_at).to eq(DateTime.parse('2017-04-30T00:00:00.000Z'))
29
+ expect(@res.first.ended_at).to eq(DateTime.parse('2017-04-30T01:00:00.000Z'))
30
+ expect(@res.first.address).to be_nil
31
+ expect(@res.first.place).to be_nil
32
+ expect(@res.first.lat).to be_nil
33
+ expect(@res.first.lon).to be_nil
34
+ expect(@res.first.limit).to eq(500)
35
+ expect(@res.first.accepted).to eq(115)
36
+ expect(@res.first.waiting).to eq(0)
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,39 @@
1
+ $:.unshift(File.expand_path('../', __FILE__))
2
+ require 'spec_helper'
3
+
4
+ describe 'EventsJp::EventObject' do
5
+ describe '.finish_get?' do
6
+ context 'achieve limit' do
7
+ before(:each) do
8
+ response = %w(1 2)
9
+ @result = EventsJp::EventObject.finish_get?(response, response, 2)
10
+ end
11
+
12
+ it 'return true' do
13
+ expect(@result).to be(true)
14
+ end
15
+ end
16
+
17
+ context 'get no response' do
18
+ before(:each) do
19
+ response = %w(1)
20
+ @result = EventsJp::EventObject.finish_get?(response, [], 2)
21
+ end
22
+
23
+ it 'return true' do
24
+ expect(@result).to be(true)
25
+ end
26
+ end
27
+
28
+ context 'not achieve limit' do
29
+ before(:each) do
30
+ response = %w(1)
31
+ @result = EventsJp::EventObject.finish_get?(response, response, 2)
32
+ end
33
+
34
+ it 'return false' do
35
+ expect(@result).to be(false)
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,52 @@
1
+ $:.unshift(File.expand_path('../', __FILE__))
2
+ require 'spec_helper'
3
+
4
+ describe 'EventsJp::Zusaar' do
5
+ describe '.convert_response' do
6
+ before(:each) do
7
+ response = %[{"event":[{"address":"sample"}]}]
8
+ @conv_res = EventsJp::Zusaar.convert_response(response)
9
+ end
10
+
11
+ it 'converts to Array' do
12
+ expect(@conv_res.class).to eq(Array)
13
+ expect(@conv_res.first.address).to eq('sample')
14
+ end
15
+ end
16
+
17
+ describe '.get_events' do
18
+ context 'with keyword' do
19
+ before(:each) do
20
+ @res = EventsJp::Zusaar.get_events(keyword: 'Ruby', limit: 10)
21
+ end
22
+
23
+ it 'returns conpass API results' do
24
+ expect(@res.count).to eq(10)
25
+ expect(@res.first.title).to eq('もくもくRuby')
26
+ end
27
+ end
28
+
29
+ context 'no keyword' do
30
+ before(:each) do
31
+ @res = EventsJp::Zusaar.get_events(limit: 200)
32
+ end
33
+
34
+ it 'returns zusaar API results' do
35
+ expect(@res.count).to eq(200)
36
+ expect(@res.first.service).to eq('zusaar')
37
+ expect(@res.first.title).to eq('イスラム&ハラル市場進出支援セミナー')
38
+ expect(@res.first.catch).to eq('〜本当は教えたくない東南アジア”イスラム市場”のビジネスチャンス〜')
39
+ expect(@res.first.event_url).to eq('http://www.zusaar.com/event/7667004')
40
+ expect(@res.first.started_at).to eq(DateTime.parse('2014-10-11T13:30:00+09:00'))
41
+ expect(@res.first.ended_at).to eq(DateTime.parse('2014-10-11T15:30:00+09:00'))
42
+ expect(@res.first.address).to eq('東京都千代田区神田鍛冶町3-2-2')
43
+ expect(@res.first.place).to eq('エッサム神田ホール')
44
+ expect(@res.first.lat).to eq(35.6934894)
45
+ expect(@res.first.lon).to eq(139.7712663)
46
+ expect(@res.first.limit).to eq(30)
47
+ expect(@res.first.accepted).to eq(0)
48
+ expect(@res.first.waiting).to eq(0)
49
+ end
50
+ end
51
+ end
52
+ end