Class: Cryptohopper::Resources::Social

Inherits:
Object
  • Object
show all
Defined in:
lib/cryptohopper/resources/social.rb

Overview

‘client.social` — profiles, feed, posts, conversations, social graph. Largest resource in the SDK (27 methods).

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Social

Returns a new instance of Social.



8
9
10
# File 'lib/cryptohopper/resources/social.rb', line 8

def initialize(client)
  @client = client
end

Instance Method Details

#block_user(alias_or_id) ⇒ Object

─── Moderation ───────────────────────────────────────────────────



151
152
153
154
# File 'lib/cryptohopper/resources/social.rb', line 151

def block_user(alias_or_id)
  @client._request("POST", "/social/blockuser",
                   body: { alias: alias_or_id })
end

#check_alias(alias_str) ⇒ Object



23
24
25
26
# File 'lib/cryptohopper/resources/social.rb', line 23

def check_alias(alias_str)
  @client._request("GET", "/social/checkalias",
                   params: { alias: alias_str })
end

#create_post(data) ⇒ Object

─── Posts ────────────────────────────────────────────────────────



76
77
78
# File 'lib/cryptohopper/resources/social.rb', line 76

def create_post(data)
  @client._request("POST", "/social/post", body: data)
end

#delete_comment(comment_id) ⇒ Object



106
107
108
109
# File 'lib/cryptohopper/resources/social.rb', line 106

def delete_comment(comment_id)
  @client._request("POST", "/social/deletecomment",
                   body: { comment_id: comment_id })
end

#delete_message(message_id) ⇒ Object



69
70
71
72
# File 'lib/cryptohopper/resources/social.rb', line 69

def delete_message(message_id)
  @client._request("POST", "/social/deletemessage",
                   body: { message_id: message_id })
end

#delete_post(post_id) ⇒ Object



85
86
87
88
# File 'lib/cryptohopper/resources/social.rb', line 85

def delete_post(post_id)
  @client._request("POST", "/social/deletepost",
                   body: { post_id: post_id })
end

#edit_profile(data) ⇒ Object



19
20
21
# File 'lib/cryptohopper/resources/social.rb', line 19

def edit_profile(data)
  @client._request("POST", "/social/editprofile", body: data)
end

#follow(alias_or_id) ⇒ Object

─── Social graph ─────────────────────────────────────────────────



120
121
122
# File 'lib/cryptohopper/resources/social.rb', line 120

def follow(alias_or_id)
  @client._request("POST", "/social/follow", body: { alias: alias_or_id })
end

#get_comment(comment_id) ⇒ Object

─── Comments ─────────────────────────────────────────────────────



96
97
98
99
# File 'lib/cryptohopper/resources/social.rb', line 96

def get_comment(comment_id)
  @client._request("GET", "/social/getcomment",
                   params: { comment_id: comment_id })
end

#get_comments(post_id) ⇒ Object



101
102
103
104
# File 'lib/cryptohopper/resources/social.rb', line 101

def get_comments(post_id)
  @client._request("GET", "/social/getcomments",
                   params: { post_id: post_id })
end

#get_conversation(conversation_id) ⇒ Object



60
61
62
63
# File 'lib/cryptohopper/resources/social.rb', line 60

def get_conversation(conversation_id)
  @client._request("GET", "/social/loadconversation",
                   params: { conversation_id: conversation_id })
end

#get_conversation_listObject

─── Conversations / messages ─────────────────────────────────────



56
57
58
# File 'lib/cryptohopper/resources/social.rb', line 56

def get_conversation_list
  @client._request("GET", "/social/getconversationlist")
end

#get_feed(**params) ⇒ Object

─── Feed / discovery ─────────────────────────────────────────────



30
31
32
33
# File 'lib/cryptohopper/resources/social.rb', line 30

def get_feed(**params)
  @client._request("GET", "/social/getfeed",
                   params: params.empty? ? nil : params)
end

#get_followers(alias_or_id) ⇒ Object



124
125
126
127
# File 'lib/cryptohopper/resources/social.rb', line 124

def get_followers(alias_or_id)
  @client._request("GET", "/social/followers",
                   params: { alias: alias_or_id })
end

#get_following(alias_or_id) ⇒ Object



129
130
131
132
# File 'lib/cryptohopper/resources/social.rb', line 129

def get_following(alias_or_id)
  @client._request("GET", "/social/following",
                   params: { alias: alias_or_id })
end

#get_following_profiles(alias_or_id) ⇒ Object



134
135
136
137
# File 'lib/cryptohopper/resources/social.rb', line 134

def get_following_profiles(alias_or_id)
  @client._request("GET", "/social/followingprofiles",
                   params: { alias: alias_or_id })
end

#get_media(media_id) ⇒ Object

─── Media ────────────────────────────────────────────────────────



113
114
115
116
# File 'lib/cryptohopper/resources/social.rb', line 113

def get_media(media_id)
  @client._request("GET", "/social/getmedia",
                   params: { media_id: media_id })
end

#get_notifications(**params) ⇒ Object

─── Notifications ────────────────────────────────────────────────



49
50
51
52
# File 'lib/cryptohopper/resources/social.rb', line 49

def get_notifications(**params)
  @client._request("GET", "/social/getnotifications",
                   params: params.empty? ? nil : params)
end

#get_post(post_id) ⇒ Object



80
81
82
83
# File 'lib/cryptohopper/resources/social.rb', line 80

def get_post(post_id)
  @client._request("GET", "/social/getpost",
                   params: { post_id: post_id })
end

#get_profile(alias_or_id) ⇒ Object

─── Profiles ─────────────────────────────────────────────────────



14
15
16
17
# File 'lib/cryptohopper/resources/social.rb', line 14

def get_profile(alias_or_id)
  @client._request("GET", "/social/getprofile",
                   params: { alias: alias_or_id })
end


35
36
37
# File 'lib/cryptohopper/resources/social.rb', line 35

def get_trends
  @client._request("GET", "/social/gettrends")
end

#like(post_id) ⇒ Object

─── Engagement ───────────────────────────────────────────────────



141
142
143
# File 'lib/cryptohopper/resources/social.rb', line 141

def like(post_id)
  @client._request("POST", "/social/like", body: { post_id: post_id })
end

#pin_post(post_id) ⇒ Object



90
91
92
# File 'lib/cryptohopper/resources/social.rb', line 90

def pin_post(post_id)
  @client._request("POST", "/social/pinpost", body: { post_id: post_id })
end

#repost(post_id) ⇒ Object



145
146
147
# File 'lib/cryptohopper/resources/social.rb', line 145

def repost(post_id)
  @client._request("POST", "/social/repost", body: { post_id: post_id })
end

#search(query) ⇒ Object



43
44
45
# File 'lib/cryptohopper/resources/social.rb', line 43

def search(query)
  @client._request("GET", "/social/search", params: { q: query })
end

#send_message(data) ⇒ Object



65
66
67
# File 'lib/cryptohopper/resources/social.rb', line 65

def send_message(data)
  @client._request("POST", "/social/sendmessage", body: data)
end

#who_to_followObject



39
40
41
# File 'lib/cryptohopper/resources/social.rb', line 39

def who_to_follow
  @client._request("GET", "/social/whotofollow")
end