Class: Hiya::Link
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Attributes inherited from Base
#api_url, #bearer_token, #response, #source
Instance Method Summary collapse
-
#destroy(code, params) ⇒ Object
code: a2e1M params: Hash: { token: String(required), }.
-
#update(code, params) ⇒ Object
code: a2e1M params: Hash: { token: String(required), attach: Hash: { password: String: ‘1234’ password_note: String: ‘today’ expired_num: Integer: 3600 view_count_limit: Integer: 100 } post: Hash: { content: String: ‘This is post content’ } }.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Hiya::Base
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
5 6 7 |
# File 'lib/hiya/link.rb', line 5 def code @code end |
Instance Method Details
#destroy(code, params) ⇒ Object
code: a2e1M params: Hash:
token: String(required),
33 34 35 36 37 38 39 40 |
# File 'lib/hiya/link.rb', line 33 def destroy(code, params) @response = conn.delete("/v1/links/#{code}") do |req| req.body = params.to_json end Oj.load(response.body, symbol_keys: true) rescue StandardError => _e {} end |
#update(code, params) ⇒ Object
code: a2e1M params: Hash: {
token: String(required),
attach: Hash: {
password: String: '1234'
password_note: String: 'today'
expired_num: Integer: 3600
view_count_limit: Integer: 100
}
post: Hash: {
content: String: 'This is post content'
}
}
20 21 22 23 24 25 26 27 |
# File 'lib/hiya/link.rb', line 20 def update(code, params) @response = conn.put("/v1/links/#{code}") do |req| req.body = params.to_json end Oj.load(response.body, symbol_keys: true) rescue StandardError => _e {} end |