EyeEmConnector 0.0.1 → 0.1.0.beta1
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.
- data/EyeEmConnector.gemspec +84 -0
- data/LICENSE.txt +1 -1
- data/README.rdoc +51 -1
- data/VERSION +1 -1
- data/lib/EyeEmConnector/client.rb +2 -0
- data/lib/EyeEmConnector/models/albums.rb +30 -10
- data/lib/EyeEmConnector/models/news.rb +15 -2
- data/lib/EyeEmConnector/models/photos.rb +73 -7
- data/lib/EyeEmConnector/models/search.rb +1 -1
- data/lib/EyeEmConnector/models/topics.rb +1 -1
- data/lib/EyeEmConnector/models/users.rb +53 -15
- data/lib/EyeEmConnector/models/venues.rb +20 -0
- data/lib/EyeEmConnector/request.rb +47 -7
- metadata +26 -24
@@ -0,0 +1,84 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "EyeEmConnector"
|
8
|
+
s.version = "0.1.0.beta1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Andr\u{e9} Rieck"]
|
12
|
+
s.date = "2012-09-22"
|
13
|
+
s.description = "EyeEm API Wrapper in Ruby"
|
14
|
+
s.email = "4ndr3r13ck@googlemail.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
"EyeEmConnector.gemspec",
|
23
|
+
"Gemfile",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"lib/EyeEmConnector.rb",
|
29
|
+
"lib/EyeEmConnector/client.rb",
|
30
|
+
"lib/EyeEmConnector/configuration.rb",
|
31
|
+
"lib/EyeEmConnector/models/albums.rb",
|
32
|
+
"lib/EyeEmConnector/models/news.rb",
|
33
|
+
"lib/EyeEmConnector/models/photos.rb",
|
34
|
+
"lib/EyeEmConnector/models/search.rb",
|
35
|
+
"lib/EyeEmConnector/models/topics.rb",
|
36
|
+
"lib/EyeEmConnector/models/users.rb",
|
37
|
+
"lib/EyeEmConnector/models/venues.rb",
|
38
|
+
"lib/EyeEmConnector/request.rb",
|
39
|
+
"spec/EyeEmConnector_spec.rb",
|
40
|
+
"spec/spec_helper.rb"
|
41
|
+
]
|
42
|
+
s.homepage = "http://github.com/Varek/EyeEmConnector"
|
43
|
+
s.licenses = ["MIT"]
|
44
|
+
s.require_paths = ["lib"]
|
45
|
+
s.rubygems_version = "1.8.10"
|
46
|
+
s.summary = "EyeEm API Wrapper in Ruby"
|
47
|
+
|
48
|
+
if s.respond_to? :specification_version then
|
49
|
+
s.specification_version = 3
|
50
|
+
|
51
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
52
|
+
s.add_runtime_dependency(%q<oauth2>, [">= 0"])
|
53
|
+
s.add_runtime_dependency(%q<multi_json>, [">= 0"])
|
54
|
+
s.add_runtime_dependency(%q<faraday>, ["~> 0.8.0"])
|
55
|
+
s.add_runtime_dependency(%q<faraday_middleware>, [">= 0"])
|
56
|
+
s.add_runtime_dependency(%q<rash>, [">= 0"])
|
57
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
|
58
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
59
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
60
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
61
|
+
else
|
62
|
+
s.add_dependency(%q<oauth2>, [">= 0"])
|
63
|
+
s.add_dependency(%q<multi_json>, [">= 0"])
|
64
|
+
s.add_dependency(%q<faraday>, ["~> 0.8.0"])
|
65
|
+
s.add_dependency(%q<faraday_middleware>, [">= 0"])
|
66
|
+
s.add_dependency(%q<rash>, [">= 0"])
|
67
|
+
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
68
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
69
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
70
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
71
|
+
end
|
72
|
+
else
|
73
|
+
s.add_dependency(%q<oauth2>, [">= 0"])
|
74
|
+
s.add_dependency(%q<multi_json>, [">= 0"])
|
75
|
+
s.add_dependency(%q<faraday>, ["~> 0.8.0"])
|
76
|
+
s.add_dependency(%q<faraday_middleware>, [">= 0"])
|
77
|
+
s.add_dependency(%q<rash>, [">= 0"])
|
78
|
+
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
79
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
80
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
81
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
data/LICENSE.txt
CHANGED
data/README.rdoc
CHANGED
@@ -1,6 +1,56 @@
|
|
1
1
|
= EyeEmConnector
|
2
2
|
|
3
|
-
Wrapper for the EyeEm API(https://github.com/eyeem/Public-API/wiki).
|
3
|
+
Ruby Wrapper for the EyeEm API(https://github.com/eyeem/Public-API/wiki).
|
4
|
+
|
5
|
+
== Getting started
|
6
|
+
|
7
|
+
Create an EyeEm App here: http://www.eyeem.com/developers and enter at least the client_id and if you need it the retrieved access token from a user in the configuration. And we are ready to go.
|
8
|
+
|
9
|
+
|
10
|
+
require 'EyeEmConnector'
|
11
|
+
|
12
|
+
EyeEmConnector.configure do |config|
|
13
|
+
config.client_id = 'client_id'
|
14
|
+
config.client_secret = 'client_secret'
|
15
|
+
config.access_token = 'access_token'
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
Requests can be done afterwards, lik this:
|
20
|
+
|
21
|
+
|
22
|
+
EyeEmConnector.users(59550)
|
23
|
+
|
24
|
+
|
25
|
+
This returns a Hash like this
|
26
|
+
|
27
|
+
|
28
|
+
{
|
29
|
+
"user"=>{
|
30
|
+
"id"=>"59550",
|
31
|
+
"nickname"=>"varek",
|
32
|
+
"fullname"=>"André",
|
33
|
+
"webUrl"=>"http://www.eyeem.com/u/varek",
|
34
|
+
"thumbUrl"=>"https://graph.facebook.com/1449441885/picture?type=square",
|
35
|
+
"photoUrl"=>"https://graph.facebook.com/1449441885/picture?type=large",
|
36
|
+
"totalPhotos"=>21,
|
37
|
+
"totalFollowers"=>11,
|
38
|
+
"totalFriends"=>13,
|
39
|
+
"totalLikedAlbums"=>15,
|
40
|
+
"totalLikedPhotos"=>31,
|
41
|
+
"description"=>""}
|
42
|
+
}
|
43
|
+
|
44
|
+
|
45
|
+
This works the same way for most of the requests define in the models folder.
|
46
|
+
For optional request parameters take a look at [EyeEm API Wiki](https://github.com/eyeem/Public-API/wiki).
|
47
|
+
|
48
|
+
|
49
|
+
== Todos
|
50
|
+
|
51
|
+
* create tests for the wrapped API
|
52
|
+
* support the process to get the access token of a user
|
53
|
+
* proper documentation
|
4
54
|
|
5
55
|
== Contributing to EyeEmConnector
|
6
56
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.1.0.beta1
|
@@ -21,6 +21,7 @@ module EyeEmConnector
|
|
21
21
|
Faraday::Connection.new(:url => Configuration::ENDPOINT, :params => params, :ssl => {:verify => false}) do |builder|
|
22
22
|
builder.request :oauth2, @access_token unless @access_token.nil?
|
23
23
|
builder.request :json
|
24
|
+
builder.request :multipart
|
24
25
|
builder.response :json
|
25
26
|
builder.adapter Faraday.default_adapter
|
26
27
|
end
|
@@ -33,6 +34,7 @@ module EyeEmConnector
|
|
33
34
|
include EyeEmConnector::Client::Search
|
34
35
|
include EyeEmConnector::Client::Topics
|
35
36
|
include EyeEmConnector::Client::Users
|
37
|
+
include EyeEmConnector::Client::Venues
|
36
38
|
|
37
39
|
end
|
38
40
|
|
@@ -5,43 +5,63 @@ module EyeEmConnector
|
|
5
5
|
module Albums
|
6
6
|
# for the options of different albums endpoints, see https://github.com/eyeem/Public-API/wiki/Albums
|
7
7
|
def albums_recommended(options={})
|
8
|
-
response =
|
8
|
+
response = get('albums/recommended',options)
|
9
9
|
response.body
|
10
10
|
end
|
11
11
|
|
12
12
|
def albums(options={})
|
13
|
-
response =
|
13
|
+
response = get('albums',options)
|
14
14
|
response.body
|
15
15
|
end
|
16
16
|
|
17
17
|
def album(id,options={})
|
18
|
-
response =
|
18
|
+
response = get('albums/'+id.to_s,options)
|
19
19
|
response.body
|
20
20
|
end
|
21
21
|
|
22
22
|
def album_photos(id,options={})
|
23
|
-
response =
|
23
|
+
response = get('albums/'+id.to_s+'/photos',options)
|
24
24
|
response.body
|
25
25
|
end
|
26
26
|
|
27
27
|
def album_likers(id,options={})
|
28
|
-
response =
|
28
|
+
response = get('albums/'+id.to_s+'/likers',options)
|
29
29
|
response.body
|
30
30
|
end
|
31
31
|
|
32
32
|
def album_contributors(id,options={})
|
33
|
-
response =
|
33
|
+
response = get('albums/'+id.to_s+'/contributors',options)
|
34
34
|
response.body
|
35
35
|
end
|
36
36
|
|
37
37
|
def album_liker(album_id,liker_id,options={})
|
38
|
-
response =
|
39
|
-
response.status == 200
|
38
|
+
response = get("albums/#{album_id}/likers/#{liker_id}",options,true)
|
40
39
|
end
|
41
40
|
|
42
41
|
def album_contributor(album_id,contributer_id,options={})
|
43
|
-
response =
|
44
|
-
|
42
|
+
response = get("albums/#{album_id}/contributors/#{contributer_id}",options,true)
|
43
|
+
end
|
44
|
+
|
45
|
+
### PUT
|
46
|
+
|
47
|
+
# for adding photo to an album see add_photo_to_album in photos.rb
|
48
|
+
|
49
|
+
def like_album(album_id,liker_id)
|
50
|
+
response = put("albums/#{album_id}/likers/#{liker_id}",true)
|
51
|
+
end
|
52
|
+
|
53
|
+
### POST
|
54
|
+
|
55
|
+
def share_album(album_id,services) #available services: twitter,facebook,tumblr as comma separated string
|
56
|
+
response = post("albums/#{album_id}/share",options.merge(:services => services),true)
|
57
|
+
end
|
58
|
+
|
59
|
+
### DELETE
|
60
|
+
|
61
|
+
# to remove photo from an albums see remove_photo_to_album in photos.rb
|
62
|
+
|
63
|
+
def unlike_album(album_id,liker_id)
|
64
|
+
response = delete("albums/#{album_id}/likers/#{liker_id}",true)
|
45
65
|
end
|
46
66
|
|
47
67
|
end
|
@@ -5,16 +5,29 @@ module EyeEmConnector
|
|
5
5
|
module News
|
6
6
|
# for the options of different albums endpoints, see https://github.com/eyeem/Public-API/wiki/Albums
|
7
7
|
|
8
|
+
### GET
|
8
9
|
def news(options={}) #access token required
|
9
|
-
response =
|
10
|
+
response = get('news',options)
|
10
11
|
response.body
|
11
12
|
end
|
12
13
|
|
13
14
|
def single_news(id,options={}) #access token required
|
14
|
-
response =
|
15
|
+
response = get("news/#{id}",options)
|
15
16
|
response.body
|
16
17
|
end
|
17
18
|
|
19
|
+
### PUT
|
20
|
+
|
21
|
+
def mark_single_news_read(id,options={})
|
22
|
+
response = put("news/#{id}",options,true)
|
23
|
+
end
|
24
|
+
|
25
|
+
### POST
|
26
|
+
|
27
|
+
def mark_news_read(news_items) #news_items: ids as string, comma separated
|
28
|
+
response = post('news',{:mark_as_read => news_items},true)
|
29
|
+
end
|
30
|
+
|
18
31
|
end
|
19
32
|
end
|
20
33
|
end
|
@@ -5,36 +5,102 @@ module EyeEmConnector
|
|
5
5
|
module Photos
|
6
6
|
# for the options of different albums endpoints, see https://github.com/eyeem/Public-API/wiki/Albums
|
7
7
|
|
8
|
+
|
9
|
+
### GET Request
|
8
10
|
def photos(options={}) #access token needed, returns photos of authenticated user
|
9
|
-
response =
|
11
|
+
response = get('photos',options)
|
10
12
|
response.body
|
11
13
|
end
|
12
14
|
|
13
15
|
def photo(id,options={})
|
14
|
-
response =
|
16
|
+
response = get('photos/'+id.to_s,options)
|
15
17
|
response.body
|
16
18
|
end
|
17
19
|
|
18
20
|
def photo_likers(id,options={})
|
19
|
-
response =
|
21
|
+
response = get('photos/'+id.to_s+'/likers',options)
|
20
22
|
response.body
|
21
23
|
end
|
22
24
|
|
23
25
|
def photo_liker(photo_id,liker_id,options={})
|
24
|
-
response =
|
25
|
-
response.status == 200
|
26
|
+
response = get("photos/#{photo_id.to_s}/likers/#{liker_id}",options,true)
|
26
27
|
end
|
27
28
|
|
28
29
|
def photo_comments(id,options={})
|
29
|
-
response =
|
30
|
+
response = get('photos/'+id.to_s+'/comments',options)
|
30
31
|
response.body
|
31
32
|
end
|
32
33
|
|
33
34
|
def photo_comment(photo_id,contributer_id,options={})
|
34
|
-
response =
|
35
|
+
response = get("photos/#{photo_id.to_s}/comments/#{contributer_id}",options)
|
36
|
+
response.body
|
37
|
+
end
|
38
|
+
|
39
|
+
def photo_albums(id,options={})
|
40
|
+
response = get('photos/'+id.to_s+'/albums',options)
|
41
|
+
response.body
|
42
|
+
end
|
43
|
+
|
44
|
+
def random_photo(options={})
|
45
|
+
response = get('api/popular/random',options)
|
46
|
+
response.body
|
47
|
+
end
|
48
|
+
|
49
|
+
### POST
|
50
|
+
|
51
|
+
def create_photo(photo,options={}) #expects file object, valid image types not defined in the api
|
52
|
+
response = post("photos",options.merge(:photo => photo))
|
53
|
+
response.body
|
54
|
+
end
|
55
|
+
|
56
|
+
def create_photo_comment(photo_id,message,options={})
|
57
|
+
response = post("photos/#{photo_id}/comments",options.merge(:message => message))
|
35
58
|
response.body
|
36
59
|
end
|
37
60
|
|
61
|
+
def add_photo_to_topic(photo_id,topic)
|
62
|
+
response = post("photos/#{photo_id}/topics",options.merge(:topic => topic),true)
|
63
|
+
end
|
64
|
+
|
65
|
+
def flag_photo(photo_id,offense)
|
66
|
+
response = post("photos/#{photo_id}/flag",options.merge(:offense => offense),true)
|
67
|
+
end
|
68
|
+
|
69
|
+
def share_photo(photo_id,services) #available services: twitter,facebook,tumblr,flickr,foursquare as comma separated string
|
70
|
+
response = post("photos/#{photo_id}/share",options.merge(:services => services),true)
|
71
|
+
end
|
72
|
+
|
73
|
+
### PUT
|
74
|
+
|
75
|
+
def update_photo(photo_id,options={})
|
76
|
+
response = put("photos/#{photo_id}",true)
|
77
|
+
end
|
78
|
+
|
79
|
+
def like_photo(photo_id,liker_id,options={})
|
80
|
+
response = put("photos/#{photo_id}/likers/#{liker_id}",options,true)
|
81
|
+
end
|
82
|
+
|
83
|
+
def add_photo_to_album(photo_id,album_id)
|
84
|
+
response = put("photos/#{photo_id}/albums/#{album_id}",true)
|
85
|
+
end
|
86
|
+
|
87
|
+
### DELETE
|
88
|
+
|
89
|
+
def delete_photo(photo_id)
|
90
|
+
response = delete("photos/#{photo_id}",true)
|
91
|
+
end
|
92
|
+
|
93
|
+
def unlike_photo(photo_id,liker_id)
|
94
|
+
response = delete("photos/#{photo_id}/likers/#{liker_id}",options,true)
|
95
|
+
end
|
96
|
+
|
97
|
+
def delete_photo_comment(photo_id,comment_id)
|
98
|
+
response = delete("photos/#{photo_id}/comments/#{comment_id}",true)
|
99
|
+
end
|
100
|
+
|
101
|
+
def remove_photo_to_album(photo_id,album_id)
|
102
|
+
response = delete("photos/#{photo_id}/albums/#{album_id}",true)
|
103
|
+
end
|
38
104
|
end
|
39
105
|
end
|
40
106
|
end
|
@@ -6,70 +6,108 @@ module EyeEmConnector
|
|
6
6
|
# for the options of different users endpoints, see https://github.com/eyeem/Public-API/wiki/users
|
7
7
|
|
8
8
|
def users(options={})
|
9
|
-
response =
|
9
|
+
response = get('users',options)
|
10
10
|
response.body
|
11
11
|
end
|
12
12
|
|
13
13
|
def user(id,options={})
|
14
|
-
response =
|
14
|
+
response = get('users/'+id.to_s,options)
|
15
15
|
response.body
|
16
16
|
end
|
17
17
|
|
18
18
|
def user_photos(id,options={})
|
19
|
-
response =
|
19
|
+
response = get('users/'+id.to_s+'/photos',options)
|
20
20
|
response.body
|
21
21
|
end
|
22
22
|
|
23
23
|
def user_liked_photos(id,options={})
|
24
|
-
response =
|
24
|
+
response = get('users/'+id.to_s+'/likedPhotos',options)
|
25
25
|
response.body
|
26
26
|
end
|
27
27
|
|
28
28
|
def user_friends_photos(id,options={})
|
29
|
-
response =
|
29
|
+
response = get('users/'+id.to_s+'/friendsPhotos',options)
|
30
30
|
response.body
|
31
31
|
end
|
32
32
|
|
33
33
|
def user_liked_albums(id,options={})
|
34
|
-
response =
|
34
|
+
response = get('users/'+id.to_s+'/likedAlbums',options)
|
35
35
|
response.body
|
36
36
|
end
|
37
37
|
|
38
38
|
def user_feed(id,options={}) #access token required
|
39
|
-
response =
|
39
|
+
response = get('users/'+id.to_s+'/feed',options)
|
40
|
+
response.body
|
41
|
+
end
|
42
|
+
|
43
|
+
def user_discover(id,options={}) #access token required
|
44
|
+
response = get('users/'+id.to_s+'/discover',options)
|
40
45
|
response.body
|
41
46
|
end
|
42
47
|
|
43
48
|
def user_friends(id,options={})
|
44
|
-
response =
|
49
|
+
response = get('users/'+id.to_s+'/friends',options)
|
45
50
|
response.body
|
46
51
|
end
|
47
52
|
|
48
53
|
def user_friend(user_id,friend_id,options={})
|
49
|
-
response =
|
50
|
-
response.status == 200
|
54
|
+
response = get("users/#{user_id}/friends/#{friend_id}",options,true)
|
51
55
|
end
|
52
56
|
|
53
57
|
def user_followers(id,options={})
|
54
|
-
response =
|
58
|
+
response = get('users/'+id.to_s+'/followers',options)
|
55
59
|
response.body
|
56
60
|
end
|
57
61
|
|
58
62
|
def user_follower(user_id,follower_id,options={})
|
59
|
-
response =
|
60
|
-
response.status == 200
|
63
|
+
response = get("users/#{user_id}/followers/#{follower_id}",options,true)
|
61
64
|
end
|
62
65
|
|
63
66
|
def user_topics(id,options={}) #access token required
|
64
|
-
response =
|
67
|
+
response = get("users/#{id.to_s}/topics",options)
|
65
68
|
response.body
|
66
69
|
end
|
67
70
|
|
68
71
|
def user_social_media(id,options={}) #access token required
|
69
|
-
response =
|
72
|
+
response = get("users/#{id.to_s}/socialMedia",options)
|
73
|
+
response.body
|
74
|
+
end
|
75
|
+
|
76
|
+
def user_news_settings(id,options={}) #access token required
|
77
|
+
response = get("users/#{id.to_s}/newsSettings",options)
|
78
|
+
response.body
|
79
|
+
end
|
80
|
+
|
81
|
+
### POST
|
82
|
+
|
83
|
+
def set_user_news_settings(id,options={}) #access token required
|
84
|
+
response = post("users/#{id.to_s}/newsSettings",options)
|
85
|
+
response.body
|
86
|
+
end
|
87
|
+
|
88
|
+
def share_user(id,services) #available services: twitter,facebook,tumblr as comma separated string
|
89
|
+
response = post("users/#{id}/share",options.merge(:services => services),true)
|
90
|
+
end
|
91
|
+
|
92
|
+
def add_friends(id,friend_ids) # friend_ids, is a comma separated list of user ids
|
93
|
+
response = post("users/#{id}/friends",{:friend_id => friend_ids},true)
|
94
|
+
end
|
95
|
+
|
96
|
+
def add_social_media(id,service,options={}) #access token required, service as string(twitter,facebook,tumblr,flickr,foursquare), check api doc for options
|
97
|
+
response = post("users/#{id.to_s}/socialMedia/#{service}", options)
|
70
98
|
response.body
|
71
99
|
end
|
72
100
|
|
101
|
+
## DELETE
|
102
|
+
|
103
|
+
def remove_friend(id, friend_id)
|
104
|
+
response = delete("users/#{id}/friends#{friend_id}",true)
|
105
|
+
end
|
106
|
+
|
107
|
+
def remove_social_media(id,service) #access token required, service as string(twitter,facebook,tumblr,flickr,foursquare)
|
108
|
+
response = delete("users/#{id.to_s}/socialMedia/#{service}")
|
109
|
+
response.body
|
110
|
+
end
|
73
111
|
end
|
74
112
|
end
|
75
113
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module EyeEmConnector
|
2
|
+
|
3
|
+
class Client
|
4
|
+
|
5
|
+
module Venues
|
6
|
+
|
7
|
+
## GET
|
8
|
+
def eyeem_foursquare_token
|
9
|
+
response = get('/venues/foursquareToken')
|
10
|
+
response.body
|
11
|
+
end
|
12
|
+
|
13
|
+
## POST
|
14
|
+
def create_venue(service,external_id,name,location)
|
15
|
+
response = post('/venues',{:service => service, :id => external_id, :name => name, :location => location})
|
16
|
+
response.body
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -3,13 +3,53 @@ require 'rash'
|
|
3
3
|
module EyeEmConnector
|
4
4
|
|
5
5
|
module Request
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
|
7
|
+
def get(endpoint, options={}, only_status=false, status_code=200)
|
8
|
+
response = request(:get, endpoint, options)
|
9
|
+
if only_status && response
|
10
|
+
only_success_status(response,status_code)
|
11
|
+
else
|
12
|
+
response
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def post(endpoint, options={}, only_status=false, status_code=200)
|
17
|
+
response = request(:post, endpoint, options)
|
18
|
+
if only_status && response
|
19
|
+
only_success_status(response,status_code)
|
20
|
+
else
|
21
|
+
response
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def put(endpoint, options={}, only_status=false, status_code=200)
|
26
|
+
response = request(:put, endpoint, options)
|
27
|
+
if only_status && response
|
28
|
+
only_success_status(response,status_code)
|
29
|
+
else
|
30
|
+
response
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def delete(endpoint, options={}, only_status=false, status_code=200)
|
35
|
+
response = request(:delete, endpoint, options)
|
36
|
+
if only_status && response
|
37
|
+
only_success_status(response,status_code)
|
38
|
+
else
|
39
|
+
response
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def request(method, endpoint, options)
|
44
|
+
connection.send(method, endpoint, options) || ''
|
45
|
+
end
|
46
|
+
|
47
|
+
def only_success_status(response, status_code=200)
|
48
|
+
if response.status == status_code
|
49
|
+
true
|
50
|
+
else
|
51
|
+
response.body
|
52
|
+
end
|
13
53
|
end
|
14
54
|
end
|
15
55
|
|
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: EyeEmConnector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.0.beta1
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- André Rieck
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-22 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: oauth2
|
16
|
-
requirement: &
|
16
|
+
requirement: &70145761498160 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70145761498160
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: multi_json
|
27
|
-
requirement: &
|
27
|
+
requirement: &70145761490720 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70145761490720
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: faraday
|
38
|
-
requirement: &
|
38
|
+
requirement: &70145761489660 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.8.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70145761489660
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: faraday_middleware
|
49
|
-
requirement: &
|
49
|
+
requirement: &70145761487200 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70145761487200
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rash
|
60
|
-
requirement: &
|
60
|
+
requirement: &70145761486180 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70145761486180
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
|
-
requirement: &
|
71
|
+
requirement: &70145761484020 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 2.8.0
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70145761484020
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rdoc
|
82
|
-
requirement: &
|
82
|
+
requirement: &70145761483180 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '3.12'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70145761483180
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: bundler
|
93
|
-
requirement: &
|
93
|
+
requirement: &70145761475260 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: 1.0.0
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70145761475260
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: jeweler
|
104
|
-
requirement: &
|
104
|
+
requirement: &70145761474220 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: 1.8.3
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70145761474220
|
113
113
|
description: EyeEm API Wrapper in Ruby
|
114
114
|
email: 4ndr3r13ck@googlemail.com
|
115
115
|
executables: []
|
@@ -120,6 +120,7 @@ extra_rdoc_files:
|
|
120
120
|
files:
|
121
121
|
- .document
|
122
122
|
- .rspec
|
123
|
+
- EyeEmConnector.gemspec
|
123
124
|
- Gemfile
|
124
125
|
- LICENSE.txt
|
125
126
|
- README.rdoc
|
@@ -134,6 +135,7 @@ files:
|
|
134
135
|
- lib/EyeEmConnector/models/search.rb
|
135
136
|
- lib/EyeEmConnector/models/topics.rb
|
136
137
|
- lib/EyeEmConnector/models/users.rb
|
138
|
+
- lib/EyeEmConnector/models/venues.rb
|
137
139
|
- lib/EyeEmConnector/request.rb
|
138
140
|
- spec/EyeEmConnector_spec.rb
|
139
141
|
- spec/spec_helper.rb
|
@@ -152,13 +154,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
154
|
version: '0'
|
153
155
|
segments:
|
154
156
|
- 0
|
155
|
-
hash:
|
157
|
+
hash: 2357319563307233460
|
156
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
159
|
none: false
|
158
160
|
requirements:
|
159
|
-
- - ! '
|
161
|
+
- - ! '>'
|
160
162
|
- !ruby/object:Gem::Version
|
161
|
-
version:
|
163
|
+
version: 1.3.1
|
162
164
|
requirements: []
|
163
165
|
rubyforge_project:
|
164
166
|
rubygems_version: 1.8.10
|