CSApi 0.0.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/csapi.gemspec +4 -4
- data/lib/csapi.rb +15 -14
- data/lib/csapi/version.rb +1 -1
- data/readme.md +15 -6
- metadata +14 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98bae49a546f6fd8917d42ce481b284acf3e66cc
|
4
|
+
data.tar.gz: 3bac108b5b5251834cb046d7cd5a378f6f2dd079
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6980287249935b9ffd8df6044ccbe8f3a56bd517c2a66b7b635a2d415012911dad5db2de36a0058032ee2f8e558d927ad7ece9e84ff1d71b19c3697b4339dd78
|
7
|
+
data.tar.gz: a4753309b37975665341225b2bdd278fb42b51104006ba20673a359579135574526e9cbdf001c311308e7e19e840e0dcad225c46d320f97aee840f5ac3620104
|
data/csapi.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.version = CS::VERSION
|
9
9
|
gem.authors = ["Roberto Hidalgo"]
|
10
10
|
gem.email = ["un@rob.mx"]
|
11
|
-
gem.description = "Simple wrapper of couchsurfing.org API for accessing profile, friends, searching, etc."
|
11
|
+
gem.description = "No longer working. Simple wrapper of couchsurfing.org API for accessing profile, friends, searching, etc."
|
12
12
|
gem.summary = "I have no idea what is this"
|
13
13
|
gem.homepage = "https://github.com/unRob/CouchSurfing-API"
|
14
14
|
gem.licenses = ['WTFPL', 'GPLv2']
|
@@ -18,10 +18,10 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
19
19
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
20
20
|
gem.require_paths = ["lib"]
|
21
|
-
|
22
|
-
|
21
|
+
|
22
|
+
|
23
23
|
gem.add_runtime_dependency 'httparty'
|
24
24
|
gem.add_runtime_dependency 'json'
|
25
25
|
gem.add_runtime_dependency 'nokogiri'
|
26
|
-
|
26
|
+
|
27
27
|
end
|
data/lib/csapi.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
=begin
|
5
5
|
|
6
6
|
Licensed under The MIT License
|
7
|
-
Copyright (c) 2012 Partido Surrealista Mexicano
|
7
|
+
Copyright (c) 2012 Partido Surrealista Mexicano
|
8
8
|
=end
|
9
9
|
|
10
10
|
require 'httparty'
|
@@ -18,7 +18,7 @@ require_relative 'csapi/request.rb'
|
|
18
18
|
require_relative 'csapi/search.rb'
|
19
19
|
|
20
20
|
module CS
|
21
|
-
|
21
|
+
|
22
22
|
@@instance = nil
|
23
23
|
|
24
24
|
def self.instance
|
@@ -38,20 +38,21 @@ module CS
|
|
38
38
|
end
|
39
39
|
|
40
40
|
class Api
|
41
|
-
|
41
|
+
|
42
42
|
attr_accessor :uid;
|
43
43
|
@uid = '0'
|
44
|
-
|
44
|
+
|
45
45
|
def initialize(username, password)
|
46
46
|
@username = username
|
47
47
|
r = HTTP.post('/sessions', body:{username: username, password: password}.to_json)
|
48
|
-
|
48
|
+
|
49
|
+
raise CS::APIError.new('Unsupported API version') if r.headers['X-CS-Error'] == 'clientVersionNotSupportedAnymore'
|
49
50
|
raise CS::AuthError.new("Could not login") if r.code != 200
|
50
|
-
|
51
|
+
|
51
52
|
@cookies = []
|
52
53
|
@cookies=r.headers['Set-Cookie'].split(/;/).first
|
53
54
|
#end
|
54
|
-
|
55
|
+
|
55
56
|
data = JSON.parse r.body
|
56
57
|
@uid = data['url'].gsub(/[^\d]/, '')
|
57
58
|
@profile = data.keep_if {|k,v| ['realname', 'username', 'profile_image', 'gender', 'address'].include?(k)}
|
@@ -82,12 +83,12 @@ module CS
|
|
82
83
|
r = HTTP.get(url)
|
83
84
|
JSON.parse r.body
|
84
85
|
end
|
85
|
-
|
86
|
-
|
86
|
+
|
87
|
+
|
87
88
|
def messages(*args)
|
88
89
|
CS::Messages.getMessages(*args)
|
89
90
|
end
|
90
|
-
|
91
|
+
|
91
92
|
|
92
93
|
def message(url)
|
93
94
|
r = HTTP.get(url)
|
@@ -129,7 +130,7 @@ module CS
|
|
129
130
|
|
130
131
|
|
131
132
|
def search(options)
|
132
|
-
|
133
|
+
|
133
134
|
defaults = {
|
134
135
|
location: nil,
|
135
136
|
gender: nil,
|
@@ -142,9 +143,9 @@ module CS
|
|
142
143
|
:'max-age' => nil,
|
143
144
|
:platform => 'android'
|
144
145
|
}
|
145
|
-
|
146
|
-
|
146
|
+
|
147
|
+
|
147
148
|
end
|
148
149
|
end
|
149
|
-
|
150
|
+
|
150
151
|
end
|
data/lib/csapi/version.rb
CHANGED
data/readme.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# DEPRECATED
|
2
|
+
|
3
|
+
This client is no longer supported due to breaking API changes and a lack of time to matain and adapt.
|
4
|
+
If you'd like to take this over, do [get in touch](https://github.com/unRob/CouchSurfing-API/issues/new)!
|
5
|
+
|
6
|
+
|
7
|
+
## This is a simple CouchSurfing API
|
3
8
|
|
4
9
|
This a unofficial CS API client written in Ruby.
|
5
10
|
|
@@ -18,13 +23,17 @@ See [example.rb](https://github.com/unRob/CouchSurfing-API/blob/master/examples/
|
|
18
23
|
|
19
24
|
As a gem:
|
20
25
|
|
21
|
-
|
26
|
+
```
|
27
|
+
gem install CSApi
|
28
|
+
```
|
22
29
|
|
23
30
|
Or by hand:
|
24
31
|
|
25
|
-
|
26
|
-
|
27
|
-
|
32
|
+
```
|
33
|
+
gem install httparty
|
34
|
+
gem install nokogiri
|
35
|
+
git clone https://github.com/unRob/Couchsurfing-API
|
36
|
+
```
|
28
37
|
|
29
38
|
|
30
39
|
##Currently implemented features
|
metadata
CHANGED
@@ -1,66 +1,66 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: CSApi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Hidalgo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: nokogiri
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description: Simple wrapper of couchsurfing.org API for accessing
|
56
|
-
searching, etc.
|
55
|
+
description: No longer working. Simple wrapper of couchsurfing.org API for accessing
|
56
|
+
profile, friends, searching, etc.
|
57
57
|
email:
|
58
58
|
- un@rob.mx
|
59
59
|
executables: []
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
|
-
- .gitignore
|
63
|
+
- ".gitignore"
|
64
64
|
- CONTRIBUTORS
|
65
65
|
- Gemfile
|
66
66
|
- LICENSE
|
@@ -85,19 +85,18 @@ require_paths:
|
|
85
85
|
- lib
|
86
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- -
|
93
|
+
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
97
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.
|
98
|
+
rubygems_version: 2.5.1
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: I have no idea what is this
|
102
102
|
test_files: []
|
103
|
-
has_rdoc: false
|