airbnb 0.0.1 → 0.0.2
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 +4 -4
- data/.gitignore +1 -0
- data/README.md +4 -10
- data/airbnb.gemspec +11 -11
- data/lib/airbnb.rb +6 -2
- data/lib/airbnb/base.rb +28 -0
- data/lib/airbnb/v1.rb +13 -0
- data/lib/airbnb/v2.rb +7 -0
- data/lib/airbnb/v2/listings.rb +9 -0
- data/lib/airbnb/v2/users.rb +9 -0
- data/lib/airbnb/version.rb +1 -1
- metadata +38 -7
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 762f80516b2878340eb1ded6c802f2bef58d3475
|
4
|
+
data.tar.gz: 991569f1aafd8959b48f01de2606d03f0b980f0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8add642380ca41370474e9705977f4efeacff3a4ba188fc62ae63703e97c5c1b6872aed9164c0c2a19ddac5dd6bde2110d4bf1259e217596778ee963a22d7960
|
7
|
+
data.tar.gz: 07179527a71e2b416f8086bf7423758bcad97477fe98d5a187c8d0d000d6d1ba5a39f73af506c0f717ea2d1c125033c604da72482df60a874970d9961fb00fe2
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Airbnb
|
2
|
+
[](http://badge.fury.io/rb/airbnb)
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
4
|
+
A Ruby interface to the Airbnb API.
|
5
|
+
Be careful, this gem is under development. Your pull requests are welcome!
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -22,13 +22,7 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
TODO
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
25
|
+
TODO...
|
32
26
|
|
33
27
|
## Contributing
|
34
28
|
|
data/airbnb.gemspec
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
lib = File.expand_path('../lib', __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'airbnb/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
|
-
spec.
|
6
|
+
spec.add_dependency 'http', '~> 2.0'
|
7
|
+
spec.add_dependency 'mechanize', '~> 2.0'
|
8
|
+
|
9
|
+
spec.name = 'airbnb'
|
8
10
|
spec.version = Airbnb::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
+
spec.authors = ['Kei Tsuchiya']
|
12
|
+
spec.email = ['kei.tsuchiya86@gmail.com']
|
11
13
|
|
12
|
-
spec.
|
13
|
-
spec.
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
14
|
+
spec.description = 'A Ruby interface to the Airbnb API.'
|
15
|
+
spec.summary = spec.description
|
16
|
+
spec.homepage = 'https://github.com/kei500/airbnb'
|
17
|
+
spec.license = 'MIT'
|
16
18
|
|
17
19
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
20
|
f.match(%r{^(test|spec|features)/})
|
19
21
|
end
|
20
|
-
spec.
|
21
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
-
spec.require_paths = ["lib"]
|
22
|
+
spec.require_paths = ['lib']
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.13"
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/lib/airbnb.rb
CHANGED
data/lib/airbnb/base.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'http'
|
2
|
+
require 'mechanize'
|
3
|
+
|
4
|
+
module Airbnb
|
5
|
+
class Base
|
6
|
+
URL = 'https://api.airbnb.com'.freeze
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def get(endpoint, params = {params: {}})
|
10
|
+
params[:params][:client_id] = client_id
|
11
|
+
HTTP.get(endpoint, params)
|
12
|
+
end
|
13
|
+
|
14
|
+
def post(endpoint, params)
|
15
|
+
params[:form][:client_id] = client_id
|
16
|
+
HTTP.post(endpoint, params)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def client_id
|
22
|
+
@@client_id ||= JSON.parse(
|
23
|
+
Mechanize.new.get("https://www.airbnb.com").search(:meta).select{|e| e['id'] == '_bootstrap-layout-init'}.first.get_attribute(:content)
|
24
|
+
)['api_config']['key']
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/airbnb/v1.rb
ADDED
data/lib/airbnb/v2.rb
ADDED
data/lib/airbnb/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airbnb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kei Tsuchiya
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: http
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
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'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mechanize
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: bundler
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,7 +80,7 @@ dependencies:
|
|
52
80
|
- - "~>"
|
53
81
|
- !ruby/object:Gem::Version
|
54
82
|
version: '3.0'
|
55
|
-
description: A Ruby interface to the Airbnb.
|
83
|
+
description: A Ruby interface to the Airbnb API.
|
56
84
|
email:
|
57
85
|
- kei.tsuchiya86@gmail.com
|
58
86
|
executables: []
|
@@ -68,9 +96,12 @@ files:
|
|
68
96
|
- README.md
|
69
97
|
- Rakefile
|
70
98
|
- airbnb.gemspec
|
71
|
-
- bin/console
|
72
|
-
- bin/setup
|
73
99
|
- lib/airbnb.rb
|
100
|
+
- lib/airbnb/base.rb
|
101
|
+
- lib/airbnb/v1.rb
|
102
|
+
- lib/airbnb/v2.rb
|
103
|
+
- lib/airbnb/v2/listings.rb
|
104
|
+
- lib/airbnb/v2/users.rb
|
74
105
|
- lib/airbnb/version.rb
|
75
106
|
homepage: https://github.com/kei500/airbnb
|
76
107
|
licenses:
|
@@ -95,5 +126,5 @@ rubyforge_project:
|
|
95
126
|
rubygems_version: 2.5.1
|
96
127
|
signing_key:
|
97
128
|
specification_version: 4
|
98
|
-
summary: A Ruby interface to the Airbnb.
|
129
|
+
summary: A Ruby interface to the Airbnb API.
|
99
130
|
test_files: []
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "airbnb"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|