Class: Netbout::Tags

Inherits:
Object
  • Object
show all
Defined in:
lib/netbout/tags.rb

Overview

Tags.

Author

Yegor Bugayenko ([email protected])

Copyright

Copyright © 2024 Yegor Bugayenko

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(iri, token, id) ⇒ Tags

Returns a new instance of Tags.



31
32
33
34
35
# File 'lib/netbout/tags.rb', line 31

def initialize(iri, token, id)
  @iri = iri
  @token = token
  @id = id
end

Instance Method Details

#put(key, value) ⇒ Object



41
42
43
44
# File 'lib/netbout/tags.rb', line 41

def put(key, value)
  Netbout::Http.new(@iri.append('/b').append(@id).append('/tag'), @token)
    .post('name' => key, 'value' => value)
end

#to_aObject



37
38
39
# File 'lib/netbout/tags.rb', line 37

def to_a
  JSON.parse(Netbout::Http.new(@iri.append('/tags').append(@id), @token).get.response_body)
end