Class: JIRA::Resource::Createmeta
- Defined in:
- lib/jira/resource/createmeta.rb
Constant Summary
Constants inherited from Base
Base::QUERY_PARAMS_FOR_SEARCH, Base::QUERY_PARAMS_FOR_SINGLE_FETCH
Instance Attribute Summary
Attributes inherited from Base
#attrs, #client, #deleted, #expanded
Class Method Summary collapse
- .all(client, params = {}) ⇒ Object
- .endpoint_name ⇒ Object
- .hash_to_query_string(query_params) ⇒ Object
Methods inherited from Base
belongs_to, belongs_to_relationships, build, collection_attributes_are_nested, collection_path, #collection_path, #delete, #fetch, find, #has_errors?, has_many, has_one, #id, #initialize, key_attribute, #key_value, #method_missing, nested_collections, #new_record?, parse_json, #patched_url, #path_component, #respond_to?, #save, #save!, #set_attrs, #set_attrs_from_response, singular_path, #to_json, #to_s, #to_sym, #url
Constructor Details
This class inherits a constructor from JIRA::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class JIRA::Base
Class Method Details
.all(client, params = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/jira/resource/createmeta.rb', line 12 def self.all(client, params={}) if params.has_key?(:projectKeys) values = Array(params[:projectKeys]).map{|i| (i.is_a?(JIRA::Resource::Project) ? i.key : i)} params[:projectKeys] = values.join(',') end if params.has_key?(:projectIds) values = Array(params[:projectIds]).map{|i| (i.is_a?(JIRA::Resource::Project) ? i.id : i)} params[:projectIds] = values.join(',') end if params.has_key?(:issuetypeNames) values = Array(params[:issuetypeNames]).map{|i| (i.is_a?(JIRA::Resource::Issuetype) ? i.name : i)} params[:issuetypeNames] = values.join(',') end if params.has_key?(:issuetypeIds) values = Array(params[:issuetypeIds]).map{|i| (i.is_a?(JIRA::Resource::Issuetype) ? i.id : i)} params[:issuetypeIds] = values.join(',') end = client.[:rest_base_path] + self.endpoint_name params = hash_to_query_string(params) response = params.empty? ? client.get("#{}") : client.get("#{}?#{params}") json = parse_json(response.body) self.new(client, {:attrs => json['projects']}) end |
.endpoint_name ⇒ Object
8 9 10 |
# File 'lib/jira/resource/createmeta.rb', line 8 def self.endpoint_name '/issue/createmeta' end |
.hash_to_query_string(query_params) ⇒ Object
43 44 45 46 47 |
# File 'lib/jira/resource/createmeta.rb', line 43 def self.hash_to_query_string(query_params) query_params.map do |k,v| CGI.escape(k.to_s) + '=' + CGI.escape(v.to_s) end.join('&') end |