Skip to content
This repository has been archived by the owner on Dec 12, 2019. It is now read-only.

Simplify keywords API #41

Merged
merged 3 commits into from
May 2, 2014
Merged

Conversation

jvlcek
Copy link
Member

@jvlcek jvlcek commented Apr 30, 2014

This pull request adds support to simplify the handling of keywords while
also allowing for the use of all of the keyword sub-commands supported by the
xmlrpc API. Although the underlying XMLRPC support for keywords sub-commands
is murky.

By default the user does not have to be concerned that the XMPRPC interface for
modifying keywords requires a sub-command. By default the user can provide an
array of keywords, to match what is returned from a query for keywords.

e.g.:

require "active_bugzilla"
service = ActiveBugzilla::Service.new("https://partner-bugzilla.redhat.com", "cfme-bot@redhat.com", "*********")
ActiveBugzilla::Base.service = service
bug = ActiveBugzilla::Bug.find(:id => [965147]).last
puts "#{bug.keywords}"
=> ["UseCase", "UserExperience", "ZStream"]

bug.keywords.delete("UseCase")
bug.keywords << "Upstream"
bug.update_attributes(:keywords => bug.keywords)

Although the underlying XMLRPC support for keyword sub-commands is murky,
access to it is provided.
e.g.:
bug.update_attributes(:keywords => {"keywords_add" => ["UseCase"]})

@jvlcek jvlcek changed the title This pull request adds support to simplify the hanlding of keywords while also allowing for the use of all of the keyword subcammands supported by the xmlrpc API. Although the underlying XMLRPC support for keywords subcommands is murky, allowin the user access to it will be provided. By default the user does not have to be concerned that the XMPRPC interface for modifying keywords requries a subcommand. By default the user can provide an array of keywords, to match what is returned from a query for keywords. e.g.: require "active_bugzilla" service = ActiveBugzilla::Service.new("https://partner-bugzilla.redhat.com", "cfme-bot@redhat.com", "*********") ActiveBugzilla::Base.service = service bug = ActiveBugzilla::Bug.find(:id => [965147]).last puts "#{bug.keywords}" => ["UseCase", "UserExperience", "ZStream"] bug.keywords.delete("UseCase") bug.keywords << "Upstream" bug.update_attributes(:keywords => bug.keywords) Although the underlying XMLRPC support for keyword subcommands is murky, allowin the user ac Simplify keywords API Apr 30, 2014
@jvlcek
Copy link
Member Author

jvlcek commented Apr 30, 2014

@chessbyte, @abellotti
Please review.

public_send("#{name}=", value)
if symbolized_name == :flags
attributes[name] = flags_raw_updates
else
attributes[name] = keywords_value(value) if symbolized_name == :keywords
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jvlcek I do not understand why we are calling this twice in one method

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chessbyte Me either. ;)

@jvlcek
Copy link
Member Author

jvlcek commented Apr 30, 2014

@chessbyte I do not understand why I'm calling it twice in one method either.
Pushed a change to remove the redundant invocation.

@cfme-bot
Copy link
Member

cfme-bot commented May 1, 2014

Checked commits jvlcek@eb76866 .. jvlcek@91abd8a with rubocop 0.21.0
1 file checked, 0 offenses detected
Everything looks good. 🍪

@jvlcek
Copy link
Member Author

jvlcek commented May 2, 2014

@chessbyte Are you OK with this being merged?

chessbyte added a commit that referenced this pull request May 2, 2014
@chessbyte chessbyte merged commit 7b5930c into ManageIQ:master May 2, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants