id
int32
0
24.9k
repo
stringlengths
5
58
path
stringlengths
9
168
func_name
stringlengths
9
130
original_string
stringlengths
66
10.5k
language
stringclasses
1 value
code
stringlengths
66
10.5k
code_tokens
list
docstring
stringlengths
8
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
94
266
19,800
benedikt/mongoid-tree
lib/mongoid/tree.rb
Mongoid.Tree.rearrange
def rearrange if self.parent_id self.parent_ids = parent.parent_ids + [self.parent_id] else self.parent_ids = [] end self.depth = parent_ids.size rearrange_children! if self.parent_ids_changed? end
ruby
def rearrange if self.parent_id self.parent_ids = parent.parent_ids + [self.parent_id] else self.parent_ids = [] end self.depth = parent_ids.size rearrange_children! if self.parent_ids_changed? end
[ "def", "rearrange", "if", "self", ".", "parent_id", "self", ".", "parent_ids", "=", "parent", ".", "parent_ids", "+", "[", "self", ".", "parent_id", "]", "else", "self", ".", "parent_ids", "=", "[", "]", "end", "self", ".", "depth", "=", "parent_ids", ...
Updates the parent_ids and marks the children for rearrangement when the parent_ids changed @private @return [undefined]
[ "Updates", "the", "parent_ids", "and", "marks", "the", "children", "for", "rearrangement", "when", "the", "parent_ids", "changed" ]
0970a945a16a1539511f6dd2017e78f1ba54d4bd
https://github.com/benedikt/mongoid-tree/blob/0970a945a16a1539511f6dd2017e78f1ba54d4bd/lib/mongoid/tree.rb#L433-L443
19,801
intercom/cocoapods-mangle
lib/cocoapods_mangle/config.rb
CocoapodsMangle.Config.needs_update?
def needs_update? return true unless File.exist?(@context.xcconfig_path) xcconfig_hash = Xcodeproj::Config.new(File.new(@context.xcconfig_path)).to_hash needs_update = xcconfig_hash[MANGLED_SPECS_CHECKSUM_XCCONFIG_KEY] != @context.specs_checksum Pod::UI.message '- Mangling config already up to d...
ruby
def needs_update? return true unless File.exist?(@context.xcconfig_path) xcconfig_hash = Xcodeproj::Config.new(File.new(@context.xcconfig_path)).to_hash needs_update = xcconfig_hash[MANGLED_SPECS_CHECKSUM_XCCONFIG_KEY] != @context.specs_checksum Pod::UI.message '- Mangling config already up to d...
[ "def", "needs_update?", "return", "true", "unless", "File", ".", "exist?", "(", "@context", ".", "xcconfig_path", ")", "xcconfig_hash", "=", "Xcodeproj", "::", "Config", ".", "new", "(", "File", ".", "new", "(", "@context", ".", "xcconfig_path", ")", ")", ...
Does the mangling xcconfig need to be updated? @return [Truthy] Does the xcconfig need to be updated?
[ "Does", "the", "mangling", "xcconfig", "need", "to", "be", "updated?" ]
aaec3e68b578eb61185aa0895568a9316c24a05c
https://github.com/intercom/cocoapods-mangle/blob/aaec3e68b578eb61185aa0895568a9316c24a05c/lib/cocoapods_mangle/config.rb#L42-L48
19,802
intercom/cocoapods-mangle
lib/cocoapods_mangle/config.rb
CocoapodsMangle.Config.update_pod_xcconfigs_for_mangling!
def update_pod_xcconfigs_for_mangling! Pod::UI.message '- Updating Pod xcconfig files' do @context.pod_xcconfig_paths.each do |pod_xcconfig_path| Pod::UI.message "- Updating '#{File.basename(pod_xcconfig_path)}'" update_pod_xcconfig_for_mangling!(pod_xcconfig_path) end en...
ruby
def update_pod_xcconfigs_for_mangling! Pod::UI.message '- Updating Pod xcconfig files' do @context.pod_xcconfig_paths.each do |pod_xcconfig_path| Pod::UI.message "- Updating '#{File.basename(pod_xcconfig_path)}'" update_pod_xcconfig_for_mangling!(pod_xcconfig_path) end en...
[ "def", "update_pod_xcconfigs_for_mangling!", "Pod", "::", "UI", ".", "message", "'- Updating Pod xcconfig files'", "do", "@context", ".", "pod_xcconfig_paths", ".", "each", "do", "|", "pod_xcconfig_path", "|", "Pod", "::", "UI", ".", "message", "\"- Updating '#{File.bas...
Update all pod xcconfigs to use the mangling defines
[ "Update", "all", "pod", "xcconfigs", "to", "use", "the", "mangling", "defines" ]
aaec3e68b578eb61185aa0895568a9316c24a05c
https://github.com/intercom/cocoapods-mangle/blob/aaec3e68b578eb61185aa0895568a9316c24a05c/lib/cocoapods_mangle/config.rb#L51-L58
19,803
intercom/cocoapods-mangle
lib/cocoapods_mangle/config.rb
CocoapodsMangle.Config.update_pod_xcconfig_for_mangling!
def update_pod_xcconfig_for_mangling!(pod_xcconfig_path) mangle_xcconfig_include = "#include \"#{@context.xcconfig_path}\"\n" gcc_preprocessor_defs = File.readlines(pod_xcconfig_path).select { |line| line =~ /GCC_PREPROCESSOR_DEFINITIONS/ }.first gcc_preprocessor_defs.strip! xcconfig_contents ...
ruby
def update_pod_xcconfig_for_mangling!(pod_xcconfig_path) mangle_xcconfig_include = "#include \"#{@context.xcconfig_path}\"\n" gcc_preprocessor_defs = File.readlines(pod_xcconfig_path).select { |line| line =~ /GCC_PREPROCESSOR_DEFINITIONS/ }.first gcc_preprocessor_defs.strip! xcconfig_contents ...
[ "def", "update_pod_xcconfig_for_mangling!", "(", "pod_xcconfig_path", ")", "mangle_xcconfig_include", "=", "\"#include \\\"#{@context.xcconfig_path}\\\"\\n\"", "gcc_preprocessor_defs", "=", "File", ".", "readlines", "(", "pod_xcconfig_path", ")", ".", "select", "{", "|", "lin...
Update a mangling config to use the mangling defines @param [String] pod_xcconfig_path Path to the pod xcconfig to update
[ "Update", "a", "mangling", "config", "to", "use", "the", "mangling", "defines" ]
aaec3e68b578eb61185aa0895568a9316c24a05c
https://github.com/intercom/cocoapods-mangle/blob/aaec3e68b578eb61185aa0895568a9316c24a05c/lib/cocoapods_mangle/config.rb#L63-L75
19,804
HipByte/motion-cocoapods
lib/motion/project/cocoapods.rb
Motion::Project.CocoaPods.configure_project
def configure_project if (xcconfig = self.pods_xcconfig_hash) && ldflags = xcconfig['OTHER_LDFLAGS'] @config.resources_dirs << resources_dir.to_s frameworks = installed_frameworks[:pre_built] if frameworks @config.embedded_frameworks += frameworks @config.embedded_fram...
ruby
def configure_project if (xcconfig = self.pods_xcconfig_hash) && ldflags = xcconfig['OTHER_LDFLAGS'] @config.resources_dirs << resources_dir.to_s frameworks = installed_frameworks[:pre_built] if frameworks @config.embedded_frameworks += frameworks @config.embedded_fram...
[ "def", "configure_project", "if", "(", "xcconfig", "=", "self", ".", "pods_xcconfig_hash", ")", "&&", "ldflags", "=", "xcconfig", "[", "'OTHER_LDFLAGS'", "]", "@config", ".", "resources_dirs", "<<", "resources_dir", ".", "to_s", "frameworks", "=", "installed_frame...
Adds the Pods project to the RubyMotion config as a vendored project and
[ "Adds", "the", "Pods", "project", "to", "the", "RubyMotion", "config", "as", "a", "vendored", "project", "and" ]
005ffa50fdbe6074c7933e689d709e1a609f2a8a
https://github.com/HipByte/motion-cocoapods/blob/005ffa50fdbe6074c7933e689d709e1a609f2a8a/lib/motion/project/cocoapods.rb#L111-L127
19,805
HipByte/motion-cocoapods
lib/motion/project/cocoapods.rb
Motion::Project.CocoaPods.install!
def install!(update) FileUtils.rm_rf(resources_dir) pods_installer.update = update pods_installer.installation_options.integrate_targets = false pods_installer.install! install_resources copy_cocoapods_env_and_prefix_headers end
ruby
def install!(update) FileUtils.rm_rf(resources_dir) pods_installer.update = update pods_installer.installation_options.integrate_targets = false pods_installer.install! install_resources copy_cocoapods_env_and_prefix_headers end
[ "def", "install!", "(", "update", ")", "FileUtils", ".", "rm_rf", "(", "resources_dir", ")", "pods_installer", ".", "update", "=", "update", "pods_installer", ".", "installation_options", ".", "integrate_targets", "=", "false", "pods_installer", ".", "install!", "...
Performs a CocoaPods Installation. For now we only support one Pods target, this will have to be expanded once we work on more spec support. Let RubyMotion re-generate the BridgeSupport file whenever the list of installed pods changes.
[ "Performs", "a", "CocoaPods", "Installation", "." ]
005ffa50fdbe6074c7933e689d709e1a609f2a8a
https://github.com/HipByte/motion-cocoapods/blob/005ffa50fdbe6074c7933e689d709e1a609f2a8a/lib/motion/project/cocoapods.rb#L236-L244
19,806
HipByte/motion-cocoapods
lib/motion/project/cocoapods.rb
Motion::Project.CocoaPods.resources
def resources resources = [] script = Pathname.new(@config.project_dir) + SUPPORT_FILES + "Pods-#{TARGET_NAME}-resources.sh" return resources unless File.exist?(script) File.open(script) { |f| f.each_line do |line| if matched = line.match(/install_resource\s+(.*)/) ...
ruby
def resources resources = [] script = Pathname.new(@config.project_dir) + SUPPORT_FILES + "Pods-#{TARGET_NAME}-resources.sh" return resources unless File.exist?(script) File.open(script) { |f| f.each_line do |line| if matched = line.match(/install_resource\s+(.*)/) ...
[ "def", "resources", "resources", "=", "[", "]", "script", "=", "Pathname", ".", "new", "(", "@config", ".", "project_dir", ")", "+", "SUPPORT_FILES", "+", "\"Pods-#{TARGET_NAME}-resources.sh\"", "return", "resources", "unless", "File", ".", "exist?", "(", "scrip...
Do not copy `.framework` bundles, these should be handled through RM's `embedded_frameworks` config attribute.
[ "Do", "not", "copy", ".", "framework", "bundles", "these", "should", "be", "handled", "through", "RM", "s", "embedded_frameworks", "config", "attribute", "." ]
005ffa50fdbe6074c7933e689d709e1a609f2a8a
https://github.com/HipByte/motion-cocoapods/blob/005ffa50fdbe6074c7933e689d709e1a609f2a8a/lib/motion/project/cocoapods.rb#L500-L521
19,807
michaeledgar/laser
lib/laser/support/acts_as_struct.rb
Laser.ActsAsStruct.acts_as_struct
def acts_as_struct(*members) include Comparable extend InheritedAttributes class_inheritable_array :current_members unless respond_to?(:current_members) self.current_members ||= [] self.current_members.concat members all_members = self.current_members # Only add new memb...
ruby
def acts_as_struct(*members) include Comparable extend InheritedAttributes class_inheritable_array :current_members unless respond_to?(:current_members) self.current_members ||= [] self.current_members.concat members all_members = self.current_members # Only add new memb...
[ "def", "acts_as_struct", "(", "*", "members", ")", "include", "Comparable", "extend", "InheritedAttributes", "class_inheritable_array", ":current_members", "unless", "respond_to?", "(", ":current_members", ")", "self", ".", "current_members", "||=", "[", "]", "self", ...
Mixes in struct behavior to the current class.
[ "Mixes", "in", "struct", "behavior", "to", "the", "current", "class", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/support/acts_as_struct.rb#L8-L64
19,808
michaeledgar/laser
lib/laser/third_party/rgl/mutable.rb
RGL.MutableGraph.cycles
def cycles g = self.clone self.inject([]) do |acc, v| acc = acc.concat(g.cycles_with_vertex(v)) g.remove_vertex(v); acc end end
ruby
def cycles g = self.clone self.inject([]) do |acc, v| acc = acc.concat(g.cycles_with_vertex(v)) g.remove_vertex(v); acc end end
[ "def", "cycles", "g", "=", "self", ".", "clone", "self", ".", "inject", "(", "[", "]", ")", "do", "|", "acc", ",", "v", "|", "acc", "=", "acc", ".", "concat", "(", "g", ".", "cycles_with_vertex", "(", "v", ")", ")", "g", ".", "remove_vertex", "...
Returns an array of all minimum cycles in a graph This is not an efficient implementation O(n^4) and could be done using Minimum Spanning Trees. Hint. Hint.
[ "Returns", "an", "array", "of", "all", "minimum", "cycles", "in", "a", "graph" ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/third_party/rgl/mutable.rb#L108-L114
19,809
michaeledgar/laser
lib/laser/analysis/sexp_analysis.rb
Laser.Analysis.parse
def parse(body = self.body) return PARSING_CACHE[body] if PARSING_CACHE[body] pairs = Analysis.analyze_inputs([[file, body]]) PARSING_CACHE[body] = pairs[0][1] end
ruby
def parse(body = self.body) return PARSING_CACHE[body] if PARSING_CACHE[body] pairs = Analysis.analyze_inputs([[file, body]]) PARSING_CACHE[body] = pairs[0][1] end
[ "def", "parse", "(", "body", "=", "self", ".", "body", ")", "return", "PARSING_CACHE", "[", "body", "]", "if", "PARSING_CACHE", "[", "body", "]", "pairs", "=", "Analysis", ".", "analyze_inputs", "(", "[", "[", "file", ",", "body", "]", "]", ")", "PAR...
Parses the given text. @param [String] body (self.body) The text to parse @return [Sexp, NilClass] the sexp representing the input text.
[ "Parses", "the", "given", "text", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/analysis/sexp_analysis.rb#L19-L23
19,810
michaeledgar/laser
lib/laser/analysis/sexp_analysis.rb
Laser.Analysis.find_sexps
def find_sexps(type, tree = self.parse(self.body)) result = tree[0] == type ? [tree] : [] tree.each do |node| result.concat find_sexps(type, node) if node.is_a?(Array) end result end
ruby
def find_sexps(type, tree = self.parse(self.body)) result = tree[0] == type ? [tree] : [] tree.each do |node| result.concat find_sexps(type, node) if node.is_a?(Array) end result end
[ "def", "find_sexps", "(", "type", ",", "tree", "=", "self", ".", "parse", "(", "self", ".", "body", ")", ")", "result", "=", "tree", "[", "0", "]", "==", "type", "?", "[", "tree", "]", ":", "[", "]", "tree", ".", "each", "do", "|", "node", "|...
Finds all sexps of the given type in the given Sexp tree. @param [Symbol] type the type of sexp to search for @param [Sexp] tree (self.parse(self.body)) The tree to search in. Leave blank to search the entire body. @return [Array<Sexp>] all sexps in the input tree (or whole body) that are of the given type.
[ "Finds", "all", "sexps", "of", "the", "given", "type", "in", "the", "given", "Sexp", "tree", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/analysis/sexp_analysis.rb#L32-L38
19,811
michaeledgar/laser
lib/laser/third_party/rgl/connected_components.rb
RGL.Graph.strongly_connected_components
def strongly_connected_components raise NotDirectedError, "strong_components only works for directed graphs." unless directed? vis = TarjanSccVisitor.new(self) depth_first_search(vis) { |v| } vis end
ruby
def strongly_connected_components raise NotDirectedError, "strong_components only works for directed graphs." unless directed? vis = TarjanSccVisitor.new(self) depth_first_search(vis) { |v| } vis end
[ "def", "strongly_connected_components", "raise", "NotDirectedError", ",", "\"strong_components only works for directed graphs.\"", "unless", "directed?", "vis", "=", "TarjanSccVisitor", ".", "new", "(", "self", ")", "depth_first_search", "(", "vis", ")", "{", "|", "v", ...
class TarjanSccVisitor This is Tarjan's algorithm for strongly connected components, from his paper "Depth first search and linear graph algorithms". It calculates the components in a single application of DFS. We implement the algorithm with the help of the DFSVisitor TarjanSccVisitor. === Definition A _stro...
[ "class", "TarjanSccVisitor", "This", "is", "Tarjan", "s", "algorithm", "for", "strongly", "connected", "components", "from", "his", "paper", "Depth", "first", "search", "and", "linear", "graph", "algorithms", ".", "It", "calculates", "the", "components", "in", "...
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/third_party/rgl/connected_components.rb#L129-L135
19,812
michaeledgar/laser
lib/laser/third_party/rgl/base.rb
RGL.Graph.each_edge
def each_edge (&block) if directed? each_vertex { |u| each_adjacent(u) { |v| yield u,v } } else each_edge_aux(&block) # concrete graphs should to this better end end
ruby
def each_edge (&block) if directed? each_vertex { |u| each_adjacent(u) { |v| yield u,v } } else each_edge_aux(&block) # concrete graphs should to this better end end
[ "def", "each_edge", "(", "&", "block", ")", "if", "directed?", "each_vertex", "{", "|", "u", "|", "each_adjacent", "(", "u", ")", "{", "|", "v", "|", "yield", "u", ",", "v", "}", "}", "else", "each_edge_aux", "(", "block", ")", "# concrete graphs shoul...
The each_edge iterator should provide efficient access to all edges of the graph. Its defines the EdgeListGraph concept. This method must _not_ be defined by concrete graph classes, because it can be implemented using each_vertex and each_adjacent. However for undirected graph the function is inefficient because w...
[ "The", "each_edge", "iterator", "should", "provide", "efficient", "access", "to", "all", "edges", "of", "the", "graph", ".", "Its", "defines", "the", "EdgeListGraph", "concept", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/third_party/rgl/base.rb#L123-L131
19,813
michaeledgar/laser
lib/laser/runner.rb
Laser.Runner.handle_global_options
def handle_global_options(settings) if settings[:"line-length"] @using << Laser.LineLengthWarning(settings[:"line-length"]) end if (only_name = settings[:only]) @fix = @using = Warning.concrete_warnings.select do |w| classname = w.name && w.name.split('::').last (cl...
ruby
def handle_global_options(settings) if settings[:"line-length"] @using << Laser.LineLengthWarning(settings[:"line-length"]) end if (only_name = settings[:only]) @fix = @using = Warning.concrete_warnings.select do |w| classname = w.name && w.name.split('::').last (cl...
[ "def", "handle_global_options", "(", "settings", ")", "if", "settings", "[", ":\"", "\"", "]", "@using", "<<", "Laser", ".", "LineLengthWarning", "(", "settings", "[", ":\"", "\"", "]", ")", "end", "if", "(", "only_name", "=", "settings", "[", ":only", "...
Processes the global options, which includes picking which warnings to run against the source code. The settings provided determine what modifies the runner's settings. @param [Hash] settings the settings from the command-line to process. @option settings :only (String) a list of warning names or short names th...
[ "Processes", "the", "global", "options", "which", "includes", "picking", "which", "warnings", "to", "run", "against", "the", "source", "code", ".", "The", "settings", "provided", "determine", "what", "modifies", "the", "runner", "s", "settings", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/runner.rb#L42-L61
19,814
michaeledgar/laser
lib/laser/runner.rb
Laser.Runner.get_settings
def get_settings warning_opts = get_warning_options Trollop::options do banner 'LASER: Lexically- and Semantically-Enriched Ruby' opt :fix, 'Should errors be fixed in-line?', short: '-f' opt :display, 'Should errors be displayed?', short: '-b', default: true opt :'report-fixe...
ruby
def get_settings warning_opts = get_warning_options Trollop::options do banner 'LASER: Lexically- and Semantically-Enriched Ruby' opt :fix, 'Should errors be fixed in-line?', short: '-f' opt :display, 'Should errors be displayed?', short: '-b', default: true opt :'report-fixe...
[ "def", "get_settings", "warning_opts", "=", "get_warning_options", "Trollop", "::", "options", "do", "banner", "'LASER: Lexically- and Semantically-Enriched Ruby'", "opt", ":fix", ",", "'Should errors be fixed in-line?'", ",", "short", ":", "'-f'", "opt", ":display", ",", ...
Parses the command-line options using Trollop @return [Hash{Symbol => Object}] the settings entered by the user
[ "Parses", "the", "command", "-", "line", "options", "using", "Trollop" ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/runner.rb#L66-L82
19,815
michaeledgar/laser
lib/laser/runner.rb
Laser.Runner.get_warning_options
def get_warning_options all_options = Warning.all_warnings.inject({}) do |result, warning| options = warning.options options = [options] if options.any? && !options[0].is_a?(Array) options.each do |option| result[option.first] = option end result end a...
ruby
def get_warning_options all_options = Warning.all_warnings.inject({}) do |result, warning| options = warning.options options = [options] if options.any? && !options[0].is_a?(Array) options.each do |option| result[option.first] = option end result end a...
[ "def", "get_warning_options", "all_options", "=", "Warning", ".", "all_warnings", ".", "inject", "(", "{", "}", ")", "do", "|", "result", ",", "warning", "|", "options", "=", "warning", ".", "options", "options", "=", "[", "options", "]", "if", "options", ...
Gets all the options from the warning plugins and collects them with overriding rules. The later the declaration is run, the higher the priority the option has.
[ "Gets", "all", "the", "options", "from", "the", "warning", "plugins", "and", "collects", "them", "with", "overriding", "rules", ".", "The", "later", "the", "declaration", "is", "run", "the", "higher", "the", "priority", "the", "option", "has", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/runner.rb#L87-L97
19,816
michaeledgar/laser
lib/laser/runner.rb
Laser.Runner.print_modules
def print_modules Analysis::LaserModule.all_modules.map do |mod| result = [] result << if Analysis::LaserClass === mod && mod.superclass then "#{mod.path} < #{mod.superclass.path}" else mod.name end result end.sort.flatten.each { ...
ruby
def print_modules Analysis::LaserModule.all_modules.map do |mod| result = [] result << if Analysis::LaserClass === mod && mod.superclass then "#{mod.path} < #{mod.superclass.path}" else mod.name end result end.sort.flatten.each { ...
[ "def", "print_modules", "Analysis", "::", "LaserModule", ".", "all_modules", ".", "map", "do", "|", "mod", "|", "result", "=", "[", "]", "result", "<<", "if", "Analysis", "::", "LaserClass", "===", "mod", "&&", "mod", ".", "superclass", "then", "\"#{mod.pa...
Prints the known modules after analysis.
[ "Prints", "the", "known", "modules", "after", "analysis", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/runner.rb#L100-L109
19,817
michaeledgar/laser
lib/laser/runner.rb
Laser.Runner.convert_warning_list
def convert_warning_list(list) list.map do |list| case list when :all then Warning.all_warnings when :whitespace [ExtraBlankLinesWarning, ExtraWhitespaceWarning, OperatorSpacing, MisalignedUnindentationWarning] else list end end.flatten end
ruby
def convert_warning_list(list) list.map do |list| case list when :all then Warning.all_warnings when :whitespace [ExtraBlankLinesWarning, ExtraWhitespaceWarning, OperatorSpacing, MisalignedUnindentationWarning] else list end end.flatten end
[ "def", "convert_warning_list", "(", "list", ")", "list", ".", "map", "do", "|", "list", "|", "case", "list", "when", ":all", "then", "Warning", ".", "all_warnings", "when", ":whitespace", "[", "ExtraBlankLinesWarning", ",", "ExtraWhitespaceWarning", ",", "Operat...
Converts a list of warnings and symbol shortcuts for warnings to just a list of warnings.
[ "Converts", "a", "list", "of", "warnings", "and", "symbol", "shortcuts", "for", "warnings", "to", "just", "a", "list", "of", "warnings", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/runner.rb#L120-L130
19,818
michaeledgar/laser
lib/laser/runner.rb
Laser.Runner.collect_warnings
def collect_warnings(files, scanner) full_list = files.map do |file| data = file == '(stdin)' ? STDIN.read : File.read(file) if scanner.settings[:fix] scanner.settings[:output_file] = scanner.settings[:stdin] ? STDOUT : File.open(file, 'w') end results = scanner.scan(data...
ruby
def collect_warnings(files, scanner) full_list = files.map do |file| data = file == '(stdin)' ? STDIN.read : File.read(file) if scanner.settings[:fix] scanner.settings[:output_file] = scanner.settings[:stdin] ? STDOUT : File.open(file, 'w') end results = scanner.scan(data...
[ "def", "collect_warnings", "(", "files", ",", "scanner", ")", "full_list", "=", "files", ".", "map", "do", "|", "file", "|", "data", "=", "file", "==", "'(stdin)'", "?", "STDIN", ".", "read", ":", "File", ".", "read", "(", "file", ")", "if", "scanner...
Collects warnings from all the provided files by running them through the scanner. @param [Array<String>] files the files to scan. If (stdin) is in the array, then data will be read from STDIN until EOF is reached. @param [Scanner] scanner the scanner that will look for warnings in the source text. @return [...
[ "Collects", "warnings", "from", "all", "the", "provided", "files", "by", "running", "them", "through", "the", "scanner", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/runner.rb#L160-L173
19,819
michaeledgar/laser
lib/laser/runner.rb
Laser.Runner.display_warnings
def display_warnings(warnings, settings) num_fixable = warnings.select { |warn| warn.fixable? }.size num_total = warnings.size results = "#{num_total} warnings found. #{num_fixable} are fixable." puts results puts '=' * results.size warnings.each do |warning| puts "#{warnin...
ruby
def display_warnings(warnings, settings) num_fixable = warnings.select { |warn| warn.fixable? }.size num_total = warnings.size results = "#{num_total} warnings found. #{num_fixable} are fixable." puts results puts '=' * results.size warnings.each do |warning| puts "#{warnin...
[ "def", "display_warnings", "(", "warnings", ",", "settings", ")", "num_fixable", "=", "warnings", ".", "select", "{", "|", "warn", "|", "warn", ".", "fixable?", "}", ".", "size", "num_total", "=", "warnings", ".", "size", "results", "=", "\"#{num_total} warn...
Displays warnings using user-provided settings. @param [Array<Warning>] warnings the warnings generated by the input files, ordered by file @param [Hash{Symbol => Object}] settings the user-set display settings
[ "Displays", "warnings", "using", "user", "-", "provided", "settings", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/runner.rb#L180-L192
19,820
michaeledgar/laser
lib/laser/third_party/rgl/traversal.rb
RGL.GraphVisitor.attach_distance_map
def attach_distance_map (map = Hash.new(0)) @dist_map = map class << self def handle_tree_edge (u, v) super @dist_map[v] = @dist_map[u] + 1 end # Answer the distance to the start vertex. def distance_to_root (v) @dist_map[v] end ...
ruby
def attach_distance_map (map = Hash.new(0)) @dist_map = map class << self def handle_tree_edge (u, v) super @dist_map[v] = @dist_map[u] + 1 end # Answer the distance to the start vertex. def distance_to_root (v) @dist_map[v] end ...
[ "def", "attach_distance_map", "(", "map", "=", "Hash", ".", "new", "(", "0", ")", ")", "@dist_map", "=", "map", "class", "<<", "self", "def", "handle_tree_edge", "(", "u", ",", "v", ")", "super", "@dist_map", "[", "v", "]", "=", "@dist_map", "[", "u"...
Attach a map to the visitor which records the distance of a visited vertex to the start vertex. This is similar to BGLs distance_recorder[http://www.boost.org/libs/graph/doc/distance_recorder.html]. After the distance_map is attached, the visitor has a new method distance_to_root, which answers the distance to t...
[ "Attach", "a", "map", "to", "the", "visitor", "which", "records", "the", "distance", "of", "a", "visited", "vertex", "to", "the", "start", "vertex", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/third_party/rgl/traversal.rb#L99-L116
19,821
michaeledgar/laser
lib/laser/third_party/rgl/traversal.rb
RGL.Graph.bfs_search_tree_from
def bfs_search_tree_from (v) require 'laser/third_party/rgl/adjacency' bfs = bfs_iterator(v) tree = DirectedAdjacencyGraph.new bfs.set_tree_edge_event_handler { |from, to| tree.add_edge(from, to) } bfs.set_to_end # does the search tree end
ruby
def bfs_search_tree_from (v) require 'laser/third_party/rgl/adjacency' bfs = bfs_iterator(v) tree = DirectedAdjacencyGraph.new bfs.set_tree_edge_event_handler { |from, to| tree.add_edge(from, to) } bfs.set_to_end # does the search tree end
[ "def", "bfs_search_tree_from", "(", "v", ")", "require", "'laser/third_party/rgl/adjacency'", "bfs", "=", "bfs_iterator", "(", "v", ")", "tree", "=", "DirectedAdjacencyGraph", ".", "new", "bfs", ".", "set_tree_edge_event_handler", "{", "|", "from", ",", "to", "|",...
Returns a DirectedAdjacencyGraph, which represents a BFS search tree starting at _v_. This method uses the tree_edge_event of BFSIterator to record all tree edges of the search tree in the result.
[ "Returns", "a", "DirectedAdjacencyGraph", "which", "represents", "a", "BFS", "search", "tree", "starting", "at", "_v_", ".", "This", "method", "uses", "the", "tree_edge_event", "of", "BFSIterator", "to", "record", "all", "tree", "edges", "of", "the", "search", ...
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/third_party/rgl/traversal.rb#L237-L246
19,822
michaeledgar/laser
lib/laser/third_party/rgl/traversal.rb
RGL.Graph.depth_first_search
def depth_first_search (vis = DFSVisitor.new(self), &b) each_vertex do |u| unless vis.finished_vertex?(u) vis.handle_start_vertex(u) depth_first_visit(u, vis, &b) end end end
ruby
def depth_first_search (vis = DFSVisitor.new(self), &b) each_vertex do |u| unless vis.finished_vertex?(u) vis.handle_start_vertex(u) depth_first_visit(u, vis, &b) end end end
[ "def", "depth_first_search", "(", "vis", "=", "DFSVisitor", ".", "new", "(", "self", ")", ",", "&", "b", ")", "each_vertex", "do", "|", "u", "|", "unless", "vis", ".", "finished_vertex?", "(", "u", ")", "vis", ".", "handle_start_vertex", "(", "u", ")",...
Do a recursive DFS search on the whole graph. If a block is passed, it is called on each _finish_vertex_ event. See strongly_connected_components for an example usage.
[ "Do", "a", "recursive", "DFS", "search", "on", "the", "whole", "graph", ".", "If", "a", "block", "is", "passed", "it", "is", "called", "on", "each", "_finish_vertex_", "event", ".", "See", "strongly_connected_components", "for", "an", "example", "usage", "."...
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/third_party/rgl/traversal.rb#L299-L306
19,823
michaeledgar/laser
lib/laser/third_party/rgl/traversal.rb
RGL.Graph.depth_first_visit
def depth_first_visit (u, vis = DFSVisitor.new(self), &b) vis.color_map[u] = :GRAY vis.handle_examine_vertex(u) each_adjacent(u) { |v| vis.handle_examine_edge(u, v) if vis.follow_edge?(u, v) # (u,v) is a tree edge vis.handle_tree_edge(u, v) # also discovers...
ruby
def depth_first_visit (u, vis = DFSVisitor.new(self), &b) vis.color_map[u] = :GRAY vis.handle_examine_vertex(u) each_adjacent(u) { |v| vis.handle_examine_edge(u, v) if vis.follow_edge?(u, v) # (u,v) is a tree edge vis.handle_tree_edge(u, v) # also discovers...
[ "def", "depth_first_visit", "(", "u", ",", "vis", "=", "DFSVisitor", ".", "new", "(", "self", ")", ",", "&", "b", ")", "vis", ".", "color_map", "[", "u", "]", "=", ":GRAY", "vis", ".", "handle_examine_vertex", "(", "u", ")", "each_adjacent", "(", "u"...
Start a depth first search at vertex _u_. The block _b_ is called on each finish_vertex event.
[ "Start", "a", "depth", "first", "search", "at", "vertex", "_u_", ".", "The", "block", "_b_", "is", "called", "on", "each", "finish_vertex", "event", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/third_party/rgl/traversal.rb#L311-L331
19,824
michaeledgar/laser
lib/laser/scanner.rb
Laser.Scanner.scan
def scan(text, filename='(none)') warnings = scan_for_file_warnings(text, filename) text = filter_fixable(warnings).inject(text) do |text, warning| warning.fix(text) end with_fixing_piped_to_output do text.split(/\n/).each_with_index do |line, number| warnings.concat pr...
ruby
def scan(text, filename='(none)') warnings = scan_for_file_warnings(text, filename) text = filter_fixable(warnings).inject(text) do |text, warning| warning.fix(text) end with_fixing_piped_to_output do text.split(/\n/).each_with_index do |line, number| warnings.concat pr...
[ "def", "scan", "(", "text", ",", "filename", "=", "'(none)'", ")", "warnings", "=", "scan_for_file_warnings", "(", "text", ",", "filename", ")", "text", "=", "filter_fixable", "(", "warnings", ")", ".", "inject", "(", "text", ")", "do", "|", "text", ",",...
Scans the text for warnings. @param [String] text the input ruby file to scan @return [Array[Laser::Warnings]] the warnings generated by the code. If the code is clean, an empty array is returned.
[ "Scans", "the", "text", "for", "warnings", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/scanner.rb#L45-L57
19,825
michaeledgar/laser
lib/laser/scanner.rb
Laser.Scanner.process_line
def process_line(line, line_number, filename) warnings = all_warnings_for_line(line, line_number, filename) fix_input(warnings, line, line_number, filename) if @settings[:fix] warnings end
ruby
def process_line(line, line_number, filename) warnings = all_warnings_for_line(line, line_number, filename) fix_input(warnings, line, line_number, filename) if @settings[:fix] warnings end
[ "def", "process_line", "(", "line", ",", "line_number", ",", "filename", ")", "warnings", "=", "all_warnings_for_line", "(", "line", ",", "line_number", ",", "filename", ")", "fix_input", "(", "warnings", ",", "line", ",", "line_number", ",", "filename", ")", ...
Finds all matching warnings, and if the user wishes, fix a subset of them.
[ "Finds", "all", "matching", "warnings", "and", "if", "the", "user", "wishes", "fix", "a", "subset", "of", "them", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/scanner.rb#L68-L72
19,826
michaeledgar/laser
lib/laser/scanner.rb
Laser.Scanner.fix_input
def fix_input(warnings, line, line_number, filename) fixable_warnings = filter_fixable warnings if fixable_warnings.size == 1 self.settings[:output_lines] << fixable_warnings.first.fix rescue line elsif fixable_warnings.size > 1 new_text = fixable_warnings.first.fix rescue line ...
ruby
def fix_input(warnings, line, line_number, filename) fixable_warnings = filter_fixable warnings if fixable_warnings.size == 1 self.settings[:output_lines] << fixable_warnings.first.fix rescue line elsif fixable_warnings.size > 1 new_text = fixable_warnings.first.fix rescue line ...
[ "def", "fix_input", "(", "warnings", ",", "line", ",", "line_number", ",", "filename", ")", "fixable_warnings", "=", "filter_fixable", "warnings", "if", "fixable_warnings", ".", "size", "==", "1", "self", ".", "settings", "[", ":output_lines", "]", "<<", "fixa...
Tries to fix the given line with a set of matching warnings for that line. May recurse if there are multiple warnings on the same line.
[ "Tries", "to", "fix", "the", "given", "line", "with", "a", "set", "of", "matching", "warnings", "for", "that", "line", ".", "May", "recurse", "if", "there", "are", "multiple", "warnings", "on", "the", "same", "line", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/scanner.rb#L76-L86
19,827
michaeledgar/laser
lib/laser/scanner.rb
Laser.Scanner.all_warnings_for_line
def all_warnings_for_line(line, line_number, filename) new_warnings = check_for_indent_warnings!(line, filename) new_warnings.concat scan_for_line_warnings(line, filename) new_warnings.each {|warning| warning.line_number = line_number} end
ruby
def all_warnings_for_line(line, line_number, filename) new_warnings = check_for_indent_warnings!(line, filename) new_warnings.concat scan_for_line_warnings(line, filename) new_warnings.each {|warning| warning.line_number = line_number} end
[ "def", "all_warnings_for_line", "(", "line", ",", "line_number", ",", "filename", ")", "new_warnings", "=", "check_for_indent_warnings!", "(", "line", ",", "filename", ")", "new_warnings", ".", "concat", "scan_for_line_warnings", "(", "line", ",", "filename", ")", ...
Returns all warnings that match the line
[ "Returns", "all", "warnings", "that", "match", "the", "line" ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/scanner.rb#L89-L93
19,828
michaeledgar/laser
lib/laser/scanner.rb
Laser.Scanner.check_for_indent_warnings!
def check_for_indent_warnings!(line, filename) return [] if line == "" indent_size = get_indent_size line if indent_size > current_indent self.indent_stack.push indent_size elsif indent_size < current_indent previous = self.indent_stack.pop if indent_size != current_inden...
ruby
def check_for_indent_warnings!(line, filename) return [] if line == "" indent_size = get_indent_size line if indent_size > current_indent self.indent_stack.push indent_size elsif indent_size < current_indent previous = self.indent_stack.pop if indent_size != current_inden...
[ "def", "check_for_indent_warnings!", "(", "line", ",", "filename", ")", "return", "[", "]", "if", "line", "==", "\"\"", "indent_size", "=", "get_indent_size", "line", "if", "indent_size", ">", "current_indent", "self", ".", "indent_stack", ".", "push", "indent_s...
Checks for new warnings based on indentation.
[ "Checks", "for", "new", "warnings", "based", "on", "indentation", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/scanner.rb#L101-L115
19,829
michaeledgar/laser
lib/laser/scanner.rb
Laser.Scanner.scan_for_line_warnings
def scan_for_line_warnings(line, filename) warnings = scan_for_warnings(using & LineWarning.all_warnings, line, filename) filtered_warnings_from_line(line, warnings) end
ruby
def scan_for_line_warnings(line, filename) warnings = scan_for_warnings(using & LineWarning.all_warnings, line, filename) filtered_warnings_from_line(line, warnings) end
[ "def", "scan_for_line_warnings", "(", "line", ",", "filename", ")", "warnings", "=", "scan_for_warnings", "(", "using", "&", "LineWarning", ".", "all_warnings", ",", "line", ",", "filename", ")", "filtered_warnings_from_line", "(", "line", ",", "warnings", ")", ...
Goes through all line warning subclasses and checks if we got some new warnings for a given line
[ "Goes", "through", "all", "line", "warning", "subclasses", "and", "checks", "if", "we", "got", "some", "new", "warnings", "for", "a", "given", "line" ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/scanner.rb#L147-L150
19,830
michaeledgar/laser
lib/laser/analysis/lexical_analysis.rb
Laser.LexicalAnalysis.lex
def lex(body = self.body, token_class = Token) return [] if body =~ /^#.*encoding.*/ Ripper.lex(body).map {|token| token_class.new(token) } end
ruby
def lex(body = self.body, token_class = Token) return [] if body =~ /^#.*encoding.*/ Ripper.lex(body).map {|token| token_class.new(token) } end
[ "def", "lex", "(", "body", "=", "self", ".", "body", ",", "token_class", "=", "Token", ")", "return", "[", "]", "if", "body", "=~", "/", "/", "Ripper", ".", "lex", "(", "body", ")", ".", "map", "{", "|", "token", "|", "token_class", ".", "new", ...
Lexes the given text. @param [String] body (self.body) The text to lex @return [Array<Array<Integer, Integer>, Symbol, String>] A set of tokens in Ripper's result format. Each token is an array of the form: [[1, token_position], token_type, token_text]. I'm not exactly clear on why the 1 is always there. At...
[ "Lexes", "the", "given", "text", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/analysis/lexical_analysis.rb#L31-L34
19,831
michaeledgar/laser
lib/laser/analysis/lexical_analysis.rb
Laser.LexicalAnalysis.find_token
def find_token(*args) body, list = _extract_token_search_args(args) # grr match comment with encoding in it lexed = lex(body) lexed.find.with_index do |tok, idx| is_token = list.include?(tok.type) is_not_symbol = idx == 0 || lexed[idx-1].type != :on_symbeg is_token && is_...
ruby
def find_token(*args) body, list = _extract_token_search_args(args) # grr match comment with encoding in it lexed = lex(body) lexed.find.with_index do |tok, idx| is_token = list.include?(tok.type) is_not_symbol = idx == 0 || lexed[idx-1].type != :on_symbeg is_token && is_...
[ "def", "find_token", "(", "*", "args", ")", "body", ",", "list", "=", "_extract_token_search_args", "(", "args", ")", "# grr match comment with encoding in it", "lexed", "=", "lex", "(", "body", ")", "lexed", ".", "find", ".", "with_index", "do", "|", "tok", ...
Finds the first instance of a set of tokens in the body. If no text is given to scan, then the full content is scanned. @param [String] body (self.body) The first parameter is optional: the text to search. This defaults to the full text. @param [Symbol] token The rest of the arguments are tokens to search for...
[ "Finds", "the", "first", "instance", "of", "a", "set", "of", "tokens", "in", "the", "body", ".", "If", "no", "text", "is", "given", "to", "scan", "then", "the", "full", "content", "is", "scanned", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/analysis/lexical_analysis.rb#L114-L123
19,832
michaeledgar/laser
lib/laser/analysis/lexical_analysis.rb
Laser.LexicalAnalysis.split_on_keyword
def split_on_keyword(*args) body, keywords = _extract_token_search_args(args) token = find_keyword(body, *keywords) return _split_body_with_raw_token(body, token) end
ruby
def split_on_keyword(*args) body, keywords = _extract_token_search_args(args) token = find_keyword(body, *keywords) return _split_body_with_raw_token(body, token) end
[ "def", "split_on_keyword", "(", "*", "args", ")", "body", ",", "keywords", "=", "_extract_token_search_args", "(", "args", ")", "token", "=", "find_keyword", "(", "body", ",", "keywords", ")", "return", "_split_body_with_raw_token", "(", "body", ",", "token", ...
Splits the body into two halfs based on the first appearance of a keyword. @example split_on_keyword('x = 5 unless y == 2', :unless) # => ['x = 5 ', 'unless y == 2'] @param [String] body (self.body) The first parameter is optional: the text to search. This defaults to the full text. @param [Symbol] token T...
[ "Splits", "the", "body", "into", "two", "halfs", "based", "on", "the", "first", "appearance", "of", "a", "keyword", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/analysis/lexical_analysis.rb#L135-L139
19,833
michaeledgar/laser
lib/laser/analysis/lexical_analysis.rb
Laser.LexicalAnalysis.split_on_token
def split_on_token(*args) body, tokens = _extract_token_search_args(args) token = find_token(body, *tokens) return _split_body_with_raw_token(body, token) end
ruby
def split_on_token(*args) body, tokens = _extract_token_search_args(args) token = find_token(body, *tokens) return _split_body_with_raw_token(body, token) end
[ "def", "split_on_token", "(", "*", "args", ")", "body", ",", "tokens", "=", "_extract_token_search_args", "(", "args", ")", "token", "=", "find_token", "(", "body", ",", "tokens", ")", "return", "_split_body_with_raw_token", "(", "body", ",", "token", ")", "...
Splits the body into two halfs based on the first appearance of a token. @example split_on_token('x = 5 unless y == 2', :on_kw) # => ['x = 5 ', 'unless y == 2'] @param [String] body (self.body) The first parameter is optional: the text to search. This defaults to the full text. @param [Symbol] token The re...
[ "Splits", "the", "body", "into", "two", "halfs", "based", "on", "the", "first", "appearance", "of", "a", "token", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/analysis/lexical_analysis.rb#L151-L155
19,834
michaeledgar/laser
lib/laser/third_party/rgl/adjacency.rb
RGL.Graph.to_adjacency
def to_adjacency result = (directed? ? DirectedAdjacencyGraph : AdjacencyGraph).new each_vertex { |v| result.add_vertex(v) } each_edge { |u,v| result.add_edge(u, v) } result end
ruby
def to_adjacency result = (directed? ? DirectedAdjacencyGraph : AdjacencyGraph).new each_vertex { |v| result.add_vertex(v) } each_edge { |u,v| result.add_edge(u, v) } result end
[ "def", "to_adjacency", "result", "=", "(", "directed?", "?", "DirectedAdjacencyGraph", ":", "AdjacencyGraph", ")", ".", "new", "each_vertex", "{", "|", "v", "|", "result", ".", "add_vertex", "(", "v", ")", "}", "each_edge", "{", "|", "u", ",", "v", "|", ...
Convert a general graph to an AdjacencyGraph. If the graph is directed, returns a DirectedAdjacencyGraph; otherwise, returns an AdjacencyGraph.
[ "Convert", "a", "general", "graph", "to", "an", "AdjacencyGraph", ".", "If", "the", "graph", "is", "directed", "returns", "a", "DirectedAdjacencyGraph", ";", "otherwise", "returns", "an", "AdjacencyGraph", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/third_party/rgl/adjacency.rb#L189-L194
19,835
michaeledgar/laser
lib/laser/third_party/rgl/adjacency.rb
RGL.DirectedAdjacencyGraph.initialize_copy
def initialize_copy(orig) @vertex_dict = orig.instance_eval{@vertex_dict}.dup @vertex_dict.keys.each do |v| @vertex_dict[v] = @vertex_dict[v].dup end @predecessor_dict = orig.instance_eval{@predecessor_dict}.dup @predecessor_dict.keys.each do |v| @predecessor_dict[v] = @pre...
ruby
def initialize_copy(orig) @vertex_dict = orig.instance_eval{@vertex_dict}.dup @vertex_dict.keys.each do |v| @vertex_dict[v] = @vertex_dict[v].dup end @predecessor_dict = orig.instance_eval{@predecessor_dict}.dup @predecessor_dict.keys.each do |v| @predecessor_dict[v] = @pre...
[ "def", "initialize_copy", "(", "orig", ")", "@vertex_dict", "=", "orig", ".", "instance_eval", "{", "@vertex_dict", "}", ".", "dup", "@vertex_dict", ".", "keys", ".", "each", "do", "|", "v", "|", "@vertex_dict", "[", "v", "]", "=", "@vertex_dict", "[", "...
Returns a new empty DirectedAdjacencyGraph which has as its edgelist class the given class. The default edgelist class is Set, to ensure set semantics for edges and vertices. If other graphs are passed as parameters their vertices and edges are added to the new graph. Copy internal vertice_dict
[ "Returns", "a", "new", "empty", "DirectedAdjacencyGraph", "which", "has", "as", "its", "edgelist", "class", "the", "given", "class", ".", "The", "default", "edgelist", "class", "is", "Set", "to", "ensure", "set", "semantics", "for", "edges", "and", "vertices",...
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/third_party/rgl/adjacency.rb#L49-L58
19,836
michaeledgar/laser
lib/laser/third_party/rgl/adjacency.rb
RGL.DirectedAdjacencyGraph.edgelist_class=
def edgelist_class=(klass) @vertex_dict.keys.each do |v| @vertex_dict[v] = klass.new @vertex_dict[v].to_a end @predecessor_dict.keys.each do |v| @predecessor_dict[v] = klass.new @predecessor_dict[v].to_a end end
ruby
def edgelist_class=(klass) @vertex_dict.keys.each do |v| @vertex_dict[v] = klass.new @vertex_dict[v].to_a end @predecessor_dict.keys.each do |v| @predecessor_dict[v] = klass.new @predecessor_dict[v].to_a end end
[ "def", "edgelist_class", "=", "(", "klass", ")", "@vertex_dict", ".", "keys", ".", "each", "do", "|", "v", "|", "@vertex_dict", "[", "v", "]", "=", "klass", ".", "new", "@vertex_dict", "[", "v", "]", ".", "to_a", "end", "@predecessor_dict", ".", "keys"...
Converts the adjacency list of each vertex to be of type _klass_. The class is expected to have a new contructor which accepts an enumerable as parameter.
[ "Converts", "the", "adjacency", "list", "of", "each", "vertex", "to", "be", "of", "type", "_klass_", ".", "The", "class", "is", "expected", "to", "have", "a", "new", "contructor", "which", "accepts", "an", "enumerable", "as", "parameter", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/third_party/rgl/adjacency.rb#L140-L147
19,837
michaeledgar/laser
lib/laser/support/module_extensions.rb
Laser.ModuleExtensions.opposite_method
def opposite_method(new_name, old_name) define_method new_name do |*args, &blk| !send(old_name, *args, &blk) end end
ruby
def opposite_method(new_name, old_name) define_method new_name do |*args, &blk| !send(old_name, *args, &blk) end end
[ "def", "opposite_method", "(", "new_name", ",", "old_name", ")", "define_method", "new_name", "do", "|", "*", "args", ",", "&", "blk", "|", "!", "send", "(", "old_name", ",", "args", ",", "blk", ")", "end", "end" ]
Creates a new method that returns the boolean negation of the specified method.
[ "Creates", "a", "new", "method", "that", "returns", "the", "boolean", "negation", "of", "the", "specified", "method", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/support/module_extensions.rb#L9-L13
19,838
michaeledgar/laser
lib/laser/support/module_extensions.rb
Laser.ModuleExtensions.attr_accessor_with_default
def attr_accessor_with_default(name, val) ivar_sym = "@#{name}" define_method name do unless instance_variable_defined?(ivar_sym) instance_variable_set(ivar_sym, val) end instance_variable_get ivar_sym end attr_writer name end
ruby
def attr_accessor_with_default(name, val) ivar_sym = "@#{name}" define_method name do unless instance_variable_defined?(ivar_sym) instance_variable_set(ivar_sym, val) end instance_variable_get ivar_sym end attr_writer name end
[ "def", "attr_accessor_with_default", "(", "name", ",", "val", ")", "ivar_sym", "=", "\"@#{name}\"", "define_method", "name", "do", "unless", "instance_variable_defined?", "(", "ivar_sym", ")", "instance_variable_set", "(", "ivar_sym", ",", "val", ")", "end", "instan...
Creates an attr_accessor that defaults to a certain value.
[ "Creates", "an", "attr_accessor", "that", "defaults", "to", "a", "certain", "value", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/support/module_extensions.rb#L16-L25
19,839
michaeledgar/laser
lib/laser/support/module_extensions.rb
Laser.ModuleExtensions.cattr_get_and_setter
def cattr_get_and_setter(*attrs) attrs.each do |attr| cattr_accessor attr singleton_class.instance_eval do alias_method "#{attr}_old_get".to_sym, attr define_method attr do |*args, &blk| if args.size > 0 send("#{attr}=", *args) elsif blk !=...
ruby
def cattr_get_and_setter(*attrs) attrs.each do |attr| cattr_accessor attr singleton_class.instance_eval do alias_method "#{attr}_old_get".to_sym, attr define_method attr do |*args, &blk| if args.size > 0 send("#{attr}=", *args) elsif blk !=...
[ "def", "cattr_get_and_setter", "(", "*", "attrs", ")", "attrs", ".", "each", "do", "|", "attr", "|", "cattr_accessor", "attr", "singleton_class", ".", "instance_eval", "do", "alias_method", "\"#{attr}_old_get\"", ".", "to_sym", ",", "attr", "define_method", "attr"...
Creates a DSL-friendly set-and-getter method. The method, when called with no arguments, acts as a getter. When called with arguments, it acts as a setter. Uses class instance variables - this is not for generating instance methods. @example class A cattr_get_and_setter :type end class B < A typ...
[ "Creates", "a", "DSL", "-", "friendly", "set", "-", "and", "-", "getter", "method", ".", "The", "method", "when", "called", "with", "no", "arguments", "acts", "as", "a", "getter", ".", "When", "called", "with", "arguments", "it", "acts", "as", "a", "se...
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/support/module_extensions.rb#L76-L92
19,840
michaeledgar/laser
lib/laser/third_party/rgl/dominators.rb
RGL.Graph.dominance_frontier
def dominance_frontier(start_node = self.enter, dom_tree) vertices.inject(Hash.new { |h, k| h[k] = Set.new }) do |result, b| preds = b.real_predecessors if preds.size >= 2 preds.each do |p| b_dominator = dom_tree[b].successors.first break unless b_dominator ...
ruby
def dominance_frontier(start_node = self.enter, dom_tree) vertices.inject(Hash.new { |h, k| h[k] = Set.new }) do |result, b| preds = b.real_predecessors if preds.size >= 2 preds.each do |p| b_dominator = dom_tree[b].successors.first break unless b_dominator ...
[ "def", "dominance_frontier", "(", "start_node", "=", "self", ".", "enter", ",", "dom_tree", ")", "vertices", ".", "inject", "(", "Hash", ".", "new", "{", "|", "h", ",", "k", "|", "h", "[", "k", "]", "=", "Set", ".", "new", "}", ")", "do", "|", ...
Returns the dominance frontier of the graph. If the start node is not provided, it is assumed the receiver is a ControlFlowGraph and has an #enter method. return: Node => Set<Node>
[ "Returns", "the", "dominance", "frontier", "of", "the", "graph", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/third_party/rgl/dominators.rb#L55-L71
19,841
michaeledgar/laser
lib/laser/third_party/rgl/dominators.rb
RGL.Graph.dominator_set_intersect
def dominator_set_intersect(b1, b2, doms) finger1, finger2 = b1, b2 while finger1.post_order_number != finger2.post_order_number finger1 = doms[finger1] while finger1.post_order_number < finger2.post_order_number finger2 = doms[finger2] while finger2.post_order_number < finger1.post_order_nu...
ruby
def dominator_set_intersect(b1, b2, doms) finger1, finger2 = b1, b2 while finger1.post_order_number != finger2.post_order_number finger1 = doms[finger1] while finger1.post_order_number < finger2.post_order_number finger2 = doms[finger2] while finger2.post_order_number < finger1.post_order_nu...
[ "def", "dominator_set_intersect", "(", "b1", ",", "b2", ",", "doms", ")", "finger1", ",", "finger2", "=", "b1", ",", "b2", "while", "finger1", ".", "post_order_number", "!=", "finger2", ".", "post_order_number", "finger1", "=", "doms", "[", "finger1", "]", ...
performs a set intersection of the dominator tree.
[ "performs", "a", "set", "intersection", "of", "the", "dominator", "tree", "." ]
0e38780eb44466ae35f33d28ec75536a4f3a969b
https://github.com/michaeledgar/laser/blob/0e38780eb44466ae35f33d28ec75536a4f3a969b/lib/laser/third_party/rgl/dominators.rb#L96-L103
19,842
OSC/ood_core
lib/ood_core/cluster.rb
OodCore.Cluster.batch_connect_config
def batch_connect_config(template = nil) if template @batch_connect_config.fetch(template.to_sym, {}).to_h.symbolize_keys.merge(template: template.to_sym) else @batch_connect_config end end
ruby
def batch_connect_config(template = nil) if template @batch_connect_config.fetch(template.to_sym, {}).to_h.symbolize_keys.merge(template: template.to_sym) else @batch_connect_config end end
[ "def", "batch_connect_config", "(", "template", "=", "nil", ")", "if", "template", "@batch_connect_config", ".", "fetch", "(", "template", ".", "to_sym", ",", "{", "}", ")", ".", "to_h", ".", "symbolize_keys", ".", "merge", "(", "template", ":", "template", ...
The batch connect template configuration used for this cluster @param template [#to_sym, nil] the template type @return [Hash] the batch connect configuration
[ "The", "batch", "connect", "template", "configuration", "used", "for", "this", "cluster" ]
11eb65be194a8a4c956b70fb8c78a715e763b1df
https://github.com/OSC/ood_core/blob/11eb65be194a8a4c956b70fb8c78a715e763b1df/lib/ood_core/cluster.rb#L92-L98
19,843
OSC/ood_core
lib/ood_core/cluster.rb
OodCore.Cluster.batch_connect_template
def batch_connect_template(context = {}) context = context.to_h.symbolize_keys BatchConnect::Factory.build batch_connect_config(context[:template] || :basic).merge(context) end
ruby
def batch_connect_template(context = {}) context = context.to_h.symbolize_keys BatchConnect::Factory.build batch_connect_config(context[:template] || :basic).merge(context) end
[ "def", "batch_connect_template", "(", "context", "=", "{", "}", ")", "context", "=", "context", ".", "to_h", ".", "symbolize_keys", "BatchConnect", "::", "Factory", ".", "build", "batch_connect_config", "(", "context", "[", ":template", "]", "||", ":basic", ")...
Build a batch connect template from the respective configuration @param context [#to_h] the context used for rendering the template @return [BatchConnect::Template] the batch connect template
[ "Build", "a", "batch", "connect", "template", "from", "the", "respective", "configuration" ]
11eb65be194a8a4c956b70fb8c78a715e763b1df
https://github.com/OSC/ood_core/blob/11eb65be194a8a4c956b70fb8c78a715e763b1df/lib/ood_core/cluster.rb#L103-L106
19,844
OSC/ood_core
lib/ood_core/cluster.rb
OodCore.Cluster.custom_allow?
def custom_allow?(feature) allow? && !custom_config(feature).empty? && build_acls(custom_config(feature).fetch(:acls, []).map(&:to_h)).all?(&:allow?) end
ruby
def custom_allow?(feature) allow? && !custom_config(feature).empty? && build_acls(custom_config(feature).fetch(:acls, []).map(&:to_h)).all?(&:allow?) end
[ "def", "custom_allow?", "(", "feature", ")", "allow?", "&&", "!", "custom_config", "(", "feature", ")", ".", "empty?", "&&", "build_acls", "(", "custom_config", "(", "feature", ")", ".", "fetch", "(", ":acls", ",", "[", "]", ")", ".", "map", "(", ":to_...
Whether the custom feature is allowed based on the ACLs @return [Boolean] is this custom feature allowed
[ "Whether", "the", "custom", "feature", "is", "allowed", "based", "on", "the", "ACLs" ]
11eb65be194a8a4c956b70fb8c78a715e763b1df
https://github.com/OSC/ood_core/blob/11eb65be194a8a4c956b70fb8c78a715e763b1df/lib/ood_core/cluster.rb#L117-L121
19,845
OSC/ood_core
lib/ood_core/cluster.rb
OodCore.Cluster.to_h
def to_h { id: id, metadata: metadata_config, login: login_config, job: job_config, custom: custom_config, acls: acls_config, batch_connect: batch_connect_config } end
ruby
def to_h { id: id, metadata: metadata_config, login: login_config, job: job_config, custom: custom_config, acls: acls_config, batch_connect: batch_connect_config } end
[ "def", "to_h", "{", "id", ":", "id", ",", "metadata", ":", "metadata_config", ",", "login", ":", "login_config", ",", "job", ":", "job_config", ",", "custom", ":", "custom_config", ",", "acls", ":", "acls_config", ",", "batch_connect", ":", "batch_connect_co...
Convert object to hash @return [Hash] the hash describing this object
[ "Convert", "object", "to", "hash" ]
11eb65be194a8a4c956b70fb8c78a715e763b1df
https://github.com/OSC/ood_core/blob/11eb65be194a8a4c956b70fb8c78a715e763b1df/lib/ood_core/cluster.rb#L150-L160
19,846
OSC/ood_core
lib/ood_core/job/adapters/drmaa.rb
DRMAA.Session.run_bulk
def run_bulk(t, first, last, incr = 1) retry_until { DRMAA.run_bulk_jobs(t.ptr, first, last, incr) } end
ruby
def run_bulk(t, first, last, incr = 1) retry_until { DRMAA.run_bulk_jobs(t.ptr, first, last, incr) } end
[ "def", "run_bulk", "(", "t", ",", "first", ",", "last", ",", "incr", "=", "1", ")", "retry_until", "{", "DRMAA", ".", "run_bulk_jobs", "(", "t", ".", "ptr", ",", "first", ",", "last", ",", "incr", ")", "}", "end" ]
submits bulk job described by JobTemplate 't' and returns an array of job id strings
[ "submits", "bulk", "job", "described", "by", "JobTemplate", "t", "and", "returns", "an", "array", "of", "job", "id", "strings" ]
11eb65be194a8a4c956b70fb8c78a715e763b1df
https://github.com/OSC/ood_core/blob/11eb65be194a8a4c956b70fb8c78a715e763b1df/lib/ood_core/job/adapters/drmaa.rb#L756-L758
19,847
OSC/ood_core
lib/ood_core/job/adapters/drmaa.rb
DRMAA.Session.wait_each
def wait_each(timeout = -1) if ! block_given? ary = Array.new end while true begin info = DRMAA.wait(ANY_JOB, timeout) rescue DRMAAInvalidJobError break ...
ruby
def wait_each(timeout = -1) if ! block_given? ary = Array.new end while true begin info = DRMAA.wait(ANY_JOB, timeout) rescue DRMAAInvalidJobError break ...
[ "def", "wait_each", "(", "timeout", "=", "-", "1", ")", "if", "!", "block_given?", "ary", "=", "Array", ".", "new", "end", "while", "true", "begin", "info", "=", "DRMAA", ".", "wait", "(", "ANY_JOB", ",", "timeout", ")", "rescue", "DRMAAInvalidJobError",...
run block with JobInfo to finish for each waited session job or return JobInfo array if no block was passed
[ "run", "block", "with", "JobInfo", "to", "finish", "for", "each", "waited", "session", "job", "or", "return", "JobInfo", "array", "if", "no", "block", "was", "passed" ]
11eb65be194a8a4c956b70fb8c78a715e763b1df
https://github.com/OSC/ood_core/blob/11eb65be194a8a4c956b70fb8c78a715e763b1df/lib/ood_core/job/adapters/drmaa.rb#L772-L791
19,848
activerecord-hackery/meta_where
lib/meta_where/relation.rb
MetaWhere.Relation.predicate_visitor
def predicate_visitor join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(@klass, association_joins, custom_joins) MetaWhere::Visitors::Predicate.new(join_dependency) end
ruby
def predicate_visitor join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(@klass, association_joins, custom_joins) MetaWhere::Visitors::Predicate.new(join_dependency) end
[ "def", "predicate_visitor", "join_dependency", "=", "ActiveRecord", "::", "Associations", "::", "ClassMethods", "::", "JoinDependency", ".", "new", "(", "@klass", ",", "association_joins", ",", "custom_joins", ")", "MetaWhere", "::", "Visitors", "::", "Predicate", "...
Very occasionally, we need to get a visitor for another relation, so it makes sense to factor these out into a public method despite only being two lines long.
[ "Very", "occasionally", "we", "need", "to", "get", "a", "visitor", "for", "another", "relation", "so", "it", "makes", "sense", "to", "factor", "these", "out", "into", "a", "public", "method", "despite", "only", "being", "two", "lines", "long", "." ]
12f2ee52eb3789ac50b0d77890122dd85b85da9b
https://github.com/activerecord-hackery/meta_where/blob/12f2ee52eb3789ac50b0d77890122dd85b85da9b/lib/meta_where/relation.rb#L116-L119
19,849
sailthru/sailthru-ruby-client
lib/sailthru/client.rb
Sailthru.Client.schedule_blast_from_template
def schedule_blast_from_template(template, list, schedule_time, options={}) post = options ? options : {} post[:copy_template] = template post[:list] = list post[:schedule_time] = schedule_time api_post(:blast, post) end
ruby
def schedule_blast_from_template(template, list, schedule_time, options={}) post = options ? options : {} post[:copy_template] = template post[:list] = list post[:schedule_time] = schedule_time api_post(:blast, post) end
[ "def", "schedule_blast_from_template", "(", "template", ",", "list", ",", "schedule_time", ",", "options", "=", "{", "}", ")", "post", "=", "options", "?", "options", ":", "{", "}", "post", "[", ":copy_template", "]", "=", "template", "post", "[", ":list",...
Schedule a mass mail blast from template
[ "Schedule", "a", "mass", "mail", "blast", "from", "template" ]
978deed2b25769a73de14107cb2a0c93143522e4
https://github.com/sailthru/sailthru-ruby-client/blob/978deed2b25769a73de14107cb2a0c93143522e4/lib/sailthru/client.rb#L108-L114
19,850
sailthru/sailthru-ruby-client
lib/sailthru/client.rb
Sailthru.Client.schedule_blast_from_blast
def schedule_blast_from_blast(blast_id, schedule_time, options={}) post = options ? options : {} post[:copy_blast] = blast_id #post[:name] = name post[:schedule_time] = schedule_time api_post(:blast, post) end
ruby
def schedule_blast_from_blast(blast_id, schedule_time, options={}) post = options ? options : {} post[:copy_blast] = blast_id #post[:name] = name post[:schedule_time] = schedule_time api_post(:blast, post) end
[ "def", "schedule_blast_from_blast", "(", "blast_id", ",", "schedule_time", ",", "options", "=", "{", "}", ")", "post", "=", "options", "?", "options", ":", "{", "}", "post", "[", ":copy_blast", "]", "=", "blast_id", "#post[:name] = name", "post", "[", ":sche...
Schedule a mass mail blast from previous blast
[ "Schedule", "a", "mass", "mail", "blast", "from", "previous", "blast" ]
978deed2b25769a73de14107cb2a0c93143522e4
https://github.com/sailthru/sailthru-ruby-client/blob/978deed2b25769a73de14107cb2a0c93143522e4/lib/sailthru/client.rb#L117-L123
19,851
sailthru/sailthru-ruby-client
lib/sailthru/client.rb
Sailthru.Client.update_blast
def update_blast(blast_id, name = nil, list = nil, schedule_time = nil, from_name = nil, from_email = nil, subject = nil, content_html = nil, content_text = nil, options = {}) data = options ? options : {} data[:blast_id] = blast_id if name != nil data[:name] = name end if list != ...
ruby
def update_blast(blast_id, name = nil, list = nil, schedule_time = nil, from_name = nil, from_email = nil, subject = nil, content_html = nil, content_text = nil, options = {}) data = options ? options : {} data[:blast_id] = blast_id if name != nil data[:name] = name end if list != ...
[ "def", "update_blast", "(", "blast_id", ",", "name", "=", "nil", ",", "list", "=", "nil", ",", "schedule_time", "=", "nil", ",", "from_name", "=", "nil", ",", "from_email", "=", "nil", ",", "subject", "=", "nil", ",", "content_html", "=", "nil", ",", ...
params blast_id, Fixnum | String name, String list, String schedule_time, String from_name, String from_email, String subject, String content_html, String content_text, String options, hash updates existing blast
[ "params", "blast_id", "Fixnum", "|", "String", "name", "String", "list", "String", "schedule_time", "String", "from_name", "String", "from_email", "String", "subject", "String", "content_html", "String", "content_text", "String", "options", "hash" ]
978deed2b25769a73de14107cb2a0c93143522e4
https://github.com/sailthru/sailthru-ruby-client/blob/978deed2b25769a73de14107cb2a0c93143522e4/lib/sailthru/client.rb#L138-L166
19,852
sailthru/sailthru-ruby-client
lib/sailthru/client.rb
Sailthru.Client.stats_list
def stats_list(list = nil, date = nil) data = {} if list != nil data[:list] = list end if date != nil data[:date] = date end data[:stat] = 'list' api_get(:stats, data) end
ruby
def stats_list(list = nil, date = nil) data = {} if list != nil data[:list] = list end if date != nil data[:date] = date end data[:stat] = 'list' api_get(:stats, data) end
[ "def", "stats_list", "(", "list", "=", "nil", ",", "date", "=", "nil", ")", "data", "=", "{", "}", "if", "list", "!=", "nil", "data", "[", ":list", "]", "=", "list", "end", "if", "date", "!=", "nil", "data", "[", ":date", "]", "=", "date", "end...
params list, String date, String returns: hash, response from server Retrieve information about your subscriber counts on a particular list, on a particular day.
[ "params", "list", "String", "date", "String" ]
978deed2b25769a73de14107cb2a0c93143522e4
https://github.com/sailthru/sailthru-ruby-client/blob/978deed2b25769a73de14107cb2a0c93143522e4/lib/sailthru/client.rb#L411-L421
19,853
sailthru/sailthru-ruby-client
lib/sailthru/client.rb
Sailthru.Client.stats_blast
def stats_blast(blast_id = nil, start_date = nil, end_date = nil, options = {}) data = options if blast_id != nil data[:blast_id] = blast_id end if start_date != nil data[:start_date] = start_date end if end_date != nil data[:end_date] = end_date end ...
ruby
def stats_blast(blast_id = nil, start_date = nil, end_date = nil, options = {}) data = options if blast_id != nil data[:blast_id] = blast_id end if start_date != nil data[:start_date] = start_date end if end_date != nil data[:end_date] = end_date end ...
[ "def", "stats_blast", "(", "blast_id", "=", "nil", ",", "start_date", "=", "nil", ",", "end_date", "=", "nil", ",", "options", "=", "{", "}", ")", "data", "=", "options", "if", "blast_id", "!=", "nil", "data", "[", ":blast_id", "]", "=", "blast_id", ...
params blast_id, String start_date, String end_date, String options, Hash returns: hash, response from server Retrieve information about a particular blast or aggregated information from all of blasts over a specified date range
[ "params", "blast_id", "String", "start_date", "String", "end_date", "String", "options", "Hash" ]
978deed2b25769a73de14107cb2a0c93143522e4
https://github.com/sailthru/sailthru-ruby-client/blob/978deed2b25769a73de14107cb2a0c93143522e4/lib/sailthru/client.rb#L432-L445
19,854
sailthru/sailthru-ruby-client
lib/sailthru/client.rb
Sailthru.Client.stats_send
def stats_send(template = nil, start_date = nil, end_date = nil, options = {}) data = options if template != nil data[:template] = template end if start_date != nil data[:start_date] = start_date end if end_date != nil data[:end_date] = end_date end ...
ruby
def stats_send(template = nil, start_date = nil, end_date = nil, options = {}) data = options if template != nil data[:template] = template end if start_date != nil data[:start_date] = start_date end if end_date != nil data[:end_date] = end_date end ...
[ "def", "stats_send", "(", "template", "=", "nil", ",", "start_date", "=", "nil", ",", "end_date", "=", "nil", ",", "options", "=", "{", "}", ")", "data", "=", "options", "if", "template", "!=", "nil", "data", "[", ":template", "]", "=", "template", "...
params template, String start_date, String end_date, String options, Hash returns: hash, response from server Retrieve information about a particular blast or aggregated information from all of blasts over a specified date range
[ "params", "template", "String", "start_date", "String", "end_date", "String", "options", "Hash" ]
978deed2b25769a73de14107cb2a0c93143522e4
https://github.com/sailthru/sailthru-ruby-client/blob/978deed2b25769a73de14107cb2a0c93143522e4/lib/sailthru/client.rb#L456-L469
19,855
sailthru/sailthru-ruby-client
lib/sailthru/client.rb
Sailthru.Client.save_alert
def save_alert(email, type, template, _when = nil, options = {}) data = options data[:email] = email data[:type] = type data[:template] = template if (type == 'weekly' || type == 'daily') data[:when] = _when end api_post(:alert, data) end
ruby
def save_alert(email, type, template, _when = nil, options = {}) data = options data[:email] = email data[:type] = type data[:template] = template if (type == 'weekly' || type == 'daily') data[:when] = _when end api_post(:alert, data) end
[ "def", "save_alert", "(", "email", ",", "type", ",", "template", ",", "_when", "=", "nil", ",", "options", "=", "{", "}", ")", "data", "=", "options", "data", "[", ":email", "]", "=", "email", "data", "[", ":type", "]", "=", "type", "data", "[", ...
params email, String type, String template, String _when, String options, hash Add a new alert to a user. You can add either a realtime or a summary alert (daily/weekly). _when is only required when alert type is weekly or daily
[ "params", "email", "String", "type", "String", "template", "String", "_when", "String", "options", "hash" ]
978deed2b25769a73de14107cb2a0c93143522e4
https://github.com/sailthru/sailthru-ruby-client/blob/978deed2b25769a73de14107cb2a0c93143522e4/lib/sailthru/client.rb#L566-L575
19,856
sailthru/sailthru-ruby-client
lib/sailthru/client.rb
Sailthru.Client.process_job
def process_job(job, options = {}, report_email = nil, postback_url = nil, binary_key = nil) data = options data['job'] = job if !report_email.nil? data['report_email'] = report_email end if !postback_url.nil? data['postback_url'] = postback_url end api_post(:j...
ruby
def process_job(job, options = {}, report_email = nil, postback_url = nil, binary_key = nil) data = options data['job'] = job if !report_email.nil? data['report_email'] = report_email end if !postback_url.nil? data['postback_url'] = postback_url end api_post(:j...
[ "def", "process_job", "(", "job", ",", "options", "=", "{", "}", ",", "report_email", "=", "nil", ",", "postback_url", "=", "nil", ",", "binary_key", "=", "nil", ")", "data", "=", "options", "data", "[", "'job'", "]", "=", "job", "if", "!", "report_e...
params job, String options, hash report_email, String postback_url, String binary_key, String interface for making request to job call
[ "params", "job", "String", "options", "hash", "report_email", "String", "postback_url", "String", "binary_key", "String" ]
978deed2b25769a73de14107cb2a0c93143522e4
https://github.com/sailthru/sailthru-ruby-client/blob/978deed2b25769a73de14107cb2a0c93143522e4/lib/sailthru/client.rb#L595-L606
19,857
sailthru/sailthru-ruby-client
lib/sailthru/client.rb
Sailthru.Client.process_import_job
def process_import_job(list, emails, report_email = nil, postback_url = nil, options = {}) data = options data['list'] = list data['emails'] = Array(emails).join(',') process_job(:import, data, report_email, postback_url) end
ruby
def process_import_job(list, emails, report_email = nil, postback_url = nil, options = {}) data = options data['list'] = list data['emails'] = Array(emails).join(',') process_job(:import, data, report_email, postback_url) end
[ "def", "process_import_job", "(", "list", ",", "emails", ",", "report_email", "=", "nil", ",", "postback_url", "=", "nil", ",", "options", "=", "{", "}", ")", "data", "=", "options", "data", "[", "'list'", "]", "=", "list", "data", "[", "'emails'", "]"...
params emails, String | Array implementation for import_job
[ "params", "emails", "String", "|", "Array", "implementation", "for", "import_job" ]
978deed2b25769a73de14107cb2a0c93143522e4
https://github.com/sailthru/sailthru-ruby-client/blob/978deed2b25769a73de14107cb2a0c93143522e4/lib/sailthru/client.rb#L611-L616
19,858
sailthru/sailthru-ruby-client
lib/sailthru/client.rb
Sailthru.Client.process_import_job_from_file
def process_import_job_from_file(list, file_path, report_email = nil, postback_url = nil, options = {}) data = options data['list'] = list data['file'] = file_path process_job(:import, data, report_email, postback_url, 'file') end
ruby
def process_import_job_from_file(list, file_path, report_email = nil, postback_url = nil, options = {}) data = options data['list'] = list data['file'] = file_path process_job(:import, data, report_email, postback_url, 'file') end
[ "def", "process_import_job_from_file", "(", "list", ",", "file_path", ",", "report_email", "=", "nil", ",", "postback_url", "=", "nil", ",", "options", "=", "{", "}", ")", "data", "=", "options", "data", "[", "'list'", "]", "=", "list", "data", "[", "'fi...
implementation for import job using file upload
[ "implementation", "for", "import", "job", "using", "file", "upload" ]
978deed2b25769a73de14107cb2a0c93143522e4
https://github.com/sailthru/sailthru-ruby-client/blob/978deed2b25769a73de14107cb2a0c93143522e4/lib/sailthru/client.rb#L619-L624
19,859
sailthru/sailthru-ruby-client
lib/sailthru/client.rb
Sailthru.Client.process_update_job_from_file
def process_update_job_from_file(file_path, report_email = nil, postback_url = nil, options = {}) data = options data['file'] = file_path process_job(:update, data, report_email, postback_url, 'file') end
ruby
def process_update_job_from_file(file_path, report_email = nil, postback_url = nil, options = {}) data = options data['file'] = file_path process_job(:update, data, report_email, postback_url, 'file') end
[ "def", "process_update_job_from_file", "(", "file_path", ",", "report_email", "=", "nil", ",", "postback_url", "=", "nil", ",", "options", "=", "{", "}", ")", "data", "=", "options", "data", "[", "'file'", "]", "=", "file_path", "process_job", "(", ":update"...
implementation for update job using file upload
[ "implementation", "for", "update", "job", "using", "file", "upload" ]
978deed2b25769a73de14107cb2a0c93143522e4
https://github.com/sailthru/sailthru-ruby-client/blob/978deed2b25769a73de14107cb2a0c93143522e4/lib/sailthru/client.rb#L627-L631
19,860
sailthru/sailthru-ruby-client
lib/sailthru/client.rb
Sailthru.Client.process_purchase_import_job_from_file
def process_purchase_import_job_from_file(file_path, report_email = nil, postback_url = nil, options = {}) data = options data['file'] = file_path process_job(:purchase_import, data, report_email, postback_url, 'file') end
ruby
def process_purchase_import_job_from_file(file_path, report_email = nil, postback_url = nil, options = {}) data = options data['file'] = file_path process_job(:purchase_import, data, report_email, postback_url, 'file') end
[ "def", "process_purchase_import_job_from_file", "(", "file_path", ",", "report_email", "=", "nil", ",", "postback_url", "=", "nil", ",", "options", "=", "{", "}", ")", "data", "=", "options", "data", "[", "'file'", "]", "=", "file_path", "process_job", "(", ...
implementation for purchase import job using file upload
[ "implementation", "for", "purchase", "import", "job", "using", "file", "upload" ]
978deed2b25769a73de14107cb2a0c93143522e4
https://github.com/sailthru/sailthru-ruby-client/blob/978deed2b25769a73de14107cb2a0c93143522e4/lib/sailthru/client.rb#L634-L638
19,861
sailthru/sailthru-ruby-client
lib/sailthru/client.rb
Sailthru.Client.process_snapshot_job
def process_snapshot_job(query = {}, report_email = nil, postback_url = nil, options = {}) data = options data['query'] = query process_job(:snapshot, data, report_email, postback_url) end
ruby
def process_snapshot_job(query = {}, report_email = nil, postback_url = nil, options = {}) data = options data['query'] = query process_job(:snapshot, data, report_email, postback_url) end
[ "def", "process_snapshot_job", "(", "query", "=", "{", "}", ",", "report_email", "=", "nil", ",", "postback_url", "=", "nil", ",", "options", "=", "{", "}", ")", "data", "=", "options", "data", "[", "'query'", "]", "=", "query", "process_job", "(", ":s...
implementation for snapshot job
[ "implementation", "for", "snapshot", "job" ]
978deed2b25769a73de14107cb2a0c93143522e4
https://github.com/sailthru/sailthru-ruby-client/blob/978deed2b25769a73de14107cb2a0c93143522e4/lib/sailthru/client.rb#L641-L645
19,862
sailthru/sailthru-ruby-client
lib/sailthru/client.rb
Sailthru.Client.process_export_list_job
def process_export_list_job(list, report_email = nil, postback_url = nil, options = {}) data = options data['list'] = list process_job(:export_list_data, data, report_email, postback_url) end
ruby
def process_export_list_job(list, report_email = nil, postback_url = nil, options = {}) data = options data['list'] = list process_job(:export_list_data, data, report_email, postback_url) end
[ "def", "process_export_list_job", "(", "list", ",", "report_email", "=", "nil", ",", "postback_url", "=", "nil", ",", "options", "=", "{", "}", ")", "data", "=", "options", "data", "[", "'list'", "]", "=", "list", "process_job", "(", ":export_list_data", "...
implementation for export list job
[ "implementation", "for", "export", "list", "job" ]
978deed2b25769a73de14107cb2a0c93143522e4
https://github.com/sailthru/sailthru-ruby-client/blob/978deed2b25769a73de14107cb2a0c93143522e4/lib/sailthru/client.rb#L648-L652
19,863
sailthru/sailthru-ruby-client
lib/sailthru/client.rb
Sailthru.Client.get_user_by_key
def get_user_by_key(id, key, fields = {}) data = { 'id' => id, 'key' => key, 'fields' => fields } api_get(:user, data) end
ruby
def get_user_by_key(id, key, fields = {}) data = { 'id' => id, 'key' => key, 'fields' => fields } api_get(:user, data) end
[ "def", "get_user_by_key", "(", "id", ",", "key", ",", "fields", "=", "{", "}", ")", "data", "=", "{", "'id'", "=>", "id", ",", "'key'", "=>", "key", ",", "'fields'", "=>", "fields", "}", "api_get", "(", ":user", ",", "data", ")", "end" ]
Get user by specified key
[ "Get", "user", "by", "specified", "key" ]
978deed2b25769a73de14107cb2a0c93143522e4
https://github.com/sailthru/sailthru-ruby-client/blob/978deed2b25769a73de14107cb2a0c93143522e4/lib/sailthru/client.rb#L665-L672
19,864
sailthru/sailthru-ruby-client
lib/sailthru/client.rb
Sailthru.Client.get_trigger_by_template
def get_trigger_by_template(template, trigger_id = nil) data = {} data['template'] = template if trigger_id != nil then data['trigger_id'] = trigger_id end api_get(:trigger, data) end
ruby
def get_trigger_by_template(template, trigger_id = nil) data = {} data['template'] = template if trigger_id != nil then data['trigger_id'] = trigger_id end api_get(:trigger, data) end
[ "def", "get_trigger_by_template", "(", "template", ",", "trigger_id", "=", "nil", ")", "data", "=", "{", "}", "data", "[", "'template'", "]", "=", "template", "if", "trigger_id", "!=", "nil", "then", "data", "[", "'trigger_id'", "]", "=", "trigger_id", "en...
params template, String trigger_id, String Get an existing trigger
[ "params", "template", "String", "trigger_id", "String", "Get", "an", "existing", "trigger" ]
978deed2b25769a73de14107cb2a0c93143522e4
https://github.com/sailthru/sailthru-ruby-client/blob/978deed2b25769a73de14107cb2a0c93143522e4/lib/sailthru/client.rb#L691-L696
19,865
sailthru/sailthru-ruby-client
lib/sailthru/client.rb
Sailthru.Client.post_template_trigger
def post_template_trigger(template, time, time_unit, event, zephyr) data = {} data['template'] = template data['time'] = time data['time_unit'] = time_unit data['event'] = event data['zephyr'] = zephyr api_post(:trigger, data) end
ruby
def post_template_trigger(template, time, time_unit, event, zephyr) data = {} data['template'] = template data['time'] = time data['time_unit'] = time_unit data['event'] = event data['zephyr'] = zephyr api_post(:trigger, data) end
[ "def", "post_template_trigger", "(", "template", ",", "time", ",", "time_unit", ",", "event", ",", "zephyr", ")", "data", "=", "{", "}", "data", "[", "'template'", "]", "=", "template", "data", "[", "'time'", "]", "=", "time", "data", "[", "'time_unit'",...
params template, String time, String time_unit, String event, String zephyr, String Create or update a trigger
[ "params", "template", "String", "time", "String", "time_unit", "String", "event", "String", "zephyr", "String", "Create", "or", "update", "a", "trigger" ]
978deed2b25769a73de14107cb2a0c93143522e4
https://github.com/sailthru/sailthru-ruby-client/blob/978deed2b25769a73de14107cb2a0c93143522e4/lib/sailthru/client.rb#L714-L722
19,866
sailthru/sailthru-ruby-client
lib/sailthru/client.rb
Sailthru.Client.post_event_trigger
def post_event_trigger(event, time, time_unit, zephyr) data = {} data['time'] = time data['time_unit'] = time_unit data['event'] = event data['zephyr'] = zephyr api_post(:trigger, data) end
ruby
def post_event_trigger(event, time, time_unit, zephyr) data = {} data['time'] = time data['time_unit'] = time_unit data['event'] = event data['zephyr'] = zephyr api_post(:trigger, data) end
[ "def", "post_event_trigger", "(", "event", ",", "time", ",", "time_unit", ",", "zephyr", ")", "data", "=", "{", "}", "data", "[", "'time'", "]", "=", "time", "data", "[", "'time_unit'", "]", "=", "time_unit", "data", "[", "'event'", "]", "=", "event", ...
params template, String time, String time_unit, String zephyr, String Create or update a trigger
[ "params", "template", "String", "time", "String", "time_unit", "String", "zephyr", "String", "Create", "or", "update", "a", "trigger" ]
978deed2b25769a73de14107cb2a0c93143522e4
https://github.com/sailthru/sailthru-ruby-client/blob/978deed2b25769a73de14107cb2a0c93143522e4/lib/sailthru/client.rb#L730-L737
19,867
sailthru/sailthru-ruby-client
lib/sailthru/client.rb
Sailthru.Client.set_up_post_request
def set_up_post_request(uri, data, headers, binary_key = nil) if !binary_key.nil? binary_data = data[binary_key] if binary_data.is_a?(StringIO) data[binary_key] = UploadIO.new( binary_data, "text/plain", "local.path" ) else data[binary_key] = Uplo...
ruby
def set_up_post_request(uri, data, headers, binary_key = nil) if !binary_key.nil? binary_data = data[binary_key] if binary_data.is_a?(StringIO) data[binary_key] = UploadIO.new( binary_data, "text/plain", "local.path" ) else data[binary_key] = Uplo...
[ "def", "set_up_post_request", "(", "uri", ",", "data", ",", "headers", ",", "binary_key", "=", "nil", ")", "if", "!", "binary_key", ".", "nil?", "binary_data", "=", "data", "[", "binary_key", "]", "if", "binary_data", ".", "is_a?", "(", "StringIO", ")", ...
set up our post request
[ "set", "up", "our", "post", "request" ]
978deed2b25769a73de14107cb2a0c93143522e4
https://github.com/sailthru/sailthru-ruby-client/blob/978deed2b25769a73de14107cb2a0c93143522e4/lib/sailthru/client.rb#L824-L844
19,868
basecrm/basecrm-ruby
lib/basecrm/services/tasks_service.rb
BaseCRM.TasksService.create
def create(task) validate_type!(task) attributes = sanitize(task) _, _, root = @client.post("/tasks", attributes) Task.new(root[:data]) end
ruby
def create(task) validate_type!(task) attributes = sanitize(task) _, _, root = @client.post("/tasks", attributes) Task.new(root[:data]) end
[ "def", "create", "(", "task", ")", "validate_type!", "(", "task", ")", "attributes", "=", "sanitize", "(", "task", ")", "_", ",", "_", ",", "root", "=", "@client", ".", "post", "(", "\"/tasks\"", ",", "attributes", ")", "Task", ".", "new", "(", "root...
Create a task post '/tasks' Creates a new task You can create either a **floating** task or create a **related** task and associate it with one of the resource types below: * [Leads](/docs/rest/reference/leads) * [Contacts](/docs/rest/reference/contacts) * [Deals](/docs/rest/reference/deals) @param task [Task...
[ "Create", "a", "task" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/tasks_service.rb#L63-L70
19,869
basecrm/basecrm-ruby
lib/basecrm/services/tasks_service.rb
BaseCRM.TasksService.update
def update(task) validate_type!(task) params = extract_params!(task, :id) id = params[:id] attributes = sanitize(task) _, _, root = @client.put("/tasks/#{id}", attributes) Task.new(root[:data]) end
ruby
def update(task) validate_type!(task) params = extract_params!(task, :id) id = params[:id] attributes = sanitize(task) _, _, root = @client.put("/tasks/#{id}", attributes) Task.new(root[:data]) end
[ "def", "update", "(", "task", ")", "validate_type!", "(", "task", ")", "params", "=", "extract_params!", "(", "task", ",", ":id", ")", "id", "=", "params", "[", ":id", "]", "attributes", "=", "sanitize", "(", "task", ")", "_", ",", "_", ",", "root", ...
Update a task put '/tasks/{id}' Updates task information If the specified task does not exist, this query will return an error @param task [Task, Hash] Either object of the Task type or Hash. This object's attributes describe the object to be updated. @return [Task] The resulting object represting updated resou...
[ "Update", "a", "task" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/tasks_service.rb#L98-L107
19,870
basecrm/basecrm-ruby
lib/basecrm/services/contacts_service.rb
BaseCRM.ContactsService.create
def create(contact) validate_type!(contact) attributes = sanitize(contact) _, _, root = @client.post("/contacts", attributes) Contact.new(root[:data]) end
ruby
def create(contact) validate_type!(contact) attributes = sanitize(contact) _, _, root = @client.post("/contacts", attributes) Contact.new(root[:data]) end
[ "def", "create", "(", "contact", ")", "validate_type!", "(", "contact", ")", "attributes", "=", "sanitize", "(", "contact", ")", "_", ",", "_", ",", "root", "=", "@client", ".", "post", "(", "\"/contacts\"", ",", "attributes", ")", "Contact", ".", "new",...
Create a contact post '/contacts' Create a new contact A contact may represent a single individual or an organization @param contact [Contact, Hash] Either object of the Contact type or Hash. This object's attributes describe the object to be created. @return [Contact] The resulting object represting created re...
[ "Create", "a", "contact" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/contacts_service.rb#L58-L65
19,871
basecrm/basecrm-ruby
lib/basecrm/services/contacts_service.rb
BaseCRM.ContactsService.update
def update(contact) validate_type!(contact) params = extract_params!(contact, :id) id = params[:id] attributes = sanitize(contact) _, _, root = @client.put("/contacts/#{id}", attributes) Contact.new(root[:data]) end
ruby
def update(contact) validate_type!(contact) params = extract_params!(contact, :id) id = params[:id] attributes = sanitize(contact) _, _, root = @client.put("/contacts/#{id}", attributes) Contact.new(root[:data]) end
[ "def", "update", "(", "contact", ")", "validate_type!", "(", "contact", ")", "params", "=", "extract_params!", "(", "contact", ",", ":id", ")", "id", "=", "params", "[", ":id", "]", "attributes", "=", "sanitize", "(", "contact", ")", "_", ",", "_", ","...
Update a contact put '/contacts/{id}' Updates contact information If the specified contact does not exist, the request will return an error **Notice** When updating contact tags, you need to provide all tags Any missing tag will be removed from a contact's tags @param contact [Contact, Hash] Either object of t...
[ "Update", "a", "contact" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/contacts_service.rb#L95-L104
19,872
basecrm/basecrm-ruby
lib/basecrm/services/calls_service.rb
BaseCRM.CallsService.create
def create(call) validate_type!(call) attributes = sanitize(call) _, _, root = @client.post("/calls", attributes) Call.new(root[:data]) end
ruby
def create(call) validate_type!(call) attributes = sanitize(call) _, _, root = @client.post("/calls", attributes) Call.new(root[:data]) end
[ "def", "create", "(", "call", ")", "validate_type!", "(", "call", ")", "attributes", "=", "sanitize", "(", "call", ")", "_", ",", "_", ",", "root", "=", "@client", ".", "post", "(", "\"/calls\"", ",", "attributes", ")", "Call", ".", "new", "(", "root...
Create a call post '/calls' Create a new call @param call [Call, Hash] Either object of the Call type or Hash. This object's attributes describe the object to be created. @return [Call] The resulting object represting created resource.
[ "Create", "a", "call" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/calls_service.rb#L50-L57
19,873
basecrm/basecrm-ruby
lib/basecrm/services/calls_service.rb
BaseCRM.CallsService.update
def update(call) validate_type!(call) params = extract_params!(call, :id) id = params[:id] attributes = sanitize(call) _, _, root = @client.put("/calls/#{id}", attributes) Call.new(root[:data]) end
ruby
def update(call) validate_type!(call) params = extract_params!(call, :id) id = params[:id] attributes = sanitize(call) _, _, root = @client.put("/calls/#{id}", attributes) Call.new(root[:data]) end
[ "def", "update", "(", "call", ")", "validate_type!", "(", "call", ")", "params", "=", "extract_params!", "(", "call", ",", ":id", ")", "id", "=", "params", "[", ":id", "]", "attributes", "=", "sanitize", "(", "call", ")", "_", ",", "_", ",", "root", ...
Update a call put '/calls/{id}' Allows to attach a Contact or Lead to an existing Call, or change it’s current association @param call [Call, Hash] Either object of the Call type or Hash. This object's attributes describe the object to be updated. @return [Call] The resulting object represting updated resource.
[ "Update", "a", "call" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/calls_service.rb#L84-L93
19,874
basecrm/basecrm-ruby
lib/basecrm/services/associated_contacts_service.rb
BaseCRM.AssociatedContactsService.where
def where(deal_id, options = {}) _, _, root = @client.get("/deals/#{deal_id}/associated_contacts", options) root[:items].map{ |item| AssociatedContact.new(item[:data]) } end
ruby
def where(deal_id, options = {}) _, _, root = @client.get("/deals/#{deal_id}/associated_contacts", options) root[:items].map{ |item| AssociatedContact.new(item[:data]) } end
[ "def", "where", "(", "deal_id", ",", "options", "=", "{", "}", ")", "_", ",", "_", ",", "root", "=", "@client", ".", "get", "(", "\"/deals/#{deal_id}/associated_contacts\"", ",", "options", ")", "root", "[", ":items", "]", ".", "map", "{", "|", "item",...
Retrieve deal's associated contacts get '/deals/{deal_id}/associated_contacts' Returns all deal associated contacts @param deal_id [Integer] Unique identifier of a Deal @param options [Hash] Search options @option options [Integer] :page (1) Page number to start from. Page numbering starts at 1, and omitting th...
[ "Retrieve", "deal", "s", "associated", "contacts" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/associated_contacts_service.rb#L32-L36
19,875
basecrm/basecrm-ruby
lib/basecrm/services/associated_contacts_service.rb
BaseCRM.AssociatedContactsService.create
def create(deal_id, associated_contact) validate_type!(associated_contact) attributes = sanitize(associated_contact) _, _, root = @client.post("/deals/#{deal_id}/associated_contacts", attributes) AssociatedContact.new(root[:data]) end
ruby
def create(deal_id, associated_contact) validate_type!(associated_contact) attributes = sanitize(associated_contact) _, _, root = @client.post("/deals/#{deal_id}/associated_contacts", attributes) AssociatedContact.new(root[:data]) end
[ "def", "create", "(", "deal_id", ",", "associated_contact", ")", "validate_type!", "(", "associated_contact", ")", "attributes", "=", "sanitize", "(", "associated_contact", ")", "_", ",", "_", ",", "root", "=", "@client", ".", "post", "(", "\"/deals/#{deal_id}/a...
Create an associated contact post '/deals/{deal_id}/associated_contacts' Creates a deal's associated contact and its role If the specified deal or contact does not exist, the request will return an error @param deal_id [Integer] Unique identifier of a Deal @param associated_contact [AssociatedContact, Hash] Eit...
[ "Create", "an", "associated", "contact" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/associated_contacts_service.rb#L49-L56
19,876
basecrm/basecrm-ruby
lib/basecrm/sync.rb
BaseCRM.Sync.fetch
def fetch(&block) return unless block_given? # Set up a new synchronization session for given device's UUID session = @client.sync.start(@device_uuid) # Check if there is anything to synchronize return unless session && session.id # Drain the main queue unitl there is no more dat...
ruby
def fetch(&block) return unless block_given? # Set up a new synchronization session for given device's UUID session = @client.sync.start(@device_uuid) # Check if there is anything to synchronize return unless session && session.id # Drain the main queue unitl there is no more dat...
[ "def", "fetch", "(", "&", "block", ")", "return", "unless", "block_given?", "# Set up a new synchronization session for given device's UUID", "session", "=", "@client", ".", "sync", ".", "start", "(", "@device_uuid", ")", "# Check if there is anything to synchronize", "retu...
Intantiate a new BaseCRM Sync API V2 high-level wrapper @param options[Hash] Wrapper options @option options [String] :device_uuid Device's UUID. @option options [BaseCRM::Client] :client BaseCRM API v2 client instance. @raise [ConfigurationError] if no device's uuid provided @raise [ConfigurationError] if no cl...
[ "Intantiate", "a", "new", "BaseCRM", "Sync", "API", "V2", "high", "-", "level", "wrapper" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/sync.rb#L39-L67
19,877
basecrm/basecrm-ruby
lib/basecrm/services/sync_service.rb
BaseCRM.SyncService.start
def start(device_uuid) validate_device!(device_uuid) status, _, root = @client.post("/sync/start", {}, build_headers(device_uuid)) return nil if status == 204 build_session(root) end
ruby
def start(device_uuid) validate_device!(device_uuid) status, _, root = @client.post("/sync/start", {}, build_headers(device_uuid)) return nil if status == 204 build_session(root) end
[ "def", "start", "(", "device_uuid", ")", "validate_device!", "(", "device_uuid", ")", "status", ",", "_", ",", "root", "=", "@client", ".", "post", "(", "\"/sync/start\"", ",", "{", "}", ",", "build_headers", "(", "device_uuid", ")", ")", "return", "nil", ...
Start synchronization flow post '/sync/start' Starts a new synchronization session. This is the first endpoint to call, in order to start a new synchronization session. @param device_uuid [String] Device's UUID for which to perform synchronization. @return [SyncSession] The resulting object is the synchronizati...
[ "Start", "synchronization", "flow" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/sync_service.rb#L17-L24
19,878
basecrm/basecrm-ruby
lib/basecrm/services/sync_service.rb
BaseCRM.SyncService.fetch
def fetch(device_uuid, session_id, queue='main') validate_device!(device_uuid) raise ArgumentError, "session_id must not be nil nor empty" unless session_id && !session_id.strip.empty? raise ArgumentError, "queue name must not be nil nor empty" unless queue && !queue.strip.empty? status, _, roo...
ruby
def fetch(device_uuid, session_id, queue='main') validate_device!(device_uuid) raise ArgumentError, "session_id must not be nil nor empty" unless session_id && !session_id.strip.empty? raise ArgumentError, "queue name must not be nil nor empty" unless queue && !queue.strip.empty? status, _, roo...
[ "def", "fetch", "(", "device_uuid", ",", "session_id", ",", "queue", "=", "'main'", ")", "validate_device!", "(", "device_uuid", ")", "raise", "ArgumentError", ",", "\"session_id must not be nil nor empty\"", "unless", "session_id", "&&", "!", "session_id", ".", "st...
Get data from queue get '/sync/{session_id}/queues/main' Fetch fresh data from the main queue. Using session identifier you call continously the `#fetch` method to drain the main queue. @param device_uuid [String] Device's UUID for which to perform synchronization @param session_id [String] Unique identifier of...
[ "Get", "data", "from", "queue" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/sync_service.rb#L37-L50
19,879
basecrm/basecrm-ruby
lib/basecrm/services/sync_service.rb
BaseCRM.SyncService.ack
def ack(device_uuid, ack_keys) validate_device!(device_uuid) raise ArgumentError, "ack_keys must not be nil and an array" unless ack_keys && ack_keys.is_a?(Array) return true if ack_keys.empty? payload = { :ack_keys => ack_keys.map(&:to_s) } status, _, _ = @client.post('/syn...
ruby
def ack(device_uuid, ack_keys) validate_device!(device_uuid) raise ArgumentError, "ack_keys must not be nil and an array" unless ack_keys && ack_keys.is_a?(Array) return true if ack_keys.empty? payload = { :ack_keys => ack_keys.map(&:to_s) } status, _, _ = @client.post('/syn...
[ "def", "ack", "(", "device_uuid", ",", "ack_keys", ")", "validate_device!", "(", "device_uuid", ")", "raise", "ArgumentError", ",", "\"ack_keys must not be nil and an array\"", "unless", "ack_keys", "&&", "ack_keys", ".", "is_a?", "(", "Array", ")", "return", "true"...
Acknowledge received data post '/sync/ack' Send acknowledgement keys to let know the Sync service which data you have. As you fetch new data, you need to send acknowledgement keys. @param device_uuid [String] Device's UUID for which to perform synchronization. @param ack_keys [Array<String>] The list of acknowl...
[ "Acknowledge", "received", "data" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/sync_service.rb#L62-L72
19,880
basecrm/basecrm-ruby
lib/basecrm/services/tags_service.rb
BaseCRM.TagsService.create
def create(tag) validate_type!(tag) attributes = sanitize(tag) _, _, root = @client.post("/tags", attributes) Tag.new(root[:data]) end
ruby
def create(tag) validate_type!(tag) attributes = sanitize(tag) _, _, root = @client.post("/tags", attributes) Tag.new(root[:data]) end
[ "def", "create", "(", "tag", ")", "validate_type!", "(", "tag", ")", "attributes", "=", "sanitize", "(", "tag", ")", "_", ",", "_", ",", "root", "=", "@client", ".", "post", "(", "\"/tags\"", ",", "attributes", ")", "Tag", ".", "new", "(", "root", ...
Create a tag post '/tags' Creates a new tag **Notice** the tag's name **must** be unique within the scope of the resource_type @param tag [Tag, Hash] Either object of the Tag type or Hash. This object's attributes describe the object to be created. @return [Tag] The resulting object represting created resource.
[ "Create", "a", "tag" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/tags_service.rb#L52-L59
19,881
basecrm/basecrm-ruby
lib/basecrm/services/tags_service.rb
BaseCRM.TagsService.update
def update(tag) validate_type!(tag) params = extract_params!(tag, :id) id = params[:id] attributes = sanitize(tag) _, _, root = @client.put("/tags/#{id}", attributes) Tag.new(root[:data]) end
ruby
def update(tag) validate_type!(tag) params = extract_params!(tag, :id) id = params[:id] attributes = sanitize(tag) _, _, root = @client.put("/tags/#{id}", attributes) Tag.new(root[:data]) end
[ "def", "update", "(", "tag", ")", "validate_type!", "(", "tag", ")", "params", "=", "extract_params!", "(", "tag", ",", ":id", ")", "id", "=", "params", "[", ":id", "]", "attributes", "=", "sanitize", "(", "tag", ")", "_", ",", "_", ",", "root", "=...
Update a tag put '/tags/{id}' Updates a tag's information If the specified tag does not exist, this query will return an error **Notice** if you want to update a tag, you **must** make sure the tag's name is unique within the scope of the specified resource @param tag [Tag, Hash] Either object of the Tag type o...
[ "Update", "a", "tag" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/tags_service.rb#L88-L97
19,882
basecrm/basecrm-ruby
lib/basecrm/services/loss_reasons_service.rb
BaseCRM.LossReasonsService.create
def create(loss_reason) validate_type!(loss_reason) attributes = sanitize(loss_reason) _, _, root = @client.post("/loss_reasons", attributes) LossReason.new(root[:data]) end
ruby
def create(loss_reason) validate_type!(loss_reason) attributes = sanitize(loss_reason) _, _, root = @client.post("/loss_reasons", attributes) LossReason.new(root[:data]) end
[ "def", "create", "(", "loss_reason", ")", "validate_type!", "(", "loss_reason", ")", "attributes", "=", "sanitize", "(", "loss_reason", ")", "_", ",", "_", ",", "root", "=", "@client", ".", "post", "(", "\"/loss_reasons\"", ",", "attributes", ")", "LossReaso...
Create a loss reason post '/loss_reasons' Create a new loss reason <figure class="notice"> Loss reason's name **must** be unique </figure> @param loss_reason [LossReason, Hash] Either object of the LossReason type or Hash. This object's attributes describe the object to be created. @return [LossReason] The re...
[ "Create", "a", "loss", "reason" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/loss_reasons_service.rb#L52-L59
19,883
basecrm/basecrm-ruby
lib/basecrm/services/loss_reasons_service.rb
BaseCRM.LossReasonsService.update
def update(loss_reason) validate_type!(loss_reason) params = extract_params!(loss_reason, :id) id = params[:id] attributes = sanitize(loss_reason) _, _, root = @client.put("/loss_reasons/#{id}", attributes) LossReason.new(root[:data]) end
ruby
def update(loss_reason) validate_type!(loss_reason) params = extract_params!(loss_reason, :id) id = params[:id] attributes = sanitize(loss_reason) _, _, root = @client.put("/loss_reasons/#{id}", attributes) LossReason.new(root[:data]) end
[ "def", "update", "(", "loss_reason", ")", "validate_type!", "(", "loss_reason", ")", "params", "=", "extract_params!", "(", "loss_reason", ",", ":id", ")", "id", "=", "params", "[", ":id", "]", "attributes", "=", "sanitize", "(", "loss_reason", ")", "_", "...
Update a loss reason put '/loss_reasons/{id}' Updates a loss reason information If the specified loss reason does not exist, the request will return an error <figure class="notice"> If you want to update loss reason you **must** make sure name of the reason is unique </figure> @param loss_reason [LossReason, ...
[ "Update", "a", "loss", "reason" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/loss_reasons_service.rb#L90-L99
19,884
basecrm/basecrm-ruby
lib/basecrm/services/notes_service.rb
BaseCRM.NotesService.create
def create(note) validate_type!(note) attributes = sanitize(note) _, _, root = @client.post("/notes", attributes) Note.new(root[:data]) end
ruby
def create(note) validate_type!(note) attributes = sanitize(note) _, _, root = @client.post("/notes", attributes) Note.new(root[:data]) end
[ "def", "create", "(", "note", ")", "validate_type!", "(", "note", ")", "attributes", "=", "sanitize", "(", "note", ")", "_", ",", "_", ",", "root", "=", "@client", ".", "post", "(", "\"/notes\"", ",", "attributes", ")", "Note", ".", "new", "(", "root...
Create a note post '/notes' Create a new note and associate it with one of the resources listed below: * [Leads](/docs/rest/reference/leads) * [Contacts](/docs/rest/reference/contacts) * [Deals](/docs/rest/reference/deals) @param note [Note, Hash] Either object of the Note type or Hash. This object's attribute...
[ "Create", "a", "note" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/notes_service.rb#L56-L63
19,885
basecrm/basecrm-ruby
lib/basecrm/services/notes_service.rb
BaseCRM.NotesService.update
def update(note) validate_type!(note) params = extract_params!(note, :id) id = params[:id] attributes = sanitize(note) _, _, root = @client.put("/notes/#{id}", attributes) Note.new(root[:data]) end
ruby
def update(note) validate_type!(note) params = extract_params!(note, :id) id = params[:id] attributes = sanitize(note) _, _, root = @client.put("/notes/#{id}", attributes) Note.new(root[:data]) end
[ "def", "update", "(", "note", ")", "validate_type!", "(", "note", ")", "params", "=", "extract_params!", "(", "note", ",", ":id", ")", "id", "=", "params", "[", ":id", "]", "attributes", "=", "sanitize", "(", "note", ")", "_", ",", "_", ",", "root", ...
Update a note put '/notes/{id}' Updates note information If the note ID does not exist, this request will return an error @param note [Note, Hash] Either object of the Note type or Hash. This object's attributes describe the object to be updated. @return [Note] The resulting object represting updated resource.
[ "Update", "a", "note" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/notes_service.rb#L91-L100
19,886
basecrm/basecrm-ruby
lib/basecrm/services/sources_service.rb
BaseCRM.SourcesService.create
def create(source) validate_type!(source) attributes = sanitize(source) _, _, root = @client.post("/sources", attributes) Source.new(root[:data]) end
ruby
def create(source) validate_type!(source) attributes = sanitize(source) _, _, root = @client.post("/sources", attributes) Source.new(root[:data]) end
[ "def", "create", "(", "source", ")", "validate_type!", "(", "source", ")", "attributes", "=", "sanitize", "(", "source", ")", "_", ",", "_", ",", "root", "=", "@client", ".", "post", "(", "\"/sources\"", ",", "attributes", ")", "Source", ".", "new", "(...
Create a source post '/sources' Creates a new source <figure class="notice"> Source's name **must** be unique </figure> @param source [Source, Hash] Either object of the Source type or Hash. This object's attributes describe the object to be created. @return [Source] The resulting object represting created re...
[ "Create", "a", "source" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/sources_service.rb#L52-L59
19,887
basecrm/basecrm-ruby
lib/basecrm/services/orders_service.rb
BaseCRM.OrdersService.create
def create(order) validate_type!(order) attributes = sanitize(order) _, _, root = @client.post("/orders", attributes) Order.new(root[:data]) end
ruby
def create(order) validate_type!(order) attributes = sanitize(order) _, _, root = @client.post("/orders", attributes) Order.new(root[:data]) end
[ "def", "create", "(", "order", ")", "validate_type!", "(", "order", ")", "attributes", "=", "sanitize", "(", "order", ")", "_", ",", "_", ",", "root", "=", "@client", ".", "post", "(", "\"/orders\"", ",", "attributes", ")", "Order", ".", "new", "(", ...
Create an order post '/orders' Create a new order for a deal User needs to have access to the deal to create an order Each deal can have at most one order and error is returned when attempting to create more @param order [Order, Hash] Either object of the Order type or Hash. This object's attributes describe th...
[ "Create", "an", "order" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/orders_service.rb#L51-L58
19,888
basecrm/basecrm-ruby
lib/basecrm/services/orders_service.rb
BaseCRM.OrdersService.update
def update(order) validate_type!(order) params = extract_params!(order, :id) id = params[:id] attributes = sanitize(order) _, _, root = @client.put("/orders/#{id}", attributes) Order.new(root[:data]) end
ruby
def update(order) validate_type!(order) params = extract_params!(order, :id) id = params[:id] attributes = sanitize(order) _, _, root = @client.put("/orders/#{id}", attributes) Order.new(root[:data]) end
[ "def", "update", "(", "order", ")", "validate_type!", "(", "order", ")", "params", "=", "extract_params!", "(", "order", ",", ":id", ")", "id", "=", "params", "[", ":id", "]", "attributes", "=", "sanitize", "(", "order", ")", "_", ",", "_", ",", "roo...
Update an order put '/orders/{id}' Updates order information If the specified order does not exist, the request will return an error @param order [Order, Hash] Either object of the Order type or Hash. This object's attributes describe the object to be updated. @return [Order] The resulting object represting upd...
[ "Update", "an", "order" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/orders_service.rb#L86-L95
19,889
basecrm/basecrm-ruby
lib/basecrm/services/leads_service.rb
BaseCRM.LeadsService.create
def create(lead) validate_type!(lead) attributes = sanitize(lead) _, _, root = @client.post("/leads", attributes) Lead.new(root[:data]) end
ruby
def create(lead) validate_type!(lead) attributes = sanitize(lead) _, _, root = @client.post("/leads", attributes) Lead.new(root[:data]) end
[ "def", "create", "(", "lead", ")", "validate_type!", "(", "lead", ")", "attributes", "=", "sanitize", "(", "lead", ")", "_", ",", "_", ",", "root", "=", "@client", ".", "post", "(", "\"/leads\"", ",", "attributes", ")", "Lead", ".", "new", "(", "root...
Create a lead post '/leads' Creates a new lead A lead may represent a single individual or an organization @param lead [Lead, Hash] Either object of the Lead type or Hash. This object's attributes describe the object to be created. @return [Lead] The resulting object represting created resource.
[ "Create", "a", "lead" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/leads_service.rb#L59-L66
19,890
basecrm/basecrm-ruby
lib/basecrm/services/leads_service.rb
BaseCRM.LeadsService.update
def update(lead) validate_type!(lead) params = extract_params!(lead, :id) id = params[:id] attributes = sanitize(lead) _, _, root = @client.put("/leads/#{id}", attributes) Lead.new(root[:data]) end
ruby
def update(lead) validate_type!(lead) params = extract_params!(lead, :id) id = params[:id] attributes = sanitize(lead) _, _, root = @client.put("/leads/#{id}", attributes) Lead.new(root[:data]) end
[ "def", "update", "(", "lead", ")", "validate_type!", "(", "lead", ")", "params", "=", "extract_params!", "(", "lead", ",", ":id", ")", "id", "=", "params", "[", ":id", "]", "attributes", "=", "sanitize", "(", "lead", ")", "_", ",", "_", ",", "root", ...
Update a lead put '/leads/{id}' Updates lead information If the specified lead does not exist, this query returns an error <figure class="notice"> In order to modify tags, you need to supply the entire set of tags `tags` are replaced every time they are used in a request </figure> @param lead [Lead, Hash] Ei...
[ "Update", "a", "lead" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/leads_service.rb#L98-L107
19,891
basecrm/basecrm-ruby
lib/basecrm/services/deals_service.rb
BaseCRM.DealsService.create
def create(deal) validate_type!(deal) attributes = sanitize(deal) _, _, root = @client.post("/deals", attributes) Deal.new(root[:data]) end
ruby
def create(deal) validate_type!(deal) attributes = sanitize(deal) _, _, root = @client.post("/deals", attributes) Deal.new(root[:data]) end
[ "def", "create", "(", "deal", ")", "validate_type!", "(", "deal", ")", "attributes", "=", "sanitize", "(", "deal", ")", "_", ",", "_", ",", "root", "=", "@client", ".", "post", "(", "\"/deals\"", ",", "attributes", ")", "Deal", ".", "new", "(", "root...
Create a deal post '/deals' Create a new deal @param deal [Deal, Hash] Either object of the Deal type or Hash. This object's attributes describe the object to be created. @return [Deal] The resulting object represting created resource.
[ "Create", "a", "deal" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/deals_service.rb#L56-L63
19,892
basecrm/basecrm-ruby
lib/basecrm/services/deals_service.rb
BaseCRM.DealsService.update
def update(deal) validate_type!(deal) params = extract_params!(deal, :id) id = params[:id] attributes = sanitize(deal) _, _, root = @client.put("/deals/#{id}", attributes) Deal.new(root[:data]) end
ruby
def update(deal) validate_type!(deal) params = extract_params!(deal, :id) id = params[:id] attributes = sanitize(deal) _, _, root = @client.put("/deals/#{id}", attributes) Deal.new(root[:data]) end
[ "def", "update", "(", "deal", ")", "validate_type!", "(", "deal", ")", "params", "=", "extract_params!", "(", "deal", ",", ":id", ")", "id", "=", "params", "[", ":id", "]", "attributes", "=", "sanitize", "(", "deal", ")", "_", ",", "_", ",", "root", ...
Update a deal put '/deals/{id}' Updates deal information If the specified deal does not exist, the request will return an error <figure class="notice"> In order to modify tags used on a record, you need to supply the entire set `tags` are replaced every time they are used in a request </figure> @param deal [...
[ "Update", "a", "deal" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/deals_service.rb#L95-L104
19,893
basecrm/basecrm-ruby
lib/basecrm/services/line_items_service.rb
BaseCRM.LineItemsService.where
def where(order_id, options = {}) _, _, root = @client.get("/orders/#{order_id}/line_items", options) root[:items].map{ |item| LineItem.new(item[:data]) } end
ruby
def where(order_id, options = {}) _, _, root = @client.get("/orders/#{order_id}/line_items", options) root[:items].map{ |item| LineItem.new(item[:data]) } end
[ "def", "where", "(", "order_id", ",", "options", "=", "{", "}", ")", "_", ",", "_", ",", "root", "=", "@client", ".", "get", "(", "\"/orders/#{order_id}/line_items\"", ",", "options", ")", "root", "[", ":items", "]", ".", "map", "{", "|", "item", "|"...
Retrieve order's line items get '/orders/{order_id}/line_items' Returns all line items associated to order @param order_id [Integer] Unique identifier of a Order @param options [Hash] Search options @option options [String] :ids Comma-separated list of line item IDs to be returned in a request. @option options...
[ "Retrieve", "order", "s", "line", "items" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/line_items_service.rb#L36-L40
19,894
basecrm/basecrm-ruby
lib/basecrm/services/line_items_service.rb
BaseCRM.LineItemsService.create
def create(order_id, line_item) validate_type!(line_item) attributes = sanitize(line_item) _, _, root = @client.post("/orders/#{order_id}/line_items", attributes) LineItem.new(root[:data]) end
ruby
def create(order_id, line_item) validate_type!(line_item) attributes = sanitize(line_item) _, _, root = @client.post("/orders/#{order_id}/line_items", attributes) LineItem.new(root[:data]) end
[ "def", "create", "(", "order_id", ",", "line_item", ")", "validate_type!", "(", "line_item", ")", "attributes", "=", "sanitize", "(", "line_item", ")", "_", ",", "_", ",", "root", "=", "@client", ".", "post", "(", "\"/orders/#{order_id}/line_items\"", ",", "...
Create a line item post '/orders/{order_id}/line_items' Adds a new line item to an existing order Line items correspond to products in the catalog, so first you must create products Because products allow defining different prices in different currencies, when creating a line item, the parameter currency is requi...
[ "Create", "a", "line", "item" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/line_items_service.rb#L54-L61
19,895
basecrm/basecrm-ruby
lib/basecrm/services/line_items_service.rb
BaseCRM.LineItemsService.find
def find(order_id, id) _, _, root = @client.get("/orders/#{order_id}/line_items/#{id}") LineItem.new(root[:data]) end
ruby
def find(order_id, id) _, _, root = @client.get("/orders/#{order_id}/line_items/#{id}") LineItem.new(root[:data]) end
[ "def", "find", "(", "order_id", ",", "id", ")", "_", ",", "_", ",", "root", "=", "@client", ".", "get", "(", "\"/orders/#{order_id}/line_items/#{id}\"", ")", "LineItem", ".", "new", "(", "root", "[", ":data", "]", ")", "end" ]
Retrieve a single line item get '/orders/{order_id}/line_items/{id}' Returns a single line item of an order, according to the unique line item ID provided @param order_id [Integer] Unique identifier of a Order @param id [Integer] Unique identifier of a LineItem @return [LineItem] Searched resource object.
[ "Retrieve", "a", "single", "line", "item" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/line_items_service.rb#L73-L77
19,896
basecrm/basecrm-ruby
lib/basecrm/services/products_service.rb
BaseCRM.ProductsService.create
def create(product) validate_type!(product) attributes = sanitize(product) _, _, root = @client.post("/products", attributes) Product.new(root[:data]) end
ruby
def create(product) validate_type!(product) attributes = sanitize(product) _, _, root = @client.post("/products", attributes) Product.new(root[:data]) end
[ "def", "create", "(", "product", ")", "validate_type!", "(", "product", ")", "attributes", "=", "sanitize", "(", "product", ")", "_", ",", "_", ",", "root", "=", "@client", ".", "post", "(", "\"/products\"", ",", "attributes", ")", "Product", ".", "new",...
Create a product post '/products' Create a new product @param product [Product, Hash] Either object of the Product type or Hash. This object's attributes describe the object to be created. @return [Product] The resulting object represting created resource.
[ "Create", "a", "product" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/products_service.rb#L53-L60
19,897
basecrm/basecrm-ruby
lib/basecrm/services/products_service.rb
BaseCRM.ProductsService.update
def update(product) validate_type!(product) params = extract_params!(product, :id) id = params[:id] attributes = sanitize(product) _, _, root = @client.put("/products/#{id}", attributes) Product.new(root[:data]) end
ruby
def update(product) validate_type!(product) params = extract_params!(product, :id) id = params[:id] attributes = sanitize(product) _, _, root = @client.put("/products/#{id}", attributes) Product.new(root[:data]) end
[ "def", "update", "(", "product", ")", "validate_type!", "(", "product", ")", "params", "=", "extract_params!", "(", "product", ",", ":id", ")", "id", "=", "params", "[", ":id", "]", "attributes", "=", "sanitize", "(", "product", ")", "_", ",", "_", ","...
Update a product put '/products/{id}' Updates product information If the specified product does not exist, the request will return an error <figure class="notice"><p>In order to modify prices used on a record, you need to supply the entire set <code>prices</code> are replaced every time they are used in a reques...
[ "Update", "a", "product" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/products_service.rb#L91-L100
19,898
basecrm/basecrm-ruby
lib/basecrm/services/deal_unqualified_reasons_service.rb
BaseCRM.DealUnqualifiedReasonsService.where
def where(options = {}) _, _, root = @client.get("/deal_unqualified_reasons", options) root[:items].map{ |item| DealUnqualifiedReason.new(item[:data]) } end
ruby
def where(options = {}) _, _, root = @client.get("/deal_unqualified_reasons", options) root[:items].map{ |item| DealUnqualifiedReason.new(item[:data]) } end
[ "def", "where", "(", "options", "=", "{", "}", ")", "_", ",", "_", ",", "root", "=", "@client", ".", "get", "(", "\"/deal_unqualified_reasons\"", ",", "options", ")", "root", "[", ":items", "]", ".", "map", "{", "|", "item", "|", "DealUnqualifiedReason...
Retrieve all deal unqualified reasons get '/deal_unqualified_reasons' Returns all deal unqualified reasons available to the user according to the parameters provided @param options [Hash] Search options @option options [String] :ids Comma separated list of deal unqualified reasons unique identifiers to be return...
[ "Retrieve", "all", "deal", "unqualified", "reasons" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/deal_unqualified_reasons_service.rb#L34-L38
19,899
basecrm/basecrm-ruby
lib/basecrm/services/deal_unqualified_reasons_service.rb
BaseCRM.DealUnqualifiedReasonsService.create
def create(deal_unqualified_reason) validate_type!(deal_unqualified_reason) attributes = sanitize(deal_unqualified_reason) _, _, root = @client.post("/deal_unqualified_reasons", attributes) DealUnqualifiedReason.new(root[:data]) end
ruby
def create(deal_unqualified_reason) validate_type!(deal_unqualified_reason) attributes = sanitize(deal_unqualified_reason) _, _, root = @client.post("/deal_unqualified_reasons", attributes) DealUnqualifiedReason.new(root[:data]) end
[ "def", "create", "(", "deal_unqualified_reason", ")", "validate_type!", "(", "deal_unqualified_reason", ")", "attributes", "=", "sanitize", "(", "deal_unqualified_reason", ")", "_", ",", "_", ",", "root", "=", "@client", ".", "post", "(", "\"/deal_unqualified_reason...
Create a deal unqualified reason post '/deal_unqualified_reasons' Create a new deal unqualified reason <figure class="notice"> Deal unqualified reason's name **must** be unique </figure> @param deal_unqualified_reason [DealUnqualifiedReason, Hash] Either object of the DealUnqualifiedReason type or Hash. This o...
[ "Create", "a", "deal", "unqualified", "reason" ]
c39ea72477d41c3122805d49587043399ee454ea
https://github.com/basecrm/basecrm-ruby/blob/c39ea72477d41c3122805d49587043399ee454ea/lib/basecrm/services/deal_unqualified_reasons_service.rb#L52-L59