chute 0.0.2 → 2.0.0
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/Gemfile +16 -2
- data/Gemfile.lock +52 -0
- data/LICENSE.txt +20 -0
- data/README.md +46 -0
- data/Rakefile +48 -6
- data/VERSION +1 -0
- data/chute.gemspec +120 -16
- data/lib/chute.rb +7 -20
- data/lib/chute/client.rb +42 -0
- data/lib/chute/configuration.rb +40 -0
- data/lib/chute/connection.rb +64 -0
- data/lib/chute/response.rb +22 -0
- data/lib/chute/v2/albums.rb +60 -0
- data/lib/chute/v2/assets.rb +55 -0
- data/lib/chute/v2/comments.rb +29 -0
- data/lib/chute/v2/flags.rb +21 -0
- data/lib/chute/v2/hearts.rb +21 -0
- data/lib/chute/v2/parcels.rb +21 -0
- data/lib/chute/v2/tags.rb +36 -0
- data/lib/chute/v2/triggers.rb +26 -0
- data/lib/chute/v2/users.rb +18 -0
- data/lib/chute/v2/votes.rb +21 -0
- data/lib/chute/version.rb +7 -1
- data/spec/chute/chute_spec.rb +64 -0
- data/spec/chute/client_spec.rb +82 -0
- data/spec/chute/connection_spec.rb +47 -0
- data/spec/chute/response_spec.rb +16 -0
- data/spec/chute/v2/albums_spec.rb +197 -0
- data/spec/chute/v2/assets_spec.rb +171 -0
- data/spec/chute/v2/comments_spec.rb +88 -0
- data/spec/chute/v2/flags_spec.rb +56 -0
- data/spec/chute/v2/hearts_spec.rb +57 -0
- data/spec/chute/v2/parcels_spec.rb +24 -0
- data/spec/chute/v2/tags_spec.rb +79 -0
- data/spec/chute/v2/trigger_spec.rb +127 -0
- data/spec/chute/v2/users_spec.rb +53 -0
- data/spec/chute/v2/votes_spec.rb +56 -0
- data/spec/fixtures/chute_cassettes/albums/album_create_with_permission_view.yml +69 -0
- data/spec/fixtures/chute_cassettes/albums/albums_add_remove_assets.yml +187 -0
- data/spec/fixtures/chute_cassettes/albums/albums_create.yml +69 -0
- data/spec/fixtures/chute_cassettes/albums/albums_delete.yml +128 -0
- data/spec/fixtures/chute_cassettes/albums/albums_get.yml +135 -0
- data/spec/fixtures/chute_cassettes/albums/albums_list.yml +89 -0
- data/spec/fixtures/chute_cassettes/albums/albums_stats.yml +128 -0
- data/spec/fixtures/chute_cassettes/albums/albums_update.yml +135 -0
- data/spec/fixtures/chute_cassettes/assets/assets_delete.yml +131 -0
- data/spec/fixtures/chute_cassettes/assets/assets_geo.yml +197 -0
- data/spec/fixtures/chute_cassettes/assets/assets_get.yml +138 -0
- data/spec/fixtures/chute_cassettes/assets/assets_import.yml +76 -0
- data/spec/fixtures/chute_cassettes/assets/assets_list.yml +77 -0
- data/spec/fixtures/chute_cassettes/assets/assets_update.yml +138 -0
- data/spec/fixtures/chute_cassettes/comments/comments_create.yml +196 -0
- data/spec/fixtures/chute_cassettes/comments/comments_list.yml +259 -0
- data/spec/fixtures/chute_cassettes/flags/flags_methods.yml +313 -0
- data/spec/fixtures/chute_cassettes/hearts/hearts_methods.yml +254 -0
- data/spec/fixtures/chute_cassettes/tags/tags_assets.yml +311 -0
- data/spec/fixtures/chute_cassettes/triggers/trigger_errors.yml +62 -0
- data/spec/fixtures/chute_cassettes/triggers/triggers_cleanup.yml +184 -0
- data/spec/fixtures/chute_cassettes/triggers/triggers_create.yml +65 -0
- data/spec/fixtures/chute_cassettes/triggers/triggers_delete.yml +124 -0
- data/spec/fixtures/chute_cassettes/triggers/triggers_list.yml +66 -0
- data/spec/fixtures/chute_cassettes/triggers/triggers_update.yml +127 -0
- data/spec/fixtures/chute_cassettes/users/users_get.yml +128 -0
- data/spec/fixtures/chute_cassettes/users/users_me.yml +66 -0
- data/spec/fixtures/chute_cassettes/votes/votes_methods.yml +313 -0
- data/spec/spec_helper.rb +27 -0
- metadata +210 -33
- data/.gitignore +0 -5
- data/README +0 -125
- data/config/chute.rb +0 -0
- data/lib/chute/account.rb +0 -58
- data/lib/chute/app.rb +0 -32
- data/lib/chute/asset.rb +0 -124
- data/lib/chute/bundle.rb +0 -72
- data/lib/chute/chute.rb +0 -203
- data/lib/chute/collection.rb +0 -47
- data/lib/chute/comment.rb +0 -32
- data/lib/chute/exception.rb +0 -7
- data/lib/chute/http_service.rb +0 -114
- data/lib/chute/inbox.rb +0 -41
- data/lib/chute/parcel.rb +0 -45
- data/lib/chute/resource.rb +0 -354
- data/lib/chute/user.rb +0 -113
- data/lib/chute/util.rb +0 -14
- data/test/test_sudoku.rb +0 -7
data/lib/chute/user.rb
DELETED
@@ -1,113 +0,0 @@
|
|
1
|
-
module Chute
|
2
|
-
class GCUser < GCResource
|
3
|
-
attr_accessor :id,
|
4
|
-
:name,
|
5
|
-
:email,
|
6
|
-
:login,
|
7
|
-
:avatar,
|
8
|
-
:notification_photos,
|
9
|
-
:notification_comments,
|
10
|
-
:notification_invites
|
11
|
-
|
12
|
-
def initialize(attributes = {})
|
13
|
-
super
|
14
|
-
@id = attributes[:id]
|
15
|
-
@name = attributes[:name]
|
16
|
-
@email = attributes[:email]
|
17
|
-
@login = attributes[:login]
|
18
|
-
@notification_photos = attributes[:notification_photos]
|
19
|
-
@notification_invites = attributes[:notification_invites]
|
20
|
-
@notification_comments = attributes[:notification_comments]
|
21
|
-
end
|
22
|
-
|
23
|
-
# Public: Returns pluralized name of the resource.
|
24
|
-
def resource_name
|
25
|
-
"me"
|
26
|
-
end
|
27
|
-
|
28
|
-
# Public: Returns resource path.
|
29
|
-
def resource_path
|
30
|
-
"#{resource_name}"
|
31
|
-
end
|
32
|
-
|
33
|
-
# Public: Collection of accounts associated with user.
|
34
|
-
#
|
35
|
-
# Returns GCCollection of GCAccount.
|
36
|
-
def accounts
|
37
|
-
Chute::GCAccount.perform(self.class.get("/#{id}/accounts"))
|
38
|
-
end
|
39
|
-
|
40
|
-
# Public: Collection of assets associated with user.
|
41
|
-
#
|
42
|
-
# Returns GCCollection of GCAsset.
|
43
|
-
def assets
|
44
|
-
Chute::GCAsset.perform(self.class.get("/#{id}/assets"))
|
45
|
-
end
|
46
|
-
|
47
|
-
# Public: Collection of bundles associated with user.
|
48
|
-
#
|
49
|
-
# Returns GCCollection of GCBundle.
|
50
|
-
def bundles
|
51
|
-
Chute::GCBundle.perform(self.class.get("/#{id}/bundles"))
|
52
|
-
end
|
53
|
-
|
54
|
-
# Public: Collection of chutes associated with user.
|
55
|
-
#
|
56
|
-
# Returns GCCollection of GCChute.
|
57
|
-
def chutes
|
58
|
-
Chute::GCChute.perform(self.class.get("/#{id}/chutes"))
|
59
|
-
end
|
60
|
-
|
61
|
-
# Public: Collection of parcels associated with user.
|
62
|
-
#
|
63
|
-
# Returns GCCollection of GCParcel.
|
64
|
-
def parcels
|
65
|
-
Chute::GCParcel.perform(self.class.get("/#{id}/parcels"))
|
66
|
-
end
|
67
|
-
|
68
|
-
# Public: Collection of favorite assets associated with user.
|
69
|
-
#
|
70
|
-
# Returns GCCollection of GCChute.
|
71
|
-
def hearts
|
72
|
-
Chute::GCChute.perform(self.class.get("/#{id}/hearts"))
|
73
|
-
end
|
74
|
-
|
75
|
-
#below collections aren't working yet, there classes still ned to be implemented.
|
76
|
-
def devices
|
77
|
-
Chute::GCAsset.perform(self.class.get("/#{id}/devices"))
|
78
|
-
end
|
79
|
-
|
80
|
-
def notices
|
81
|
-
Chute::GCAsset.perform(self.class.get("/#{id}/notices"))
|
82
|
-
end
|
83
|
-
|
84
|
-
|
85
|
-
# Public: Generate single use token for logging into Chute.
|
86
|
-
#
|
87
|
-
# Returns single use token String.
|
88
|
-
def single_use_token
|
89
|
-
response = self.class.get("/oauth/single_use_token", nil, {'X_USER_IDENTIFIER' => id})
|
90
|
-
response.data
|
91
|
-
end
|
92
|
-
|
93
|
-
# Public: Returns pluralized name of the resource.
|
94
|
-
def class_path
|
95
|
-
"me"
|
96
|
-
end
|
97
|
-
|
98
|
-
# Public: Fetch user from the API key.
|
99
|
-
#
|
100
|
-
# Example
|
101
|
-
#
|
102
|
-
# Chute::GCUser.me
|
103
|
-
# # => user
|
104
|
-
# # => false if not found
|
105
|
-
# Returns GCUser.
|
106
|
-
|
107
|
-
def self.me
|
108
|
-
user = Chute::GCUser.new
|
109
|
-
user.perform(get("/info")) ? user : false
|
110
|
-
end
|
111
|
-
|
112
|
-
end
|
113
|
-
end
|
data/lib/chute/util.rb
DELETED