memerator 0.1.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.
- checksums.yaml +7 -0
- data/README.md +54 -0
- data/lib/memerator.rb +80 -0
- data/lib/memerator/errors.rb +22 -0
- data/lib/memerator/meme.rb +140 -0
- data/lib/memerator/notification.rb +58 -0
- data/lib/memerator/profile.rb +27 -0
- data/lib/memerator/report.rb +63 -0
- data/lib/memerator/stats.rb +27 -0
- data/lib/memerator/user.rb +67 -0
- metadata +86 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 89269102e6a4f1a26aacfdd71394cc549844e20c
|
4
|
+
data.tar.gz: c9bc3131f6b1f93d970dbfb69b73e8a4a3c8089b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dc3a0b7e6457dff88296d417106d92cc203b7d7295ecd78bc0735f31ca884ef455dc7591e1aeb5fea6a80c61c396299e1c5ea81f7dc5a52a326b437667aa96e7
|
7
|
+
data.tar.gz: 0b078cf671b0474045b1e513e144cd9502c036a0449d198218406cf17ce0c18c5e39c339774af1da581eb1dd721007220778a3c0ddeeb47d0589dc840b8ad3d4
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Memerator API for Ruby
|
2
|
+
|
3
|
+
A ruby library for Memerator.
|
4
|
+
|
5
|
+
## What is this for?
|
6
|
+
|
7
|
+
I mean, why not.
|
8
|
+
|
9
|
+
## Disclaimer
|
10
|
+
|
11
|
+
The gem is currently in Beta! Until you see that nice 1.0.0, expect bugs!
|
12
|
+
|
13
|
+
What the API has that this gem can't do yet:
|
14
|
+
|
15
|
+
* Set your username
|
16
|
+
* Get recent memes
|
17
|
+
* Get top memes
|
18
|
+
* Get top memers
|
19
|
+
* Submit a meme
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Put this near the top of your ruby whatever:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require 'memerator'
|
27
|
+
|
28
|
+
Meme = Memerator.new(token: api_token)
|
29
|
+
```
|
30
|
+
|
31
|
+
Now, when you need to run a method, run Meme.method.
|
32
|
+
|
33
|
+
Example for getting profile.
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
"My username is #{Meme.profile.username}!"
|
37
|
+
# => "My username is Chew!"
|
38
|
+
```
|
39
|
+
|
40
|
+
## Lost? allowsMultipleStreams?
|
41
|
+
|
42
|
+
We have a nice helpful support channel on our official Discord Server! Join with [this link](https://discord.gg/FxjjnSF). IRC lover? Join #memerator on irc.chew.pro or irc.freenode.net
|
43
|
+
|
44
|
+
## Documentation
|
45
|
+
|
46
|
+
Stuck? Know Ruby? Check out the [documentation](https://rubydocs.chew.pro/docs/memerator).
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
|
50
|
+
We love contributors! Feel free to open a PR and we will review it.
|
51
|
+
|
52
|
+
## But ruby sucks
|
53
|
+
|
54
|
+
no it's great
|
data/lib/memerator.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# Require external gems
|
2
|
+
require 'json'
|
3
|
+
require 'rest-client'
|
4
|
+
|
5
|
+
# All Memerator functionality, whether extended or just here.
|
6
|
+
class Memerator
|
7
|
+
# Initialize a new Memerator object, via a token.
|
8
|
+
# @param token [String] API token, taken from the Memerator Website.
|
9
|
+
def initialize(token: nil)
|
10
|
+
@token = token
|
11
|
+
end
|
12
|
+
|
13
|
+
# @param perso [String, Integer] the ID of the user, or their username
|
14
|
+
# @raise [Memerator::Errors::InvalidUser] if the user does not exist
|
15
|
+
# @return [User] the user's profile
|
16
|
+
def user(perso)
|
17
|
+
return profile if perso.downcase == 'me'
|
18
|
+
|
19
|
+
data = JSON.parse(RestClient.get("https://memerator.me/api/v1/profile/#{perso}", Authorization: @token))
|
20
|
+
|
21
|
+
User.new(data)
|
22
|
+
rescue RestClient::NotFound
|
23
|
+
raise Memerator::Errors::InvalidUser, "This user doesn't exist!"
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [Profile] your profile
|
27
|
+
def profile
|
28
|
+
data = JSON.parse(RestClient.get('https://memerator.me/api/v1/profile/me', Authorization: @token))
|
29
|
+
Profile.new(data, token: @token)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Get a meme by its id
|
33
|
+
# @param id [String] the Meme ID
|
34
|
+
# @raise [Memerator::Errors::InvalidMeme] if the meme does not exist.
|
35
|
+
# @return [Meme] the meme
|
36
|
+
def meme(id)
|
37
|
+
data = JSON.parse(RestClient.get("https://memerator.me/api/v1/meme/#{id}", Authorization: @token))
|
38
|
+
|
39
|
+
Meme.new(data, token: @token)
|
40
|
+
rescue RestClient::NotFound
|
41
|
+
raise Memerator::Errors::InvalidMeme, "This meme doesn't exist!"
|
42
|
+
end
|
43
|
+
|
44
|
+
# Get a random meme
|
45
|
+
# @return [Meme] the meme
|
46
|
+
def randommeme
|
47
|
+
data = JSON.parse(RestClient.get("https://memerator.me/api/v1/meme/random", Authorization: @token))
|
48
|
+
Meme.new(data, token: @token)
|
49
|
+
end
|
50
|
+
|
51
|
+
# @return [Stats] the site's stats
|
52
|
+
def stats
|
53
|
+
data = JSON.parse(RestClient.get('https://memerator.me/api/v1/stats', Authorization: @token))
|
54
|
+
Stats.new(data)
|
55
|
+
end
|
56
|
+
|
57
|
+
# @return [Array<Notification>] your notifications
|
58
|
+
def notifications
|
59
|
+
notifications = JSON.parse(RestClient.get('https://memerator.me/api/v1/notifications', Authorization: @token))
|
60
|
+
notifications.map { |notification_data| Notification.new(notification_data) }
|
61
|
+
end
|
62
|
+
|
63
|
+
# @return [Array<Report>] your reports
|
64
|
+
def reports
|
65
|
+
reports = JSON.parse(RestClient.get('https://memerator.me/api/v1/reports', Authorization: @token))
|
66
|
+
reports.map { |report_data| Report.new(report_data) }
|
67
|
+
end
|
68
|
+
|
69
|
+
# Get the token from instantiation
|
70
|
+
attr_reader :token
|
71
|
+
end
|
72
|
+
|
73
|
+
# Require files.
|
74
|
+
require_relative 'memerator/meme'
|
75
|
+
require_relative 'memerator/errors'
|
76
|
+
require_relative 'memerator/stats'
|
77
|
+
require_relative 'memerator/report'
|
78
|
+
require_relative 'memerator/notification'
|
79
|
+
require_relative 'memerator/user'
|
80
|
+
require_relative 'memerator/profile'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Errors are the death of us all. If you get an error, delete your account.
|
2
|
+
module Memerator::Errors
|
3
|
+
# Raised if a selected meme is Invalid.
|
4
|
+
# Probably means it doesn't exist.
|
5
|
+
class InvalidMeme < ArgumentError; end
|
6
|
+
|
7
|
+
# Raised if a selected user is invalid.
|
8
|
+
# Probably means they doesn't exist.
|
9
|
+
class InvalidUser < ArgumentError; end
|
10
|
+
|
11
|
+
# Raised if your token sucks
|
12
|
+
class InvalidToken < ArgumentError; end
|
13
|
+
|
14
|
+
# Raised if the meme status didn't really change
|
15
|
+
class NoChange < StandardError; end
|
16
|
+
|
17
|
+
# Raised if you don't have access to the requested resource
|
18
|
+
class NoPermission < StandardError; end
|
19
|
+
|
20
|
+
# Raised if you try to modify a disabled meme.
|
21
|
+
class DisabledMeme < StandardError; end
|
22
|
+
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
# A meme on memerator
|
2
|
+
class Memerator::Meme
|
3
|
+
# @!visibility private
|
4
|
+
def initialize(data, token: nil)
|
5
|
+
@data = data
|
6
|
+
@token = token
|
7
|
+
end
|
8
|
+
|
9
|
+
# @group Meme Information Methods
|
10
|
+
|
11
|
+
# @return [String] the meme's ID.
|
12
|
+
def memeid
|
13
|
+
@data['memeid']
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [String, nil] the caption, if there is one.
|
17
|
+
def caption
|
18
|
+
@data['caption']
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [String] the URL of the image.
|
22
|
+
def image_url
|
23
|
+
@data['url']
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [Float] the average rating.
|
27
|
+
def average_rating
|
28
|
+
@data['rating']['average']
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [Time] the time this meme was submitted.
|
32
|
+
def timestamp
|
33
|
+
Time.parse(@data['timestamp'])
|
34
|
+
end
|
35
|
+
|
36
|
+
# @return [User] the author of this meme.
|
37
|
+
def author
|
38
|
+
Memerator::User.new(@data['author'])
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [String] the URL to the meme
|
42
|
+
def meme_url
|
43
|
+
@data['permalink']
|
44
|
+
end
|
45
|
+
|
46
|
+
# Usually, the only people who can see disabled memes are Staff and the owners of the meme.
|
47
|
+
# This will most likely always be false.
|
48
|
+
# @return [true, false] the meme disabled status.
|
49
|
+
def disabled?
|
50
|
+
@data['disabled']
|
51
|
+
end
|
52
|
+
|
53
|
+
# @endgroup
|
54
|
+
|
55
|
+
# @group Meme Modification Methods
|
56
|
+
|
57
|
+
# Disables the meme, only works if you own the meme!
|
58
|
+
# @raise [Memerator::Errors::NoPermission] if you don't have access to disable the meme
|
59
|
+
# @raise [Memerator::Errors::NoChange] if the meme is already disabled
|
60
|
+
# @raise [Memerator::Errors::InvalidToken] if your token is bad.
|
61
|
+
# @return [true] when successful
|
62
|
+
def disable!
|
63
|
+
response = JSON.parse(RestClient.put("https://memerator.me/api/v1/meme/#{memeid}/disable", {}, Authorization: @token))
|
64
|
+
@data['disabled'] = true
|
65
|
+
response['success']
|
66
|
+
rescue RestClient::NotFound
|
67
|
+
raise Memerator::Errors::NoPermission, "your token doesn't grant you access to this meme"
|
68
|
+
rescue RestClient::BadRequest
|
69
|
+
raise Memerator::Errors::NoChange, "This Meme is already disabled!"
|
70
|
+
rescue RestClient::Unauthorized
|
71
|
+
raise Memerator::Errors::InvalidToken, "Your token expired!"
|
72
|
+
end
|
73
|
+
|
74
|
+
# Enable the meme, only works if you own the meme!
|
75
|
+
# @raise [Memerator::Errors::NoPermission] if you don't have access to enable the meme
|
76
|
+
# @raise [Memerator::Errors::NoChange] if the meme is already enabled
|
77
|
+
# @raise [Memerator::Errors::InvalidToken] if your token is bad.
|
78
|
+
# @return [true] when successful
|
79
|
+
def enable!
|
80
|
+
response = JSON.parse(RestClient.put("https://memerator.me/api/v1/meme/#{memeid}/enable", {}, Authorization: @token))
|
81
|
+
@data['disabled'] = false
|
82
|
+
response['success']
|
83
|
+
rescue RestClient::NotFound
|
84
|
+
raise Memerator::Errors::NoPermission, "your token doesn't grant you access to this meme"
|
85
|
+
rescue RestClient::BadRequest
|
86
|
+
raise Memerator::Errors::NoChange, "This Meme is already disabled!"
|
87
|
+
rescue RestClient::Unauthorized
|
88
|
+
raise Memerator::Errors::InvalidToken, "Your token expired!"
|
89
|
+
end
|
90
|
+
|
91
|
+
# Set the meme caption, only works if you own the meme!
|
92
|
+
# @raise [Memerator::Errors::NoPermission] if you don't have access to modify the meme
|
93
|
+
# @raise [Memerator::Errors::DisabledMeme] if the meme is disabled
|
94
|
+
# @raise [Memerator::Errors::InvalidToken] if your token is bad.
|
95
|
+
# @return [true] when successful
|
96
|
+
def caption=(newcap)
|
97
|
+
raise Memerator::Errors::DisabledMeme, "This meme is disabled and can't be interacted with" if disabled?
|
98
|
+
|
99
|
+
response = JSON.parse(RestClient.put("https://memerator.me/api/v1/meme/#{memeid}/caption", {"caption" => newcap}.to_json, Authorization: @token, 'Content-Type': :json))
|
100
|
+
@data['caption'] = newcap
|
101
|
+
response['success']
|
102
|
+
rescue RestClient::NotFound
|
103
|
+
raise Memerator::Errors::NoPermission, "your token doesn't grant you access to this meme"
|
104
|
+
rescue RestClient::Unauthorized
|
105
|
+
raise Memerator::Errors::InvalidToken, "Your token expired!"
|
106
|
+
end
|
107
|
+
|
108
|
+
# Shorthand for #disable! and #enable!
|
109
|
+
# @see #disable!
|
110
|
+
# @see #enable!
|
111
|
+
# @param dis [true, false] should we disable or enable
|
112
|
+
# @raise [ArgumentError] if you didn't provide true or false
|
113
|
+
# @return [true] if the meme was disabled
|
114
|
+
# @return [false] if the meme was enabled
|
115
|
+
def disabled=(dis)
|
116
|
+
case dis
|
117
|
+
when true
|
118
|
+
disable!
|
119
|
+
when false
|
120
|
+
enable!
|
121
|
+
else
|
122
|
+
raise ArgumentError, "please provide true or false"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
# Rate a meme
|
127
|
+
# This was a long running joke, in fact, until recently, you couldn't even rate a meme from the API! You're welcome.
|
128
|
+
# @param rating [Integer] the rating to give this meme
|
129
|
+
def rate(rating)
|
130
|
+
raise Memerator::Errors::DisabledMeme, "This meme is disabled and can't be interacted with" if disabled?
|
131
|
+
raise ArgumentError, "Your rating is bad mate!" if rating > 5 || rating < 1 || rating.to_i != rating
|
132
|
+
|
133
|
+
response = JSON.parse(RestClient.post("https://memerator.me/api/v1/meme/#{memeid}/rate", {"rating" => rating}.to_json, Authorization: @token, 'Content-Type': :json))
|
134
|
+
response['success']
|
135
|
+
rescue RestClient::NotFound
|
136
|
+
raise Memerator::Errors::NoPermission, "your token doesn't grant you access to this meme"
|
137
|
+
rescue RestClient::Unauthorized
|
138
|
+
raise Memerator::Errors::InvalidToken, "Your token expired!"
|
139
|
+
end
|
140
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# A notification
|
2
|
+
class Memerator::Notification
|
3
|
+
# @!visibility private
|
4
|
+
def initialize(data)
|
5
|
+
@data = data
|
6
|
+
end
|
7
|
+
|
8
|
+
# @return [Integer] the ID of this notification
|
9
|
+
def id
|
10
|
+
@data['id']
|
11
|
+
end
|
12
|
+
|
13
|
+
# @return [User] the sender of this notification.
|
14
|
+
def sender
|
15
|
+
Memerator::User.new(@data['sender'])
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [Time] the time this was sent
|
19
|
+
def timestamp
|
20
|
+
Time.parse(@data['timestamp'])
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [String] the notification, formatted.
|
24
|
+
def message
|
25
|
+
@data['message']
|
26
|
+
end
|
27
|
+
|
28
|
+
# @return [String] the raw message as it appears on Memerator.me
|
29
|
+
def raw
|
30
|
+
@data['raw']
|
31
|
+
end
|
32
|
+
|
33
|
+
# The type is mostly used internally but is useful for cliens implementing notification sorting.
|
34
|
+
# Type 0 is a meme rating notification
|
35
|
+
# Type 1 is a follow notification
|
36
|
+
# Type 2 is a notice.
|
37
|
+
# Type 3 is a report status update
|
38
|
+
# @return [Integer] the type of this message
|
39
|
+
def type
|
40
|
+
@data['type']
|
41
|
+
end
|
42
|
+
|
43
|
+
# For meme ratings, the meme ID is returned, if you need it!
|
44
|
+
# @return [String, nil] the meme ID, if type == 0
|
45
|
+
def memeid
|
46
|
+
return nil if @data['meme'].nil?
|
47
|
+
|
48
|
+
@data['meme']['memeid']
|
49
|
+
end
|
50
|
+
|
51
|
+
# For meme ratings, the meme rating is returned, if you need it!
|
52
|
+
# @return [Integer, nil] the meme rating, if type == 0
|
53
|
+
def memeid
|
54
|
+
return nil if @data['meme'].nil?
|
55
|
+
|
56
|
+
@data['meme']['rating']
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# A profile is a user, but has more details.
|
2
|
+
# Usually, only the authenticated user can see these.
|
3
|
+
class Memerator::Profile < Memerator::User
|
4
|
+
# @!visibility private
|
5
|
+
def initialize(data, token: nil)
|
6
|
+
@data = data
|
7
|
+
@token = token
|
8
|
+
end
|
9
|
+
|
10
|
+
# @return [Time, nil] the time when your Pro subscription expires, if you have one
|
11
|
+
def pro_expires
|
12
|
+
Time.parse(@data['pro']['expires'])
|
13
|
+
end
|
14
|
+
|
15
|
+
# @return [Time, nil] the time when your Pro subscription started, if you have one
|
16
|
+
def pro_since
|
17
|
+
Time.parse(@data['pro']['since'])
|
18
|
+
end
|
19
|
+
|
20
|
+
# Update your Bio!
|
21
|
+
# @return [true] the success
|
22
|
+
def bio=(new_bio)
|
23
|
+
response = JSON.parse(RestClient.post("https://memerator.me/api/v1/profile/me", { "bio" => new_bio }.to_json, Authorization: @token, 'Content-Type': :json))
|
24
|
+
@data['bio'] = new_bio
|
25
|
+
response['success']
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# A report!
|
2
|
+
class Memerator::Report
|
3
|
+
# @!visibility private
|
4
|
+
def initialize(data)
|
5
|
+
@data = data
|
6
|
+
end
|
7
|
+
|
8
|
+
# @return [Integer] the report ID.
|
9
|
+
def id
|
10
|
+
@data['id']
|
11
|
+
end
|
12
|
+
|
13
|
+
# The status of the meme. Used to see where the report is.
|
14
|
+
# Status 0 means it's open and unclaimed
|
15
|
+
# Status 1 means it's claimed, but not settled.
|
16
|
+
# Status 2 means it's resolved.
|
17
|
+
def status
|
18
|
+
@data['status']
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [String] the ID of the meme being reported.
|
22
|
+
def memeid
|
23
|
+
@data['memeid']
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [String] the reason for the report.
|
27
|
+
def reason
|
28
|
+
@data['message']['reason']
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [String] more detailed explanation
|
32
|
+
def description
|
33
|
+
@data['message']['description']
|
34
|
+
end
|
35
|
+
|
36
|
+
# @return [User] the staff member assigned to this report
|
37
|
+
# @return [nil] if no one is assigned.
|
38
|
+
def assignee
|
39
|
+
return nil if @data['assignee'].nil?
|
40
|
+
|
41
|
+
Memerator::User.new(@data['assignee'])
|
42
|
+
end
|
43
|
+
|
44
|
+
# @return [String, nil] the staff member's comment, if they responded.
|
45
|
+
def comment
|
46
|
+
@data['comment']
|
47
|
+
end
|
48
|
+
|
49
|
+
# @return [true, false] if the report is open
|
50
|
+
def open?
|
51
|
+
status == 0
|
52
|
+
end
|
53
|
+
|
54
|
+
# @return [true, false] if the report is assigned to someone
|
55
|
+
def assigned?
|
56
|
+
status == 1
|
57
|
+
end
|
58
|
+
|
59
|
+
# @return [true, false] if the report is closed
|
60
|
+
def closed?
|
61
|
+
status == 2
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# The Memerator Stats
|
2
|
+
class Memerator::Stats
|
3
|
+
# @!visibility private
|
4
|
+
def initialize(data)
|
5
|
+
@data = data
|
6
|
+
end
|
7
|
+
|
8
|
+
# @return [Integer] the total number of Memerator memes
|
9
|
+
def memes
|
10
|
+
@data['memes']
|
11
|
+
end
|
12
|
+
|
13
|
+
# @return [Integer] the total number of ratings
|
14
|
+
def ratings
|
15
|
+
@data['ratings']
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [Integer] the number of registered website users
|
19
|
+
def users
|
20
|
+
@data['website_users']
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [Integer] the total number of people who have submitted a meme
|
24
|
+
def memers
|
25
|
+
@data['unique_memers']
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# A user is a Memerator User. Data everyone (with a token) can access
|
2
|
+
class Memerator::User
|
3
|
+
# @!visibility private
|
4
|
+
def initialize(data)
|
5
|
+
@data = data
|
6
|
+
end
|
7
|
+
|
8
|
+
# @return [String] the user's username
|
9
|
+
def username
|
10
|
+
@data['username']
|
11
|
+
end
|
12
|
+
|
13
|
+
# @return [Integer] the user's ID
|
14
|
+
def id
|
15
|
+
@data['id']
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [String] the user's bio
|
19
|
+
def bio
|
20
|
+
@data['bio']
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [Integer] the amount of followers this user has
|
24
|
+
def followers
|
25
|
+
@data['stats']['followers']
|
26
|
+
end
|
27
|
+
|
28
|
+
# @return [Integer] the amount of users this user is following
|
29
|
+
def following
|
30
|
+
@data['stats']['following']
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [Integer] the amount of memes this user has
|
34
|
+
def memes
|
35
|
+
@data['stats']['memes']
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return [true, false] the user's verification status
|
39
|
+
def verified?
|
40
|
+
@data['perks']['verified']
|
41
|
+
end
|
42
|
+
|
43
|
+
# @return [true, false] the user's staff member status
|
44
|
+
def staff?
|
45
|
+
@data['perks']['staff']
|
46
|
+
end
|
47
|
+
|
48
|
+
# @return [true, false] the user's translator status
|
49
|
+
def translator?
|
50
|
+
@data['perks']['translator']
|
51
|
+
end
|
52
|
+
|
53
|
+
# @return [true, false] the user's pro status
|
54
|
+
def pro?
|
55
|
+
@data['perks']['pro']
|
56
|
+
end
|
57
|
+
|
58
|
+
# @return [String] the user's profile link
|
59
|
+
def link
|
60
|
+
@data['permalink']
|
61
|
+
end
|
62
|
+
|
63
|
+
# @return [Time] the user's join time
|
64
|
+
def joined
|
65
|
+
Time.parse(@data['joined'])
|
66
|
+
end
|
67
|
+
end
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: memerator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chew
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-07-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.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.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rest-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.1.0.rc1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.1.0.rc1
|
41
|
+
description: The Memerator.me API Libary wrapper in Ruby.
|
42
|
+
email: chew@memerator.me
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- README.md
|
48
|
+
- lib/memerator.rb
|
49
|
+
- lib/memerator/errors.rb
|
50
|
+
- lib/memerator/meme.rb
|
51
|
+
- lib/memerator/notification.rb
|
52
|
+
- lib/memerator/profile.rb
|
53
|
+
- lib/memerator/report.rb
|
54
|
+
- lib/memerator/stats.rb
|
55
|
+
- lib/memerator/user.rb
|
56
|
+
homepage: https://github.com/Memerator/memerator-sdk-ruby
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata:
|
60
|
+
bug_tracker_uri: https://github.com/Memerator/memerator-sdk-ruby/issues
|
61
|
+
changelog_uri: https://github.com/Memerator/memerator-sdk-ruby/releases
|
62
|
+
documentation_uri: https://rubydocs.chew.pro/docs/memerator
|
63
|
+
homepage_uri: https://github.com/Memerator/memerator-sdk-ruby
|
64
|
+
source_code_uri: https://github.com/Memerator/memerator-sdk-ruby
|
65
|
+
wiki_uri: https://github.com/Memerator/memerator-sdk-ruby/wiki
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 2.2.4
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
requirements: []
|
81
|
+
rubyforge_project:
|
82
|
+
rubygems_version: 2.6.14
|
83
|
+
signing_key:
|
84
|
+
specification_version: 4
|
85
|
+
summary: The Memerator.me API Libary wrapper in Ruby
|
86
|
+
test_files: []
|