query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Same as defining a structure block, but with no attributes besides relationships (such as in a manytomany) | def no_structure
structure {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def structure(name, &block)\n if existing = @base.structures.select { |s| s.name == name }.first\n structure = existing\n else\n structure = Moonrope::Structure.new(@base, name)\n @base.structures << structure\n end\n structure.dsl.instance_eval(&block) if blo... | [
"0.6523887",
"0.62286806",
"0.62286806",
"0.60197866",
"0.5778948",
"0.5758897",
"0.57343125",
"0.5664925",
"0.56506187",
"0.56104726",
"0.55098844",
"0.54686576",
"0.54533803",
"0.5437469",
"0.5437469",
"0.540584",
"0.54001445",
"0.5363214",
"0.53423434",
"0.5316378",
"0.530... | 0.5946359 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_car_seat
@car_seat = CarSeat.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def car_seat_params
params.require(:car_seat).permit(:car_model_id, :sportseat, :seatmaterial, :seatheightadjustment, :driverseatadjustmentmode, :auxiliaryseatadjustmentmode, :driverseatlumbarsupportadjustment, :driverseatshouldersupportadjustment, :frontseatheadrestadjustment, :rearseatadjustmentmode, :rearseatreclineproportion, :rearseatangleadjustment, :frontseatcenterarmrest, :rearseatcenterarmrest, :seatventilation, :seatheating, :seatmassage, :electricseatmemory, :childseatfixdevice, :thirdrowseat)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
build a gable roof porch | def build_gr(entities,r,t)
gr_group = entities.add_group
origin = Geom::Point3d.new(0,0,0)
v1 = Geom::Vector3d.new($gr_width/2,0,0)
v2 = Geom::Vector3d.new(0,0,$gr_width*$gr_pitch/12)
v3 = Geom::Vector3d.new(0, $gr_length,0)
f1 = gr_group.entities.add_face(origin,origin-v3,origin-v3+v2+v1,origin+v2+v1)
f1.material = $roofColor
f2 = gr_group.entities.add_face(origin-v3+v2+v1,origin+v2+v1, origin+v1+v1, origin+v1+v1-v3)
f2.material = $roofColor
if($gr_wall[1] == 2)
f5 = gr_group.entities.add_face([0,-$gr_length,0],[6, -$gr_length,0],[6, 6-$gr_length,0],[0,6-$gr_length,0])
f5.pushpull $gr_height
f6 = gr_group.entities.add_face([$gr_width,-$gr_length,0],[$gr_width-6, -$gr_length,0],[$gr_width-6, 6-$gr_length,0],[$gr_width,6-$gr_length,0])
f6.pushpull $gr_height
end
if($gr_wall[0] == 1)
f3 = gr_group.entities.add_face([0,0,0],[0,0,-$gr_height],[0,-$gr_length, -$gr_height],[0, -$gr_length,0])
f3.material = $wallColor
end
if($gr_wall[2] == 1)
f3 = gr_group.entities.add_face([$gr_width,0,0],[$gr_width,0,-$gr_height],[$gr_width,-$gr_length, -$gr_height],[$gr_width, -$gr_length,0])
f3.material = $wallColor
end
entities.transform_entities r, gr_group
entities.transform_entities t, gr_group
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_rooks\n self[[0,0]] = SlidingPiece.new([0,0], :black, \"R \")\n self[[0,7]] = SlidingPiece.new([0,7], :black, \"R \")\n self[[7,0]] = SlidingPiece.new([7,0], :white, \"R \")\n self[[7,7]] = SlidingPiece.new([7,7], :white, \"R \")\n end",
"def make_room max_w,max_h\n\t{\n\t\tx: rand(@grid_w -... | [
"0.6354594",
"0.5781628",
"0.5752095",
"0.5700253",
"0.5664831",
"0.56490976",
"0.5595787",
"0.5559825",
"0.55082494",
"0.55057144",
"0.54815394",
"0.5457765",
"0.5420635",
"0.53916895",
"0.5374106",
"0.535739",
"0.5341124",
"0.5339041",
"0.5324495",
"0.5281059",
"0.52662855"... | 0.5013272 | 74 |
buid and then move gable roof porch | def create_gr(entities)
if($gr_side == "SW1")
r = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 360.degrees
t = Geom::Transformation.new [$gr_offset,0,$gr_height]
build_gr(entities,r,t)
end
if($gr_side == "SW2")
r = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 180.degrees
t = Geom::Transformation.new [$length-$gr_offset,$width,$gr_height]
build_gr(entities,r,t)
end
if($gr_side == "EW1")
r = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 270.degrees
t = Geom::Transformation.new [0,$width-$gr_offset,$gr_height]
build_gr(entities,r,t)
end
if($gr_side == "EW2")
r = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 90.degrees
t = Geom::Transformation.new [$length,$gr_offset,$gr_height]
build_gr(entities,r,t)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def position_for_next_harvest()\n turn_right()\n move()\n turn_right()\n end",
"def move_grue(direction)\n next_grue_room = @grue_room.door_destination(direction)\n\n @grue_room.move_grue_from\n @grue_room = get_room_by_name(next_grue_room)\n @grue_room.move_grue_to\n ... | [
"0.6974971",
"0.696928",
"0.69300437",
"0.69300437",
"0.69243485",
"0.69243485",
"0.6862953",
"0.6851237",
"0.67749286",
"0.67503613",
"0.674247",
"0.6709658",
"0.6690329",
"0.6687613",
"0.6668253",
"0.6660968",
"0.66357386",
"0.6634525",
"0.6631319",
"0.659654",
"0.6551682",... | 0.0 | -1 |
create_gr here build lean to | def build_lean(entities,r,t)
lean_group = entities.add_group
lean_group.entities.add_dimension_linear([0,0,0],[0,$lean_length,0], [-30,0,0]).arrow_type = Sketchup::Dimension::ARROW_SLASH
lean_group.entities.add_dimension_linear([0,0,0],[$lean_width,0,0], [0,-60,0]).arrow_type = Sketchup::Dimension::ARROW_SLASH
lean_group.entities.add_text("Lean-to", [$lean_width/2,$lean_length/2,-2])
o = Geom::Point3d.new(-$lean_overjet,-$lean_overhang,$lean_height-$lean_overhang*$lean_pitch/12)
h = Geom::Vector3d.new(0,$lean_length+$lean_overhang, ($lean_length+$lean_overhang)*$lean_pitch/12)
f = Geom::Vector3d.new(0,0,$facia)
v = Geom::Vector3d.new($lean_width+2*$lean_overjet,0,0)
p1 = o
p2 = o + v
p3 = o + v + h
p4 = o + h
p5 = o + f
p6 = o + f + v
p7 = o + f + v + h
p8 = o + f + h
lean_group.entities.add_face(p5,p6,p7,p8).material = $roofColor
lean_group.entities.add_face(p1,p4,p8,p5).material = $faciaColor
lean_group.entities.add_face(p2,p3,p7,p6).material = $faciaColor
lean_group.entities.add_face(p1,p2,p6,p5).material = $faciaColor
lean_group.entities.add_face(p1,p2,p3,p4)
lean_group.entities.add_cline([-$lean_overjet,-$lean_overhang,0],[$lean_width+$lean_overjet,-$lean_overhang,0])
lean_group.entities.add_cline([$lean_width+$lean_overjet,-$lean_overhang,0],[$lean_width+$lean_overjet,$lean_length,0])
lean_group.entities.add_cline([-$lean_overjet,-$lean_overhang,0],[-$lean_overjet,$lean_length,0])
if($lean_wall[0] == 1)
pl1 = [$lean_width, 0, 0]
pl2 = [$lean_width, $lean_length,0]
pl3 = [$lean_width,$lean_length,$lean_height+$lean_length*$lean_pitch/12]
pl4 = [$lean_width,0,$lean_height]
lean_group.entities.add_face(pl1,pl2,pl3,pl4).material = $wallColor
end
if($lean_wall[1] == 1)
pm1 = [$lean_width,0,0]
pm2 = [0,0,0]
pm3 = [0,0,$lean_height]
pm4 = [$lean_width,0,$lean_height]
a = lean_group.entities.add_face(pm1,pm2,pm3,pm4)
a.back_material = $wallColor
a.material = $wallColor
end
p = 6
if($lean_wall[1] >= 2)
c = 7
#$lean_width = $lean_width-2*$lean_overhang
lean_group.entities.add_face([0,$lean_length,0],[0,0,0],[$lean_width,0,0],[$lean_width,$lean_length,0],[$lean_width-c,$lean_length,0],[$lean_width-c,c,0],[c,c,0],[c,$lean_length,0],[0,$lean_length,0]).pushpull -3
lean_group.entities.add_line([0,$lean_length,0],[c,$lean_length,0]).faces[0].erase!
n = $lean_wall[1]
# entities.add_face([0,0,0,],[0,p,0],[p,p,0],[p,0,0]).pushpull -$lean_height-$facia
# entities.add_face([$lean_width,0,0],[$lean_width,p,0],[$lean_width-p,p,0],[$lean_width-p,0,0])
d = ($lean_width - p*n)/(n-2+1)
for i in 0..n-1
a = lean_group.entities.add_face([i*(p+d),0,0,],[i*(p+d),p,0],[i*(p+d)+p,p,0],[i*(p+d)+p,0,0])
end
d = $lean_width/(n-1)
if n>2
for i in 0..n-2
lean_group.entities.add_dimension_linear([i*d,0,0],[(i+1)*d,0,0], [0,-30,0]).arrow_type = Sketchup::Dimension::ARROW_SLASH
end
end
end
if($lean_wall[2] == 1)
pr1 = [0,0,0]
pr2 = [0,$lean_length,0]
pr3 = [0,$lean_length,$lean_height+$lean_length*$lean_pitch/12]
pr4 = [0,0,$lean_height]
lean_group.entities.add_face(pr1,pr2,pr3,pr4).back_material = $wallColor
end
entities.transform_entities r, lean_group
entities.transform_entities t, lean_group
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_gr(entities)\n\tif($gr_side == \"SW1\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 360.degrees\n\t\tt = Geom::Transformation.new [$gr_offset,0,$gr_height]\n\t\tbuild_gr(entities,r,t)\n\tend\n\tif($gr_side == \"SW2\")\n\t\tr = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 180.degrees\... | [
"0.6889002",
"0.64691114",
"0.6070615",
"0.5987288",
"0.5987288",
"0.5930228",
"0.58209604",
"0.58209604",
"0.57958984",
"0.5751213",
"0.5704248",
"0.5702218",
"0.56889445",
"0.5668715",
"0.5663841",
"0.566208",
"0.5626885",
"0.56018114",
"0.56017745",
"0.5522825",
"0.546196"... | 0.58847266 | 6 |
build and move lean to | def create_lean(entities)
if($lean_height > 0)
if($lean_side == "SW1")
r = Geom::Transformation.rotation [0,0,0],[0,0,1],360.degrees
t = Geom::Transformation.new [$lean_offset,-$lean_length,0]
build_lean(entities, r, t)
end
if($lean_side == "SW2")
r = Geom::Transformation.rotation [0,0,0],[0,0,1],180.degrees
t = Geom::Transformation.new [$length-$lean_offset,+$width+$lean_length,0]
build_lean(entities, r, t)
end
if($lean_side == "EW1")
r = Geom::Transformation.rotation [0,0,0],[0,0,1],270.degrees
t = Geom::Transformation.new [-$lean_length,+$width-$lean_offset,0]
build_lean(entities, r, t)
end
if($lean_side == "EW2")
r = Geom::Transformation.rotation [0,0,0],[0,0,1],90.degrees
t = Geom::Transformation.new [$length+$lean_length,$lean_offset,0]
build_lean(entities, r, t)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build\n cd_and_sh( pkg_dir, build_commands )\n end",
"def prep_build\n stdout.out_success(\"\\nPreparing build dir at: '#{settings['build_dir']}'\")\n stdout.verbose(\"Removing build dir at: #{settings['build_dir']}\")\n FileUtils.rm_rf(settings['build_dir'])\n # create the build dir\n ... | [
"0.634293",
"0.63083297",
"0.62256676",
"0.60302633",
"0.59844935",
"0.59618795",
"0.59475106",
"0.59402823",
"0.5935131",
"0.58598554",
"0.5839795",
"0.581325",
"0.5798213",
"0.57734096",
"0.57610893",
"0.576103",
"0.57606065",
"0.57559466",
"0.5743505",
"0.5731001",
"0.5729... | 0.0 | -1 |
build hydraulic and move | def create_hydraulic(entities)
# r = Geom::Transformation.rotation [$porch_width/2, 0, 0], [0,0,1], 180.degrees
# t = Geom::Transformation.new [$porch_offset,0, $porch_height]
# entities.transform_entities r, porch_group
# entities.transform_entities t, porch_group
if($hydraulic_side == "SW1")
r = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 360.degrees
t = Geom::Transformation.new [$hydraulic_offset+$hydraulic_width,0, -6]
build_hydraulic(entities,r,t)
end
if($hydraulic_side == "SW2")
r = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 180.degrees
t = Geom::Transformation.new [$length-$hydraulic_offset-$hydraulic_width,$width, -6]
build_hydraulic(entities,r,t)
end
if($hydraulic_side == "EW2")
r = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 90.degrees
t = Geom::Transformation.new [$length,$hydraulic_offset+$hydraulic_width, -6]
build_hydraulic(entities,r,t)
end
if($hydraulic_side == "EW1")
r = Geom::Transformation.rotation [0, 0, 0], [0,0,1], 270.degrees
t = Geom::Transformation.new [0,$width-$hydraulic_offset-$hydraulic_width, -6]
build_hydraulic(entities,r,t)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n @hydra.run\n end",
"def run\n @hydra.run\n end",
"def hydra\n if !@hydra\n @hydra = Typhoeus::Hydra.hydra\n end\n @hydra\n end",
"def install_engine\n generate 'hydra:head -f'\n end",
"def build\n raise FedoraMigrate::Errors::MigrationError, \"No qual... | [
"0.63316333",
"0.6155988",
"0.6005338",
"0.5945435",
"0.58963287",
"0.5760178",
"0.57461554",
"0.56874657",
"0.56812304",
"0.5663725",
"0.55958456",
"0.55528474",
"0.5534801",
"0.5523696",
"0.55129987",
"0.5462892",
"0.5458901",
"0.5413829",
"0.5402599",
"0.5371124",
"0.53470... | 0.61209726 | 2 |
slide_data.each do |slide| $slide_width = slide[0] $slide_height = slide[1] $slide_thickness = slide[2] $slide_wainscot = slide[3] $slide_type = slide[4] $slide_side = slide[5] $slide_offset = slide[6] $slide_color = slide[7] $slide_wainscotcolor = slide[8] $track_color = slide[9] create_slide_door(entities) end | def interior_steel(entities)
#draw_rectangle("EW1",70*12, 14*12+8, 20*12, entities)
if($interior_steel != "")
if($oh1 >= $oh2)
a = entities.add_line([0,0,$height],[0,$width,$height])
b = entities.add_line([0,0,$height],[0,0,$height1])
a.faces[0].back_material = $interior_steel
# if($oh1 <= $oh2)
# else
# a.faces[1].back_material = $interior_steel
# end
#entities.add_line([$length,0,$height],[$length,0,$height1])
f = entities.add_line([$length,0,$height],[$length,0,$height1])
e = entities.add_line([$length,0,$height],[$length,$width,$height])
e.faces[1].back_material = $interior_steel
entities.add_line([0,0,$height],[$length,0,$height])
d = entities.add_line([$corner,0,$height1],[$length-$corner, 0, $height1])
d.find_faces
d.faces[0].back_material = $interior_steel
d.faces[2].back_material = $interior_steel
if($height1 == $height2)
d.faces[2].erase!
end
c = entities.add_line([$corner,$width,$height2],[$length-$corner,$width,$height2])
c.faces[0].back_material = $interior_steel
end
if($oh1 < $oh2)
a = entities.add_line([0,0,$height],[0,$width,$height])
b = entities.add_line([0,$width,$height],[0,$width,$height2])
a.faces[0].back_material = $interior_steel
# if($oh1 <= $oh2)
# else
# a.faces[1].back_material = $interior_steel
# end
#entities.add_line([$length,0,$height],[$length,0,$height1])
f = entities.add_line([$length,$width,$height],[$length,$width,$height2])
e = entities.add_line([$length,0,$height],[$length,$width,$height])
e.faces[1].back_material = $interior_steel
entities.add_line([0,0,$height],[$length,0,$height])
d = entities.add_line([$corner,0,$height1],[$length-$corner, 0, $height1])
d.find_faces
d.faces[1].back_material = $interior_steel
d.faces[0].back_material = $interior_steel
#d.faces[2].back_material = $interior_steel
if($height1 == $height2)
d.faces[2].erase!
end
c = entities.add_line([$corner,$width,$height2],[$length-$corner,$width,$height2])
c.faces[0].back_material = $interior_steel
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n #@deck = Powerpoint::Presentation.new\n # Creating an introduction slide:\n # title = 'Bicycle Of the Mind'\n # subtitle = 'created by Steve Jobs'\n # @deck.add_intro title, subtitle\n\n # Creating a text-only slide:\n # Title must be a string.\n # Content must be an array of st... | [
"0.56264323",
"0.5537628",
"0.5499458",
"0.5494283",
"0.54865897",
"0.5468836",
"0.54459476",
"0.5443129",
"0.53674376",
"0.5361608",
"0.531582",
"0.530355",
"0.52933854",
"0.529307",
"0.5272554",
"0.5244953",
"0.5215592",
"0.52049714",
"0.51958513",
"0.51925784",
"0.51759756... | 0.0 | -1 |
Valid coordinates to moves to follow a simple calculation added to the puzzle input. It is then convered to binary, if this value contains an even number of 1s then the move is valid | def valid(x, y)
return false if x < 0 || y < 0
i = x*x + 3*x + 2*x*y + y + y*y + $input
i.to_s(2).chars.count{|z| z == '1'}.even?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_move?(board, position)\n position = position.to_i - 1\n if position_taken?(board, position) == false && position.to_i.between?(0, 8)\n return true\nelsif position_taken?(board, position) == true\n return false\nelse \n return false\nend\nend",
"def valid_move?(board, input)\n position = (input.to_... | [
"0.6610477",
"0.6495825",
"0.6483554",
"0.64672565",
"0.6467207",
"0.6446322",
"0.6432521",
"0.64227796",
"0.6411345",
"0.6408603",
"0.6382389",
"0.6356111",
"0.6354934",
"0.6344821",
"0.6340223",
"0.6334255",
"0.6333621",
"0.6317347",
"0.6315776",
"0.62930256",
"0.62906605",... | 0.0 | -1 |
The node is a unique state within the system e.g. x,y coordinate | def node
[@x, @y]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xy\n state[\"xy\"]\n end",
"def node(x, y)\n @nodes[y][x]\n end",
"def xy=(value); self.state = { :xy => value }; end",
"def position\n @state[\"position\"]\n end",
"def get_next_state(matrix,x2,y2)\r\n if 1==matrix[[@x+x2,@y+y2]].state\r\n @live_neighbor=@live_neighbor.to_i... | [
"0.6662758",
"0.66491944",
"0.6284175",
"0.60998195",
"0.6007405",
"0.59857213",
"0.59740645",
"0.59740645",
"0.59740645",
"0.59740645",
"0.59740645",
"0.59740645",
"0.59740645",
"0.59740645",
"0.59740645",
"0.59740645",
"0.59740645",
"0.59740645",
"0.59740645",
"0.59740645",
... | 0.64549035 | 2 |
Move the specified amount and return a new object | def move(x, y)
State.new(@x + x, @y + y, @distance + 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move(accountid, moveto, amount, confirms = 6)\n raise # TODO\n end",
"def move\n move_by a, m\n end",
"def move_x amount\n\n # Do the full movement.\n @x += amount\n\n # Check that we didn't go past the destination\n if amount.positive?\n if @x > @dest_x\n ... | [
"0.65250784",
"0.6459328",
"0.63935006",
"0.63495505",
"0.63173187",
"0.6311894",
"0.63017416",
"0.63017416",
"0.62991357",
"0.62844497",
"0.6075882",
"0.6075882",
"0.6068914",
"0.6035086",
"0.6034744",
"0.603463",
"0.59733987",
"0.5848924",
"0.5835359",
"0.5815925",
"0.58093... | 0.6003187 | 16 |
Given a field and an array of child fields, we need to recurse through them to get the last one | def get_child_entity_from_path_by(field, children)
# the next child in the path
child_value = children.shift
# get the child entity
child = self.send(:children).find {|child| child.send(field) == child_value}
if child && children.size > 0
# we have some recursion to do - we're not at the end of the array
# so call this method again with a smaller set of children
child.get_child_entity_from_path_by(field, children)
else
return child #this is the final thing in the array - return it
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fields_or_build(field)\n unless field.is_a? DelegationField\n field_slug = field.to_s\n field = DelegationField.where(slug: field_slug).first\n return nil if field.nil?\n end\n field_values = get_fields(field)\n if field_values.empty?\n field_values = [self.fields.build(dele... | [
"0.59080845",
"0.56681645",
"0.54430634",
"0.5370381",
"0.5351737",
"0.5320911",
"0.5302727",
"0.5220414",
"0.52140176",
"0.5203989",
"0.5203787",
"0.51899236",
"0.5187229",
"0.5157163",
"0.5131079",
"0.5122954",
"0.5122617",
"0.51044697",
"0.5096488",
"0.5095738",
"0.5076473... | 0.62602544 | 0 |
Given a field (and optional delimiter), return a path to the current object. e.g. you'd end up with /path/to/page (where this object is 'page') | def nested_path_by(field, opts = {})
options = {delimiter: "/", prefix: ""}
options.merge!(opts)
delimiter = options[:delimiter]
prefix = options[:prefix].empty? ? "" : "#{options[:prefix]}#{delimiter}"
path = ([self] + ancestors).reverse.collect {|a| a.send(field)}.join(delimiter).gsub(prefix,"")
return delimiter + path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_path *fields\n FieldPath.new(*fields)\n end",
"def path\n position = document.atomic_position\n position.blank? ? field : \"#{position}.#{field}\"\n end",
"def format_path(object)\n object.path.gsub('::', '_')\n end",
"def path\n if value.is... | [
"0.7080905",
"0.6715625",
"0.58925784",
"0.5880446",
"0.5816501",
"0.5636496",
"0.56151146",
"0.56148654",
"0.5562594",
"0.5562594",
"0.5509637",
"0.5509637",
"0.5478027",
"0.54699725",
"0.5450733",
"0.5439551",
"0.539896",
"0.539896",
"0.5393265",
"0.5374846",
"0.53731406",
... | 0.74437016 | 0 |
Checks if the attachment is restricted, because it is attached on restricted pages only | def restricted?
pages.any? && pages.not_restricted.blank?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restricted?\n page.restricted?\n end",
"def attachments_permission\n @attributes[:attachments_permission]\n end",
"def attachments_permission\n @attributes[:attachments_permission]\n end",
"def has_attachments\n preneed_attachments.present?\n end",
"def provision_attachm... | [
"0.676367",
"0.6594543",
"0.6594543",
"0.64621305",
"0.6342594",
"0.62423253",
"0.62423253",
"0.62423253",
"0.62423253",
"0.61780846",
"0.6138564",
"0.6138564",
"0.6138564",
"0.6138564",
"0.61136526",
"0.61136526",
"0.60908794",
"0.60637605",
"0.6049823",
"0.60339993",
"0.599... | 0.63859767 | 6 |
Returns a css class name for kind of file | def icon_css_class
case file_mime_type
when *ARCHIVE_FILE_TYPES
then "archive"
when *AUDIO_FILE_TYPES
then "audio"
when *IMAGE_FILE_TYPES
then "image"
when *VIDEO_FILE_TYPES
then "video"
when "application/x-shockwave-flash"
then "flash"
when "image/x-psd"
then "psd"
when "text/plain"
then "text"
when "application/rtf"
then "rtf"
when "application/pdf"
then "pdf"
when "application/msword"
then "word"
when "application/vnd.ms-excel"
then "excel"
when *VCARD_FILE_TYPES
then "vcard"
else "file"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getStyle(filename)\n DEFAULT_FILE_TYPES.invert[File.extname(filename)]\n end",
"def file_type_class\n self.file_type.downcase.split.join('-') + '-file'\n end",
"def defined_classname filename\r\n script = File.new filename\r\n script.each_line do |line|\r\n if line =~ /class(.*)[<|\\z... | [
"0.7138231",
"0.70957786",
"0.6911482",
"0.6825835",
"0.6763818",
"0.67032063",
"0.66817033",
"0.66719776",
"0.66584134",
"0.6626825",
"0.66194874",
"0.65593463",
"0.6532662",
"0.6524408",
"0.6500964",
"0.64866716",
"0.64494306",
"0.643257",
"0.64283687",
"0.6416402",
"0.6398... | 0.73979926 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_user
@user = User.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def user_params
params.require(:user).permit(:first_name, :last_name, :username, :birthday, :about, :email, :password, :current_password, :remember_me, :avatar, :cover_photo)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Move this to a twitter module | def twitter_connect
access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)
user_info = JSON.parse(access_token.get("https://twitter.com/account/verify_credentials.json").body)
self.login = user_info['screen_name']
self.twitter_name = user_info['name']
self.password = "5uttr33_#{self.login}"
self.signup_source = 'twitter'
self.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def twitter\n handle_oauth\n end",
"def twitter\n callback_from :twitter\n end",
"def link_twitter\n\n end",
"def twitt\n if PLANETOID_CONF[:twitter][:users][:send_twitts]\n twit=Twitter::Base.new(Twitter::HTTPAuth.new(PLANETOID_CONF[:twitter][:user], PLANETOID_CONF[:twitter][:password]))\n ... | [
"0.7305317",
"0.7179668",
"0.70971054",
"0.69408566",
"0.68489665",
"0.67101634",
"0.6556565",
"0.65170765",
"0.6501963",
"0.6448231",
"0.6423704",
"0.64202505",
"0.6397419",
"0.63761497",
"0.63516414",
"0.6241625",
"0.62313473",
"0.6222005",
"0.6210931",
"0.61961675",
"0.619... | 0.6166997 | 23 |
Move this to a facebook module | def before_connect(facebook_session)
self.login = facebook_session.user.name
self.facebook_name = facebook_session.user.name
self.password = "5uttr33_#{self.login}"
self.signup_source = 'facebook'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def facebook\n end",
"def facebook\n\n end",
"def fb_load_api\n\n\n end",
"def facebook\n callback\n end",
"def facebook\n handle_oauth\n end",
"def facebook\n FbConnection\n end",
"def facebook\n handle_auth \"facebook\"\n end",
"def facebook\n @facebook ||= Koala::Facebo... | [
"0.7241867",
"0.7199786",
"0.67367387",
"0.6653006",
"0.65570617",
"0.64523655",
"0.6426226",
"0.61916757",
"0.6089738",
"0.6031665",
"0.59686404",
"0.5952022",
"0.5947099",
"0.59458524",
"0.5929554",
"0.5875273",
"0.5867714",
"0.58623266",
"0.58169484",
"0.5808161",
"0.57953... | 0.5777472 | 21 |
GET /references GET /references.json | def index
@references = @account.references.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def references\n references_hash.to_json\n end",
"def index\n @references = Reference.all\n\n render json: @references\n end",
"def references\n @references ||= ApiFactory.new 'GitData::References'\n end",
"def index\n @references = Reference.all\n end",
"def index\n @referenc... | [
"0.75559896",
"0.7409477",
"0.72816175",
"0.7129962",
"0.7129962",
"0.6839481",
"0.6710343",
"0.66736835",
"0.6607017",
"0.65439403",
"0.6514049",
"0.64994705",
"0.64339525",
"0.64019185",
"0.6378839",
"0.6373114",
"0.6265303",
"0.625604",
"0.625604",
"0.6244192",
"0.62306637... | 0.67257285 | 6 |
GET /references/1 GET /references/1.json | def show
@reference = @account.references.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @references = Reference.all\n\n render json: @references\n end",
"def references\n @references ||= ApiFactory.new 'GitData::References'\n end",
"def references\n references_hash.to_json\n end",
"def index\n @references = Reference.all\n end",
"def index\n @referenc... | [
"0.7289402",
"0.7209014",
"0.70708585",
"0.7068969",
"0.7068969",
"0.6697828",
"0.6539074",
"0.6511298",
"0.6510835",
"0.6493784",
"0.63351184",
"0.63005394",
"0.6247803",
"0.6178562",
"0.6178562",
"0.6102249",
"0.60849243",
"0.60786736",
"0.606717",
"0.6055889",
"0.604911",
... | 0.66037506 | 6 |
GET /references/new GET /references/new.json | def new
@reference = @account.references.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @reference = Reference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference }\n end\n end",
"def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end... | [
"0.7560176",
"0.69466454",
"0.68360513",
"0.67046285",
"0.6702816",
"0.66879934",
"0.6649331",
"0.6632744",
"0.66226864",
"0.65013385",
"0.65010905",
"0.64644486",
"0.63942343",
"0.6278453",
"0.6274386",
"0.6274033",
"0.62692356",
"0.6243434",
"0.6240735",
"0.6225951",
"0.621... | 0.70272243 | 1 |
POST /references POST /references.json | def create
@reference = @account.references.new(params[:reference])
if @reference.save
redirect_to [@account, @reference], notice: 'Reference was successfully created.'
else
render action: "new"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @reference = Reference.new(reference_params)\n\n if @reference.save\n render json: @reference, status: :created, location: @reference\n else\n render json: @reference.errors, status: :unprocessable_entity\n end\n end",
"def create\n @reference = Reference.new(params[:refere... | [
"0.71855813",
"0.6840362",
"0.6758709",
"0.668814",
"0.64029145",
"0.62851226",
"0.62712616",
"0.62236667",
"0.619319",
"0.61857444",
"0.6093365",
"0.6088865",
"0.60819405",
"0.6073952",
"0.6027425",
"0.6009454",
"0.5979176",
"0.59740597",
"0.5955723",
"0.5949086",
"0.5916747... | 0.6675021 | 4 |
PUT /references/1 PUT /references/1.json | def update
@reference = @account.references.find(params[:id])
if @reference.update_attributes(params[:reference])
redirect_to [@account, @reference], notice: 'Reference was successfully updated.'
else
render action: "edit"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @references = args[:references] if args.key?(:references)\n end",
"def update\n @reference = Reference.find(params[:id])\n\n respond_to do |format|\n if @reference.update_attributes(params[:reference])\n format.html { redirect_to @reference, notice: 'Refere... | [
"0.67712003",
"0.659696",
"0.6278232",
"0.62116754",
"0.6200272",
"0.61416805",
"0.61355275",
"0.61160624",
"0.6081065",
"0.60681486",
"0.60579693",
"0.60466444",
"0.60466444",
"0.5948181",
"0.594595",
"0.5943138",
"0.58960086",
"0.5891728",
"0.58345366",
"0.58248174",
"0.582... | 0.6373555 | 2 |
DELETE /references/1 DELETE /references/1.json | def destroy
@reference = @account.references.find(params[:id])
@reference.destroy
redirect_to account_references_url(@account)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @reference = Reference.find(params[:id])\n @reference.destroy\n\n respond_to do |format|\n format.html { redirect_to references_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ref.destroy\n respond_to do |format|\n format.html { redirect_to r... | [
"0.7663956",
"0.7343859",
"0.72768277",
"0.7238109",
"0.71854806",
"0.7066309",
"0.6985104",
"0.69705397",
"0.69513786",
"0.6931926",
"0.6849859",
"0.68201685",
"0.6801177",
"0.6800338",
"0.6785123",
"0.67722946",
"0.67667156",
"0.6757891",
"0.6709282",
"0.6707669",
"0.670645... | 0.6975505 | 7 |
update. >?????? Not sure if i need this. ????????< | def update_user
@user = user.find(params[:id])
@user.update(params[:user])
if @user. valid?
redirect "/users/#{@user.id}"
else
status 422
@errors = @user.errors.full_messages
erb:'users/new'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update ; end",
"def update() end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update\n \t\n end",
"def update\n \t\n end",
"def update\r\n end",
"def update\r\n\r\n ... | [
"0.85042113",
"0.8428573",
"0.8386455",
"0.8386455",
"0.8386455",
"0.8386455",
"0.8386455",
"0.8386455",
"0.8386455",
"0.8386455",
"0.80175626",
"0.80175626",
"0.8002528",
"0.80006397",
"0.79926056",
"0.7982395",
"0.7970802",
"0.796885",
"0.7959984",
"0.79393405",
"0.79393405... | 0.0 | -1 |
GET /internets GET /internets.json | def index
@internets = Internet.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @networkings = Networking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @networkings }\n end\n end",
"def test_get_site_list\r\n endpoint = \"/sites\"\r\n uri = URI(\"#{@host}#{endpoint}\")\r\n request = Net::HTTP::... | [
"0.61471325",
"0.61165494",
"0.60363746",
"0.60363746",
"0.59300953",
"0.5920869",
"0.58244175",
"0.58151627",
"0.5804467",
"0.57917476",
"0.5772945",
"0.5763802",
"0.57162535",
"0.5668736",
"0.5654593",
"0.5649707",
"0.5640878",
"0.5610581",
"0.56096345",
"0.5600866",
"0.559... | 0.71520454 | 0 |
GET /internets/1 GET /internets/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @internets = Internet.all\n end",
"def index\n @networkings = Networking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @networkings }\n end\n end",
"def set_internet\n @internet = Internet.find(params[:id])\n end",
"def ... | [
"0.70718336",
"0.6224669",
"0.6216901",
"0.6133639",
"0.6105625",
"0.6085787",
"0.5920673",
"0.5876168",
"0.58517724",
"0.5742555",
"0.57318646",
"0.570893",
"0.56911224",
"0.56615114",
"0.56615114",
"0.56482905",
"0.56433547",
"0.56433547",
"0.56433547",
"0.5640429",
"0.5630... | 0.0 | -1 |
POST /internets POST /internets.json | def create
@internet = Internet.new(internet_params)
respond_to do |format|
if @internet.save
format.html { redirect_to @internet, notice: 'Internet was successfully created.' }
format.json { render :show, status: :created, location: @internet }
else
format.html { render :new }
format.json { render json: @internet.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @internets = Internet.all\n end",
"def internet_params\n params.require(:internet).permit(:banda, :contrato, :cnpj, :nome)\n end",
"def post_inventories(name,description, organization=1,variables='')\n dprint \"/api/v1/hosts\"\n resp = @rest['/api/v1/hosts'].post({\n :n... | [
"0.6009264",
"0.59840983",
"0.5594287",
"0.5545337",
"0.5446135",
"0.5374118",
"0.5335536",
"0.5175832",
"0.5175655",
"0.51737547",
"0.51425505",
"0.5102705",
"0.5090323",
"0.50758237",
"0.50503325",
"0.5047668",
"0.5027481",
"0.50174975",
"0.5014189",
"0.50128645",
"0.497923... | 0.69433653 | 0 |
PATCH/PUT /internets/1 PATCH/PUT /internets/1.json | def update
respond_to do |format|
if @internet.update(internet_params)
format.html { redirect_to @internet, notice: 'Internet was successfully updated.' }
format.json { render :show, status: :ok, location: @internet }
else
format.html { render :edit }
format.json { render json: @internet.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"def patch!\n request! :patch\n end",
"def put_update(options = {})\n options[:id] ||= @website.id\n options[:websit... | [
"0.66075563",
"0.6107189",
"0.60620934",
"0.59931374",
"0.5962214",
"0.5935094",
"0.59247345",
"0.5882629",
"0.58340967",
"0.58259654",
"0.58022547",
"0.579239",
"0.5791156",
"0.5776272",
"0.5764515",
"0.57546973",
"0.573455",
"0.57310504",
"0.57158035",
"0.57158035",
"0.5693... | 0.65989697 | 1 |
DELETE /internets/1 DELETE /internets/1.json | def destroy
@internet.destroy
respond_to do |format|
format.html { redirect_to internets_url, notice: 'Internet was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @access_internet.destroy\n respond_to do |format|\n format.html { redirect_to access_internets_url, notice: 'Access internet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n delete_from_server single_url\n end",
"def delete\... | [
"0.7133318",
"0.7132496",
"0.70107406",
"0.6983946",
"0.68748295",
"0.6865625",
"0.68331397",
"0.68314385",
"0.6812762",
"0.67787737",
"0.67660373",
"0.6747108",
"0.6721552",
"0.67062354",
"0.6667756",
"0.6652738",
"0.6652738",
"0.6652738",
"0.6652738",
"0.66250277",
"0.66173... | 0.7319332 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_internet
@internet = Internet.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def internet_params
params.require(:internet).permit(:banda, :contrato, :cnpj, :nome)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /admin/restaurants GET /admin/restaurants.json | def index
@admin_restaurants = Admin::Restaurant.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listRestaurants\n _restaurants = Restaurant.all\n render json: _restaurants\n end",
"def index\n @restaurants = Restaurant.all\n # render json: @restaurants\n end",
"def index\n json_response(Restaurant.all)\n end",
"def index\n @restaurants = Restaurant.all\n # @restauran... | [
"0.7925596",
"0.7751788",
"0.771165",
"0.7629712",
"0.745463",
"0.7429853",
"0.73732096",
"0.7348267",
"0.71471953",
"0.7142301",
"0.7142301",
"0.7142301",
"0.7142301",
"0.7142301",
"0.7142301",
"0.7142301",
"0.7108386",
"0.7096301",
"0.70579183",
"0.7035994",
"0.70215636",
... | 0.7559378 | 4 |
GET /admin/restaurants/1 GET /admin/restaurants/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listRestaurants\n _restaurants = Restaurant.all\n render json: _restaurants\n end",
"def index\n @restaurants = Restaurant.all\n # render json: @restaurants\n end",
"def index\n @restaurants = Restaurant.all\n # @restaurants = current_owner.restaurants\n\n respond_to do |format|\n ... | [
"0.7614239",
"0.76137954",
"0.7550007",
"0.75472903",
"0.74081206",
"0.7404448",
"0.7341166",
"0.72243017",
"0.7194612",
"0.7166104",
"0.7166104",
"0.7166104",
"0.71347123",
"0.70109844",
"0.70107186",
"0.70107186",
"0.70107186",
"0.70107186",
"0.70107186",
"0.70107186",
"0.7... | 0.0 | -1 |
POST /admin/restaurants POST /admin/restaurants.json | def create
@admin_restaurant = Admin::Restaurant.new(admin_restaurant_params)
respond_to do |format|
if @admin_restaurant.save
format.html { redirect_to @admin_restaurant, notice: 'Restaurant was successfully created.' }
format.json { render :show, status: :created, location: @admin_restaurant }
else
format.html { render :new }
format.json { render json: @admin_restaurant.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n json_response(Restaurant.create!(restaurant_params), :created)\n end",
"def create\n @restaurant = Restaurant.new(restaurant_params)\n if @restaurant.save\n render json: {success: true, restaurant: @restaurant} \n else\n render json: {success: false, errors: @restauran... | [
"0.7369996",
"0.7160911",
"0.71376413",
"0.6938119",
"0.69327366",
"0.6910166",
"0.6910166",
"0.6910166",
"0.6895149",
"0.6895149",
"0.6895149",
"0.68870723",
"0.6833067",
"0.68267864",
"0.67923766",
"0.67799735",
"0.6750343",
"0.67458135",
"0.6731178",
"0.6726244",
"0.666463... | 0.7427476 | 0 |
PATCH/PUT /admin/restaurants/1 PATCH/PUT /admin/restaurants/1.json | def update
respond_to do |format|
if @admin_restaurant.update(admin_restaurant_params)
format.html { redirect_to @admin_restaurant, notice: 'Restaurant was successfully updated.' }
format.json { render :show, status: :ok, location: @admin_restaurant }
else
format.html { render :edit }
format.json { render json: @admin_restaurant.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n json_response(@restaurant.update!(restaurant_params))\n end",
"def update \n @restaurant = Restaurant.find(params[:id])\n @restaurant.owner_id = current_owner.id\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n # format.html { redi... | [
"0.7251908",
"0.6729797",
"0.6715429",
"0.6670564",
"0.66246164",
"0.66246164",
"0.66246164",
"0.66246164",
"0.65513116",
"0.65513116",
"0.654816",
"0.6507395",
"0.650353",
"0.6469208",
"0.6415895",
"0.6415895",
"0.6415895",
"0.63961005",
"0.63853073",
"0.63785475",
"0.636257... | 0.6990584 | 1 |
DELETE /admin/restaurants/1 DELETE /admin/restaurants/1.json | def destroy
@admin_restaurant.destroy
respond_to do |format|
format.html { redirect_to admin_restaurants_url, notice: 'Restaurant was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n... | [
"0.73669946",
"0.73669946",
"0.73669946",
"0.73669946",
"0.73669946",
"0.73669946",
"0.73669946",
"0.73669946",
"0.7314704",
"0.7306246",
"0.72777504",
"0.72777504",
"0.72777504",
"0.7174789",
"0.71701103",
"0.71401596",
"0.71370363",
"0.7126396",
"0.7086429",
"0.7086429",
"0... | 0.75120753 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_admin_restaurant
@admin_restaurant = Admin::Restaurant.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def admin_restaurant_params
params.require(:admin_restaurant).permit(:name, :description, :address, :phone, :logo)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /reservations GET /reservations.json | def index
@reservations = Reservation.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n render json: reservations\n end",
"def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end",
"def index\n @reservations = Reservation.all\n\n respond_to do |format|\n... | [
"0.80168474",
"0.7786847",
"0.7786847",
"0.7642628",
"0.7595051",
"0.75216544",
"0.73537683",
"0.7279801",
"0.7249016",
"0.72301537",
"0.7209059",
"0.7209059",
"0.7209059",
"0.7209059",
"0.7209059",
"0.7209059",
"0.71926415",
"0.7182939",
"0.71568966",
"0.7123418",
"0.708233"... | 0.77413225 | 17 |
GET /reservations/1 GET /reservations/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n render json: reservations\n end",
"def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end",
"def index\n @reservations = Reservation.all\n\n respond_to do |format|\n... | [
"0.77576584",
"0.74549264",
"0.74549264",
"0.7452395",
"0.74343014",
"0.74343014",
"0.74343014",
"0.74343014",
"0.74343014",
"0.74343014",
"0.74071085",
"0.74071085",
"0.74071085",
"0.74071085",
"0.74071085",
"0.74071085",
"0.74071085",
"0.74071085",
"0.74071085",
"0.74071085",... | 0.0 | -1 |
POST /reservations POST /reservations.json | def create
if current_user.check_reservations
return redirect_back(fallback_location: root_url,alert: "You already have #{Variable.find_by_name("MAX_RESERVATIONS").value} reservations in progress. Please deliver one of these first to make more reservations.")
else
@reservation = Reservation.new(reservation_params)
ending_time = (@reservation.job.duration / Variable.find_by_name("RESERVATION_FACTOR").value.to_f)*24*60*60
@reservation.ending_time = Time.now + ending_time
@reservation.status = "LIVE"
job = @reservation.job
@reservation.amount = @reservation.job.amount
respond_to do |format|
if @reservation.save
@reservation.job.update(status: "RESERVED")
TimerJob.set(wait_until: @reservation.ending_time).perform_later(@reservation,"LIVE")
format.html { redirect_to @reservation, notice: "Job reserved successfully." }
format.json { render :show, status: :created, location: @reservation }
else
format.html { render :new }
format.json { render json: @reservation.errors, status: :unprocessable_entity }
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @reservation = Reservation.new(reservation_params)\n\n if @reservation.save\n render :show, status: :created, location: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end",
"def create_reservations\n Time.use_zone(@timezone) do... | [
"0.719537",
"0.71615386",
"0.71431714",
"0.71431714",
"0.7130943",
"0.7123144",
"0.7095066",
"0.7020095",
"0.6983413",
"0.69494253",
"0.6922912",
"0.6906279",
"0.6906279",
"0.68949294",
"0.68930775",
"0.68813384",
"0.68267894",
"0.680376",
"0.6786492",
"0.6770697",
"0.6745307... | 0.0 | -1 |
PATCH/PUT /reservations/1 PATCH/PUT /reservations/1.json | def update
respond_to do |format|
if @reservation.update(reservation_params)
if params[:reservation][:status] == "LIVE"
# TimerJob.set(wait_until: @reservation.ending_time).perform_later(@reservation,"LIVE")
elsif params[:reservation][:status] == "DELIVERED"
Notif.create(event: "<a href='#{reservation_url(@reservation.slug)}'>Worker has delivered the work of a reservation.</a>",user_id: @reservation.job.user.id)
elsif params[:reservation][:status] == "INREVISION"
Notif.create(event: "<a href='#{reservation_url(@reservation.slug)}'>Employer asked for a Revision.</a>",user_id: @reservation.user.id)
elsif params[:reservation][:status] == "COMPLETED"
PayoutJob.perform_later(@reservation,"COMPLETED")
elsif params[:reservation][:status] == "REJECTED"
PayoutJob.perform_later(@reservation,"REJECTED")
end
format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }
format.json { render :show, status: :ok, location: @reservation }
else
format.html { render :edit }
format.json { render json: @reservation.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @reservation.update(reservation_params)\n render json: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end",
"def update\n @reservation = current_user.reservations.find(params[:id])\n\n respond_to do |format|\n if @reser... | [
"0.7111349",
"0.68773746",
"0.6858809",
"0.6824269",
"0.67877764",
"0.67745304",
"0.67740273",
"0.6718256",
"0.67057306",
"0.67049897",
"0.67049897",
"0.67049897",
"0.67049897",
"0.67049897",
"0.67049897",
"0.67049897",
"0.67049897",
"0.67049897",
"0.67049897",
"0.67049897",
... | 0.0 | -1 |
DELETE /reservations/1 DELETE /reservations/1.json | def destroy
@reservation.destroy
respond_to do |format|
format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n reservation = Reservation.find(params[:id])\n if reservation\n reservation.destroy\n render json: reservation\n else \n render json: [\"Reservation doesnt exist\"], status: 404 \n end \n end",
"def destroy\n @reservation = Reservation.find(params[:id])\n @reservati... | [
"0.7747309",
"0.7607613",
"0.7607613",
"0.7607613",
"0.7607613",
"0.7567083",
"0.7545028",
"0.7545028",
"0.7545028",
"0.74918175",
"0.7434657",
"0.73913974",
"0.73021823",
"0.7298407",
"0.7298407",
"0.7295748",
"0.72883016",
"0.7283948",
"0.7282211",
"0.72298676",
"0.7221215"... | 0.73028004 | 23 |
Use callbacks to share common setup or constraints between actions. | def set_reservation
@reservation = Reservation.friendly.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def reservation_params
params.require(:reservation).permit(:user_id, :job_id, :status,:review,:rating,:amount,:ending_time,:slug,:revision_description,:rejection_description,:pause_reason,:paused_at,:reviewed_at)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
clear out memoized Framework and LocalEnv instances | def reset
@instance = nil
@local_env = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_env\n DataCache.env_hash = {}\n end",
"def clear_cached_values\n @chocoversion = nil\n @compiled_choco = nil\n end",
"def clean\n # exists? will automatically call deconfigure if necessary\n @instance_cache.map!{ |dev| dev if dev.exists? }\n end",
... | [
"0.75804156",
"0.67919594",
"0.67855126",
"0.664412",
"0.66419417",
"0.6629648",
"0.6599121",
"0.65307087",
"0.6491632",
"0.64609265",
"0.6442336",
"0.6434068",
"0.640228",
"0.63668215",
"0.6365093",
"0.63631463",
"0.63004464",
"0.6282625",
"0.62706286",
"0.62630033",
"0.6252... | 0.74100643 | 2 |
GET /isps GET /isps.json | def index
@isps = Isp.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snps }\n end\n end",
"def index\n @socio_irpjs = SocioIrpj.all\n end",
"def index\n @snips = Snip.all\n\n respond_to do |format|\n format.html # index.html.erb\... | [
"0.65481347",
"0.6263038",
"0.62025106",
"0.6166296",
"0.61100435",
"0.61009514",
"0.6085157",
"0.6040352",
"0.60241735",
"0.5971656",
"0.5910074",
"0.5909469",
"0.5893497",
"0.58617395",
"0.5853113",
"0.5841907",
"0.58054084",
"0.58040136",
"0.58012736",
"0.57784843",
"0.577... | 0.69026697 | 0 |
GET /isps/1 GET /isps/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @isps = Isp.all\n end",
"def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @socio }\n end\n end",
"def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb... | [
"0.6801033",
"0.6415608",
"0.63551927",
"0.635458",
"0.6257551",
"0.6213184",
"0.6192963",
"0.6173294",
"0.6162576",
"0.6150383",
"0.6078247",
"0.6034171",
"0.6031955",
"0.6024358",
"0.60232824",
"0.6016151",
"0.6001468",
"0.5979261",
"0.5968506",
"0.5942707",
"0.59199435",
... | 0.0 | -1 |
POST /isps POST /isps.json | def create
@isp = Isp.new(isp_params)
respond_to do |format|
if @isp.save
format.html { redirect_to @isp, notice: 'Isp was successfully created.' }
format.json { render :show, status: :created, location: @isp }
else
format.html { render :new }
format.json { render json: @isp.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isp_params\n params.require(:isp).permit(:name, :attackID)\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipe... | [
"0.58544284",
"0.5805111",
"0.567645",
"0.5673798",
"0.5655088",
"0.5631333",
"0.5578892",
"0.55357426",
"0.5533478",
"0.55230206",
"0.5515764",
"0.5376391",
"0.5360025",
"0.5348559",
"0.5308799",
"0.5296655",
"0.5250025",
"0.52440387",
"0.5237828",
"0.5228899",
"0.5209398",
... | 0.71348965 | 0 |
PATCH/PUT /isps/1 PATCH/PUT /isps/1.json | def update
respond_to do |format|
if @isp.update(isp_params)
format.html { redirect_to @isp, notice: 'Isp was successfully updated.' }
format.json { render :show, status: :ok, location: @isp }
else
format.html { render :edit }
format.json { render json: @isp.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @squire.update(squire_params)\n format.html { redirect_to @squire, notice: 'Squire was successfully updated.' }\n format.json { render :show, status: :ok, location: @squire }\n else\n format.html { render :edit }\n format.json { rend... | [
"0.6500215",
"0.65000606",
"0.6294271",
"0.6283362",
"0.6253095",
"0.6186845",
"0.61377424",
"0.612602",
"0.6110562",
"0.6096497",
"0.6082327",
"0.60786444",
"0.60739785",
"0.607001",
"0.6069687",
"0.60664874",
"0.60622823",
"0.60445046",
"0.60377777",
"0.6026912",
"0.6023557... | 0.6948542 | 0 |
DELETE /isps/1 DELETE /isps/1.json | def destroy
@isp.destroy
respond_to do |format|
format.html { redirect_to isps_url, notice: 'Isp was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @socio_spc.destroy\n respond_to do |format|\n format.html { redirect_to socio_spcs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sivic_discipulo.destroy\n respond_to do |format|\n format.html { redirect_to sivic_discipulos_url }\n format.... | [
"0.6861883",
"0.6731049",
"0.67298347",
"0.6683525",
"0.6659344",
"0.66463345",
"0.66406304",
"0.6636197",
"0.66064376",
"0.66064376",
"0.65785253",
"0.65729284",
"0.6566983",
"0.6547658",
"0.6539412",
"0.65387005",
"0.64981526",
"0.6493661",
"0.6487279",
"0.6483142",
"0.6477... | 0.7208446 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_isp
@isp = Isp.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def isp_params
params.require(:isp).permit(:name, :attackID)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Accept dispute If a dispute is legitimate, you can choose to accept it. This will close it for you and remove it from your list of open disputes. There are no further financial implications. | def accept_dispute(dispute_id, opts = {})
accept_dispute_with_http_info(dispute_id, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_challenge\n @challenge = Challenge.find(params[:challenge_id])\n if !@challenge.nil? then\n accepted = params[:accepted].to_b\n @challenge.update_attributes accepted: accepted, closed: true\n \n if accepted then\n @challenge.rival.u... | [
"0.61208856",
"0.6075507",
"0.5793209",
"0.5760594",
"0.57113373",
"0.56835866",
"0.5675617",
"0.56418127",
"0.56329083",
"0.5626112",
"0.56073636",
"0.55921817",
"0.5514798",
"0.54894674",
"0.54762053",
"0.5470018",
"0.54161257",
"0.53955007",
"0.5378741",
"0.5365518",
"0.53... | 0.58076364 | 2 |
Accept dispute If a dispute is legitimate, you can choose to accept it. This will close it for you and remove it from your list of open disputes. There are no further financial implications. | def accept_dispute_with_http_info(dispute_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DisputesApi.accept_dispute ...'
end
# verify the required parameter 'dispute_id' is set
if @api_client.config.client_side_validation && dispute_id.nil?
fail ArgumentError, "Missing the required parameter 'dispute_id' when calling DisputesApi.accept_dispute"
end
pattern = Regexp.new(/^(dsp)_(\w{26})$/)
if @api_client.config.client_side_validation && dispute_id !~ pattern
fail ArgumentError, "invalid value for 'dispute_id' when calling DisputesApi.accept_dispute, must conform to the pattern #{pattern}."
end
# resource path
local_var_path = '/disputes/{dispute_id}/accept'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['ApiSecretKey']
new_options = opts.merge(
:operation => :"DisputesApi.accept_dispute",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DisputesApi#accept_dispute\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_challenge\n @challenge = Challenge.find(params[:challenge_id])\n if !@challenge.nil? then\n accepted = params[:accepted].to_b\n @challenge.update_attributes accepted: accepted, closed: true\n \n if accepted then\n @challenge.rival.u... | [
"0.6121807",
"0.6076099",
"0.58073515",
"0.579287",
"0.57599443",
"0.5709649",
"0.5682923",
"0.5675097",
"0.56418294",
"0.5632729",
"0.5626746",
"0.56063515",
"0.55905163",
"0.5515499",
"0.54885215",
"0.54777116",
"0.54693246",
"0.54162365",
"0.5396278",
"0.53781694",
"0.5366... | 0.0 | -1 |
Get dispute details Returns all the details of a dispute using the dispute identifier. | def get_dispute_details(dispute_id, opts = {})
data, _status_code, _headers = get_dispute_details_with_http_info(dispute_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dispute_details_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.get_dispute_details ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation ... | [
"0.6528571",
"0.6504726",
"0.6429193",
"0.6429193",
"0.62441564",
"0.62161034",
"0.61614233",
"0.6070044",
"0.6012627",
"0.5927579",
"0.57882786",
"0.57763785",
"0.5764956",
"0.57508475",
"0.5748973",
"0.57304984",
"0.5725318",
"0.57224196",
"0.57224196",
"0.57183236",
"0.562... | 0.8035517 | 0 |
Get dispute details Returns all the details of a dispute using the dispute identifier. | def get_dispute_details_with_http_info(dispute_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DisputesApi.get_dispute_details ...'
end
# verify the required parameter 'dispute_id' is set
if @api_client.config.client_side_validation && dispute_id.nil?
fail ArgumentError, "Missing the required parameter 'dispute_id' when calling DisputesApi.get_dispute_details"
end
pattern = Regexp.new(/^(dsp)_(\w{26})$/)
if @api_client.config.client_side_validation && dispute_id !~ pattern
fail ArgumentError, "invalid value for 'dispute_id' when calling DisputesApi.get_dispute_details, must conform to the pattern #{pattern}."
end
# resource path
local_var_path = '/disputes/{dispute_id}'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Dispute'
# auth_names
auth_names = opts[:debug_auth_names] || ['ApiSecretKey']
new_options = opts.merge(
:operation => :"DisputesApi.get_dispute_details",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DisputesApi#get_dispute_details\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dispute_details(dispute_id, opts = {})\n data, _status_code, _headers = get_dispute_details_with_http_info(dispute_id, opts)\n data\n end",
"def get_dispute_evidence(dispute_id, opts = {})\n data, _status_code, _headers = get_dispute_evidence_with_http_info(dispute_id, opts)\n data... | [
"0.8035856",
"0.6504682",
"0.64283854",
"0.64283854",
"0.6243345",
"0.6215734",
"0.6161557",
"0.60696095",
"0.60122734",
"0.5927277",
"0.57880384",
"0.57761335",
"0.5764058",
"0.57507944",
"0.57487565",
"0.5730047",
"0.57245874",
"0.57224613",
"0.57224613",
"0.57171255",
"0.5... | 0.6528627 | 1 |
Get dispute evidence Retrieves a list of the evidence submitted in response to a specific dispute. | def get_dispute_evidence(dispute_id, opts = {})
data, _status_code, _headers = get_dispute_evidence_with_http_info(dispute_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provide_dispute_evidence(dispute_id, opts = {})\n provide_dispute_evidence_with_http_info(dispute_id, opts)\n nil\n end",
"def index\n @evidence = Evidence.all\n end",
"def index\n @evidences = Evidence.all\n end",
"def get_dispute_evidence_with_http_info(dispute_id, opts = {})\n ... | [
"0.65136564",
"0.6201981",
"0.61271626",
"0.6014643",
"0.5719737",
"0.5661378",
"0.55535525",
"0.5443012",
"0.5431403",
"0.5414931",
"0.5381682",
"0.5347796",
"0.5347796",
"0.53197044",
"0.5310905",
"0.5292871",
"0.5292871",
"0.52774334",
"0.51486903",
"0.5119194",
"0.5109836... | 0.69512284 | 0 |
Get dispute evidence Retrieves a list of the evidence submitted in response to a specific dispute. | def get_dispute_evidence_with_http_info(dispute_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DisputesApi.get_dispute_evidence ...'
end
# verify the required parameter 'dispute_id' is set
if @api_client.config.client_side_validation && dispute_id.nil?
fail ArgumentError, "Missing the required parameter 'dispute_id' when calling DisputesApi.get_dispute_evidence"
end
pattern = Regexp.new(/^(dsp)_(\w{26})$/)
if @api_client.config.client_side_validation && dispute_id !~ pattern
fail ArgumentError, "invalid value for 'dispute_id' when calling DisputesApi.get_dispute_evidence, must conform to the pattern #{pattern}."
end
# resource path
local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Evidence'
# auth_names
auth_names = opts[:debug_auth_names] || ['ApiSecretKey']
new_options = opts.merge(
:operation => :"DisputesApi.get_dispute_evidence",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DisputesApi#get_dispute_evidence\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dispute_evidence(dispute_id, opts = {})\n data, _status_code, _headers = get_dispute_evidence_with_http_info(dispute_id, opts)\n data\n end",
"def provide_dispute_evidence(dispute_id, opts = {})\n provide_dispute_evidence_with_http_info(dispute_id, opts)\n nil\n end",
"def ind... | [
"0.69512284",
"0.65136564",
"0.6201981",
"0.61271626",
"0.5719737",
"0.5661378",
"0.55535525",
"0.5443012",
"0.5431403",
"0.5414931",
"0.5381682",
"0.5347796",
"0.5347796",
"0.53197044",
"0.5310905",
"0.5292871",
"0.5292871",
"0.52774334",
"0.51486903",
"0.5119194",
"0.510983... | 0.6014643 | 4 |
Get disputes Returns a list of all disputes against your business. The results will be returned in reverse chronological order, showing the last modified dispute (for example, where you've recently added a piece of evidence) first. You can use the optional parameters below to skip or limit results. | def get_disputes(opts = {})
data, _status_code, _headers = get_disputes_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @disputes = Dispute.all\n end",
"def get_disputes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.get_disputes ...'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'... | [
"0.65108514",
"0.6081465",
"0.57753664",
"0.5476248",
"0.54130894",
"0.5400466",
"0.5392575",
"0.53411204",
"0.5335698",
"0.5212754",
"0.509491",
"0.50940126",
"0.5081775",
"0.5066418",
"0.50181496",
"0.5004236",
"0.4987846",
"0.49724054",
"0.49682108",
"0.49634677",
"0.49563... | 0.74500763 | 0 |
Get disputes Returns a list of all disputes against your business. The results will be returned in reverse chronological order, showing the last modified dispute (for example, where you&39;ve recently added a piece of evidence) first. You can use the optional parameters below to skip or limit results. | def get_disputes_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DisputesApi.get_disputes ...'
end
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DisputesApi.get_disputes, must be smaller than or equal to 250.'
end
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DisputesApi.get_disputes, must be greater than or equal to 1.'
end
if @api_client.config.client_side_validation && !opts[:'skip'].nil? && opts[:'skip'] < 0
fail ArgumentError, 'invalid value for "opts[:"skip"]" when calling DisputesApi.get_disputes, must be greater than or equal to 0.'
end
# resource path
local_var_path = '/disputes'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?
query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?
query_params[:'statuses'] = opts[:'statuses'] if !opts[:'statuses'].nil?
query_params[:'payment_id'] = opts[:'payment_id'] if !opts[:'payment_id'].nil?
query_params[:'payment_reference'] = opts[:'payment_reference'] if !opts[:'payment_reference'].nil?
query_params[:'payment_arn'] = opts[:'payment_arn'] if !opts[:'payment_arn'].nil?
query_params[:'this_channel_only'] = opts[:'this_channel_only'] if !opts[:'this_channel_only'].nil?
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'DisputePaged'
# auth_names
auth_names = opts[:debug_auth_names] || ['ApiSecretKey']
new_options = opts.merge(
:operation => :"DisputesApi.get_disputes",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DisputesApi#get_disputes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_disputes(opts = {})\n data, _status_code, _headers = get_disputes_with_http_info(opts)\n data\n end",
"def index\n @disputes = Dispute.all\n end",
"def index\n @discs = Disc.all\n end",
"def all_rated_disabilities\n settings = Settings.lighthouse.veteran_verification.form526\n... | [
"0.74382377",
"0.64520586",
"0.5750546",
"0.55260587",
"0.5377636",
"0.53636736",
"0.53402495",
"0.5303429",
"0.52986366",
"0.51909685",
"0.51038843",
"0.5068612",
"0.5066397",
"0.5057508",
"0.5022501",
"0.5018447",
"0.49859756",
"0.4984799",
"0.49510816",
"0.49411726",
"0.49... | 0.6060502 | 2 |
Get file information Retrieve information about a file that was previously uploaded. | def get_file_information(file_id, opts = {})
data, _status_code, _headers = get_file_information_with_http_info(file_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_details\n return @file_details\n end",
"def file_info(path)\n file = scope.get(path)\n InvalidPath.raise! {!file}\n file.info\n end",
"def uploaded_file\n instance_read(:uploaded_file)\n end",
"def file_info(path)\n info File.read(path)\n e... | [
"0.789547",
"0.7206071",
"0.71080536",
"0.70930475",
"0.6938341",
"0.690924",
"0.68934846",
"0.68429816",
"0.68429816",
"0.67938507",
"0.67938507",
"0.6768885",
"0.6754712",
"0.6754712",
"0.6754712",
"0.6754712",
"0.6694551",
"0.6693724",
"0.65813357",
"0.6571193",
"0.6505044... | 0.62146795 | 42 |
Get file information Retrieve information about a file that was previously uploaded. | def get_file_information_with_http_info(file_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DisputesApi.get_file_information ...'
end
# verify the required parameter 'file_id' is set
if @api_client.config.client_side_validation && file_id.nil?
fail ArgumentError, "Missing the required parameter 'file_id' when calling DisputesApi.get_file_information"
end
# resource path
local_var_path = '/files/{file_id}'.sub('{' + 'file_id' + '}', CGI.escape(file_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'FileResult'
# auth_names
auth_names = opts[:debug_auth_names] || ['ApiSecretKey']
new_options = opts.merge(
:operation => :"DisputesApi.get_file_information",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DisputesApi#get_file_information\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_details\n return @file_details\n end",
"def file_info(path)\n file = scope.get(path)\n InvalidPath.raise! {!file}\n file.info\n end",
"def uploaded_file\n instance_read(:uploaded_file)\n end",
"def file_info(path)\n info File.read(path)\n e... | [
"0.789547",
"0.7206071",
"0.71080536",
"0.70930475",
"0.6938341",
"0.690924",
"0.68934846",
"0.68429816",
"0.68429816",
"0.67938507",
"0.67938507",
"0.6768885",
"0.6754712",
"0.6754712",
"0.6754712",
"0.6754712",
"0.6694551",
"0.6693724",
"0.65813357",
"0.6571193",
"0.6505044... | 0.0 | -1 |
Provide dispute evidence Adds supporting evidence to a dispute. Before using this endpoint, you first need to [upload your files](tag/Disputes/paths/~1files/post) using the file uploader. You will receive a file id (prefixed by `file_`) which you can then use in your request. Note that this only attaches the evidence to the dispute, it does not send it to us. Once ready, you will need to submit it. You must provide at least one evidence type in the body of your request. | def provide_dispute_evidence(dispute_id, opts = {})
provide_dispute_evidence_with_http_info(dispute_id, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evidence_params\n params.require(:evidence).permit(:awarded_badge_id, :file_name)\n end",
"def evidence_params\n params.require(:evidence).permit(:title,:action,:description, :recommendation_id,:day, evidencefiles_attributes: [:document, :_destroy])\n end",
"def submit_dispute_evidence_with... | [
"0.69363457",
"0.6661003",
"0.60244256",
"0.5976163",
"0.587987",
"0.5730977",
"0.5699087",
"0.56732166",
"0.5595771",
"0.54009897",
"0.54009897",
"0.52761143",
"0.52133936",
"0.51940197",
"0.51756847",
"0.51579314",
"0.51423883",
"0.51326764",
"0.51253283",
"0.5118216",
"0.5... | 0.5193103 | 14 |
Provide dispute evidence Adds supporting evidence to a dispute. Before using this endpoint, you first need to [upload your files](tag/Disputes/paths/~1files/post) using the file uploader. You will receive a file id (prefixed by &x60;file_&x60;) which you can then use in your request. Note that this only attaches the evidence to the dispute, it does not send it to us. Once ready, you will need to submit it. You must provide at least one evidence type in the body of your request. | def provide_dispute_evidence_with_http_info(dispute_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DisputesApi.provide_dispute_evidence ...'
end
# verify the required parameter 'dispute_id' is set
if @api_client.config.client_side_validation && dispute_id.nil?
fail ArgumentError, "Missing the required parameter 'dispute_id' when calling DisputesApi.provide_dispute_evidence"
end
pattern = Regexp.new(/^(dsp)_(\w{26})$/)
if @api_client.config.client_side_validation && dispute_id !~ pattern
fail ArgumentError, "invalid value for 'dispute_id' when calling DisputesApi.provide_dispute_evidence, must conform to the pattern #{pattern}."
end
# resource path
local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'provide_evidence_request'])
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['ApiSecretKey']
new_options = opts.merge(
:operation => :"DisputesApi.provide_dispute_evidence",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DisputesApi#provide_dispute_evidence\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evidence_params\n params.require(:evidence).permit(:awarded_badge_id, :file_name)\n end",
"def evidence_params\n params.require(:evidence).permit(:title,:action,:description, :recommendation_id,:day, evidencefiles_attributes: [:document, :_destroy])\n end",
"def submit_dispute_evidence_with... | [
"0.68844604",
"0.66145897",
"0.60603297",
"0.59929526",
"0.57141435",
"0.5713201",
"0.5636474",
"0.5608927",
"0.5389011",
"0.5389011",
"0.5288435",
"0.52189004",
"0.5193484",
"0.5139676",
"0.51297307",
"0.5120266",
"0.5105473",
"0.51007825",
"0.5094642",
"0.5081448",
"0.50671... | 0.589619 | 4 |
Submit dispute evidence With this final request, you can submit the evidence that you have previously provided. Make sure you have provided all the relevant information before using this request. You will not be able to amend your evidence once you have submitted it. | def submit_dispute_evidence(dispute_id, opts = {})
submit_dispute_evidence_with_http_info(dispute_id, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evidence_params\n params.require(:evidence).permit(:awarded_badge_id, :file_name)\n end",
"def evidence_params\n params.require(:evidence).permit(:title,:action,:description, :recommendation_id,:day, evidencefiles_attributes: [:document, :_destroy])\n end",
"def evidence_params\n param... | [
"0.6426868",
"0.6416204",
"0.6224866",
"0.6169022",
"0.6168901",
"0.58507633",
"0.56596124",
"0.5583541",
"0.5551783",
"0.5502571",
"0.54677784",
"0.5448605",
"0.5448605",
"0.54181176",
"0.53506374",
"0.5341992",
"0.5329798",
"0.5326155",
"0.52908725",
"0.526332",
"0.5239235"... | 0.6422297 | 1 |
Submit dispute evidence With this final request, you can submit the evidence that you have previously provided. Make sure you have provided all the relevant information before using this request. You will not be able to amend your evidence once you have submitted it. | def submit_dispute_evidence_with_http_info(dispute_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DisputesApi.submit_dispute_evidence ...'
end
# verify the required parameter 'dispute_id' is set
if @api_client.config.client_side_validation && dispute_id.nil?
fail ArgumentError, "Missing the required parameter 'dispute_id' when calling DisputesApi.submit_dispute_evidence"
end
pattern = Regexp.new(/^(dsp)_(\w{26})$/)
if @api_client.config.client_side_validation && dispute_id !~ pattern
fail ArgumentError, "invalid value for 'dispute_id' when calling DisputesApi.submit_dispute_evidence, must conform to the pattern #{pattern}."
end
# resource path
local_var_path = '/disputes/{dispute_id}/evidence'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['ApiSecretKey']
new_options = opts.merge(
:operation => :"DisputesApi.submit_dispute_evidence",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DisputesApi#submit_dispute_evidence\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evidence_params\n params.require(:evidence).permit(:awarded_badge_id, :file_name)\n end",
"def submit_dispute_evidence(dispute_id, opts = {})\n submit_dispute_evidence_with_http_info(dispute_id, opts)\n nil\n end",
"def evidence_params\n params.require(:evidence).permit(:title,:ac... | [
"0.642808",
"0.6422609",
"0.6417069",
"0.622683",
"0.616887",
"0.58527195",
"0.5661865",
"0.5584199",
"0.5550912",
"0.5503086",
"0.5468699",
"0.54520464",
"0.54520464",
"0.54188913",
"0.53517777",
"0.53443056",
"0.5330164",
"0.53278446",
"0.52907276",
"0.5263941",
"0.5239826"... | 0.61684906 | 5 |
Upload file Upload a file to use as evidence in a dispute. Your file must be in either JPEG/JPG, PNG or PDF format, and be no larger than 4MB. | def upload_file(file, purpose, opts = {})
data, _status_code, _headers = upload_file_with_http_info(file, purpose, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_file\n #TODO\n end",
"def upload_file(file)\n file_path = file.path\n\n @size = File.size(file_path)\n @filename = File.basename(file_path)\n @io = File.open(file_path)\n io.binmode\n Rails.logger.debug \"filename of file to upload: #{filename} filepath:... | [
"0.74860317",
"0.7344324",
"0.7086532",
"0.7070725",
"0.69430274",
"0.6885737",
"0.6860501",
"0.68560225",
"0.68539363",
"0.67689276",
"0.67590314",
"0.6708648",
"0.66976655",
"0.6685136",
"0.6586008",
"0.65588135",
"0.6549528",
"0.6529776",
"0.6525369",
"0.6525369",
"0.65157... | 0.6132838 | 53 |
Upload file Upload a file to use as evidence in a dispute. Your file must be in either JPEG/JPG, PNG or PDF format, and be no larger than 4MB. | def upload_file_with_http_info(file, purpose, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DisputesApi.upload_file ...'
end
# verify the required parameter 'file' is set
if @api_client.config.client_side_validation && file.nil?
fail ArgumentError, "Missing the required parameter 'file' when calling DisputesApi.upload_file"
end
# verify the required parameter 'purpose' is set
if @api_client.config.client_side_validation && purpose.nil?
fail ArgumentError, "Missing the required parameter 'purpose' when calling DisputesApi.upload_file"
end
# resource path
local_var_path = '/files'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
# form parameters
form_params = opts[:form_params] || {}
form_params['file'] = file
form_params['purpose'] = purpose
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'FileUploadResponse'
# auth_names
auth_names = opts[:debug_auth_names] || ['ApiSecretKey']
new_options = opts.merge(
:operation => :"DisputesApi.upload_file",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DisputesApi#upload_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_file\n #TODO\n end",
"def upload_file(file)\n file_path = file.path\n\n @size = File.size(file_path)\n @filename = File.basename(file_path)\n @io = File.open(file_path)\n io.binmode\n Rails.logger.debug \"filename of file to upload: #{filename} filepath:... | [
"0.74871993",
"0.73456824",
"0.7088171",
"0.7073198",
"0.69446623",
"0.68877584",
"0.6860379",
"0.6857626",
"0.6855806",
"0.6772047",
"0.67594016",
"0.67076725",
"0.6698891",
"0.66860497",
"0.65870047",
"0.6560491",
"0.6550116",
"0.65306544",
"0.6526592",
"0.6526592",
"0.6516... | 0.0 | -1 |
A triangle is classified as follows: equilateral All 3 sides are of equal length isosceles 2 sides are of equal length, while the 3rd is different scalene All 3 sides are of different length To be a valid triangle, the sum of the lengths of the two shortest sides must be greater than the length of the longest side, and all sides must have lengths greater than 0: if either of these conditions is not satisfied, the triangle is invalid. Write a method that takes the lengths of the 3 sides of a triangle as arguments, and returns a symbol :equilateral, :isosceles, :scalene, or :invalid depending on whether the triangle is equilateral, isosceles, scalene, or invalid. Rules: Check if the triangle is valid, return a message if not. If it is, THEN return the symbol EXAMPLES: DATA STRUCTURES: INPUT: 3 floats, (turn into an array) OUTPUT: symbol ALGORITHM Check if the triangle is valid / "the sum of the lengths of the two shortest sides must be greater than the length of the longest side, and all sides must have lengths greater than 0" turn into an array and sort the lengths. if any are 0, return :invalid if array elements in first two positions reduce to a number > third element, continue. else return :invalid case when any two consecutive sides are equal, return :isoceles case when 3 consecutive sides are equal, return :equilateral else return :scalene CODE: | def triangle(a, b, c)
lengths = [a,b,c].sort
return :invalid if lengths.any? { |side| side == 0 } || lengths[0..1].sum <= lengths.max
if lengths.each_cons(2).any? { |pair| pair[0] == pair [1] }
lengths.uniq.size == 1 ? :equilateral : :isosceles
else
:scalene
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triangle(len1, len2, len3)\n lengths = [len1, len2, len3].sort\n return :invalid unless valid_triangle?(lengths)\n return :equilateral if lengths.all?(lengths[0])\n return :scalene if lengths.uniq == lengths\n return :isosceles\nend",
"def triangle(s1, s2, s3)\n sides = [s1, s2, s3]\n longest_side = s... | [
"0.8402058",
"0.8227042",
"0.81234264",
"0.80984694",
"0.80696553",
"0.8068965",
"0.80656135",
"0.8054786",
"0.8053299",
"0.8009254",
"0.80003613",
"0.7982491",
"0.7967838",
"0.79548883",
"0.7942188",
"0.7942188",
"0.7902684",
"0.7875767",
"0.781432",
"0.78044724",
"0.7798080... | 0.82080084 | 2 |
GET /jobapplications GET /jobapplications.json | def index
@user=current_user
@jobapplications = @user.jobapplications
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @jobapplications = Jobapplication.all\n end",
"def index\n @job_applications = JobApplication.all\n end",
"def applications_list\n get \"applications\"\n end",
"def index\n @job_applications = @job_applications_active\n end",
"def show\n #@job_application = JobApplication... | [
"0.75712025",
"0.7509937",
"0.7328586",
"0.72294647",
"0.71561056",
"0.714754",
"0.70906514",
"0.6986119",
"0.6917373",
"0.68683404",
"0.6811004",
"0.68095404",
"0.6804624",
"0.6743325",
"0.67002386",
"0.6697153",
"0.6695857",
"0.6694836",
"0.6694836",
"0.6689123",
"0.6674831... | 0.70363295 | 7 |
GET /jobapplications/1 GET /jobapplications/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @jobapplications = Jobapplication.all\n end",
"def index\n @job_applications = JobApplication.all\n end",
"def show\n #@job_application = JobApplication.find(params[:id])\n\n #@user = User.find(params[:id])\n @job_application = current_user.job_applications #.page(params[:page]).pe... | [
"0.73974156",
"0.73329115",
"0.7152045",
"0.7107909",
"0.7035161",
"0.6915667",
"0.6854348",
"0.6854348",
"0.68477976",
"0.6820289",
"0.67768854",
"0.6769192",
"0.6695022",
"0.6662767",
"0.6658025",
"0.6588435",
"0.65872395",
"0.6585567",
"0.6582794",
"0.65645397",
"0.6548503... | 0.0 | -1 |
POST /jobapplications POST /jobapplications.json | def create
@user=current_user
@job=Job.find(session[:job_id])
@jobapplication = @user.jobapplications.build(job:@job)
@jobapplication.name=jobapplication_params[:name]
@jobapplication.phone=jobapplication_params[:phone]
@jobapplication.major=jobapplication_params[:major]
@jobapplication.coverletter=jobapplication_params[:coverletter]
@jobapplication.status="Pending"
@jobapplication.job_name=@job.name
@jobapplication.email=current_user.email
@jobapplication.job_id=@job.id
JobNotifier.received(@jobapplication).deliver
respond_to do |format|
if @jobapplication.save(jobapplication_params)
format.html { redirect_to @jobapplication, notice: 'Jobapplication was successfully created.' }
format.json { render :show, status: :created, location: @jobapplication }
else
format.html { render :new }
format.json { render json: @jobapplication.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @job_application = JobApplication.new(job_application_params)\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to @job_application, notice: 'Job application was successfully created.' }\n format.json { render :show, status: :created, location: @jo... | [
"0.7316559",
"0.73024595",
"0.7293769",
"0.71754336",
"0.7073491",
"0.6844435",
"0.6822148",
"0.6792305",
"0.6749265",
"0.66450775",
"0.6501808",
"0.6499864",
"0.6431803",
"0.63994956",
"0.6330132",
"0.63185525",
"0.6286922",
"0.6230224",
"0.61914474",
"0.6160016",
"0.6154924... | 0.66165906 | 10 |
PATCH/PUT /jobapplications/1 PATCH/PUT /jobapplications/1.json | def update
@user=current_user
@job=Job.find(session[:job_id])
@jobapplication.job_name=@job.name
@jobapplication.email=current_user.email
respond_to do |format|
if @jobapplication.update(jobapplication_params)
format.html { redirect_to @jobapplication, notice: 'Jobapplication was successfully updated.' }
format.json { render :show, status: :ok, location: @jobapplication }
else
format.html { render :edit }
format.json { render json: @jobapplication.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to job_applications_url}\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render ... | [
"0.74559945",
"0.7407683",
"0.73970324",
"0.73759025",
"0.7363393",
"0.7295005",
"0.7295005",
"0.72880805",
"0.7264011",
"0.7177406",
"0.70021",
"0.70021",
"0.68578064",
"0.68068326",
"0.6768039",
"0.6692797",
"0.6682828",
"0.6642247",
"0.65920436",
"0.65756685",
"0.65515107"... | 0.67780286 | 14 |
DELETE /jobapplications/1 DELETE /jobapplications/1.json | def destroy
@jobapplication.destroy
respond_to do |format|
format.html { redirect_to jobapplications_url, notice: 'Jobapplication was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n #@jobapp = Jobapp.find(params[:id])\n @jobapp.destroy\n\n respond_to do |format|\n format.html { redirect_to jobapps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @application = Application.find(params[:id])\n return unless appAccess?(@applicatio... | [
"0.7766266",
"0.76326525",
"0.7621548",
"0.7621548",
"0.76016533",
"0.7578017",
"0.74692094",
"0.7395062",
"0.7395062",
"0.73557",
"0.73557",
"0.73368776",
"0.7278601",
"0.7101841",
"0.70281655",
"0.70260906",
"0.7018765",
"0.70097303",
"0.6998382",
"0.6972625",
"0.69351816",... | 0.73185956 | 12 |
Use callbacks to share common setup or constraints between actions. | def set_jobapplication
@jobapplication = Jobapplication.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def jobapplication_params
params.require(:jobapplication).permit(:name, :email, :job_name, :phone, :status, :user_id, :job_id, :coverletter, :major)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Recipeusers should return the user instances who have recipe cards with this recipe | def users
RecipeCard.all.select { |c| c.recipe == self }.map { |c| c.user }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_recipes\n RecipeCard.all.select do |recipe_cards|\n recipe_cards.user == self \n end\n end",
"def users\n RecipeCard.all.select do |recipe_card|\n recipe_card.recipe == self\n end\n end",
"def recipes\n RecipeCard.all.select do |recipe_car... | [
"0.85119873",
"0.8280848",
"0.8184995",
"0.8129581",
"0.81121093",
"0.8044279",
"0.801113",
"0.7995644",
"0.78879833",
"0.78483945",
"0.77488613",
"0.7734068",
"0.77138174",
"0.7708338",
"0.7701722",
"0.766035",
"0.7639224",
"0.7599163",
"0.759865",
"0.75705534",
"0.7559834",... | 0.775207 | 10 |
Recipeingredients should return all of the ingredients in this recipe | def ingredients
RecipeIngredient.all.select { |ri| ri.recipe == self }.map { |ri| ri.ingredient }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ingredients\n recipe_ingredients.map do |r|\n r.ingredient\n end\n end",
"def ingredients\n recipeingredient.map {|ri| ri.ingredient}\n end",
"def ingredients\n my_recipe_ingredients = RecipeIngredient.all.select do |recipeingredient|\n recipeingredient.recipe == self\n ... | [
"0.831865",
"0.81206983",
"0.8068893",
"0.7958368",
"0.7869872",
"0.77806467",
"0.77555805",
"0.77555805",
"0.7738875",
"0.77230746",
"0.77155066",
"0.7692386",
"0.759416",
"0.753531",
"0.75210756",
"0.7517456",
"0.74817824",
"0.745634",
"0.74436855",
"0.74042046",
"0.7353664... | 0.778758 | 5 |
Recipeallergens should return all of the ingredients in this recipe that are allergens | def allergens
ingredients.select { |i| Allergen.ingredients.include?(i) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allergens\n # first get an array of all possible allergic ingredients\n allergic_ingredients = Allergen.all.map do |allergen|\n allergen.ingredient\n end.uniq\n\n # iterate through this recipes ingredients and see if they're\n # in the list of allergic ingredients\... | [
"0.8864544",
"0.8522095",
"0.83239913",
"0.831388",
"0.82978874",
"0.82944256",
"0.8280847",
"0.8275587",
"0.82043684",
"0.81491953",
"0.81074446",
"0.80986637",
"0.7996668",
"0.798221",
"0.79390764",
"0.79221576",
"0.7914425",
"0.7863859",
"0.7794745",
"0.7776271",
"0.773701... | 0.8500018 | 2 |
Recipeadd_ingredients should take an array of ingredient instances as an argument, and associate each of those ingredients with this recipe | def add_ingredients(ingredients)
ingredients.each { |i| RecipeIngredient.new(self, i) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_ingredients(ingredients)\n ingredients.map do |ingredient|\n RecipeIngredient.new(self, ingredient)\n end \n end",
"def add_ingredients(ingredients_array)\n\t\tRecipeIngredient.new(ingredients_array, self)\n\tend",
"def add_ingredients(ingredients_arr)\n ingredients_arr.e... | [
"0.8711776",
"0.8697517",
"0.86636746",
"0.8630636",
"0.85630447",
"0.8423689",
"0.8303031",
"0.8141886",
"0.80498856",
"0.7979934",
"0.79763687",
"0.7749771",
"0.7695438",
"0.7366467",
"0.72614163",
"0.7234819",
"0.7225639",
"0.71945655",
"0.71579236",
"0.7117883",
"0.708723... | 0.86144197 | 4 |
Connect to a Cherwell server. | def initialize(web_service_url, username=nil, password=nil)
@url = web_service_url
@url.chop! if @url =~ /\/$/ # Remove any trailing slash
@username = username
@password = password
@client = Cherby::Client.new(@url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect\n @comm.connect(opts.user, opts.password, opts.server)\n end",
"def connect_to_server\n @service.connect(connect_settings)\n end",
"def connect_to_mycroft\n if ARGV.include?(\"--no-tls\")\n @client = TCPSocket.open(@host, @port)\n else\n socket = TCPSocke... | [
"0.7371458",
"0.7313136",
"0.7259561",
"0.7010325",
"0.69426316",
"0.6922263",
"0.6897776",
"0.68103325",
"0.6802547",
"0.6785887",
"0.676887",
"0.6711448",
"0.67098147",
"0.66701186",
"0.6661631",
"0.6649645",
"0.66492826",
"0.66154134",
"0.6595982",
"0.6592526",
"0.65782297... | 0.0 | -1 |
Login to Cherwell using the given credentials. Return true if login succeeded, or raise `LoginFailed` if login failed. | def login(username=nil, password=nil)
creds = {
:userId => username || @username,
:password => password || @password,
}
begin
response = @client.call(:login, :message => creds)
rescue => e
# This can happen if a bad URL is given
raise Cherby::LoginFailed, e.message
end
# This can happen if invalid credentials are given
if response.body[:login_response][:login_result] == false
raise Cherby::LoginFailed, "Cherwell returned false status"
end
# Store cookies so subsequent requests will be authorized
@client.cookies = response.http.cookies
# Double-check that login worked
if self.last_error
raise Cherby::LoginFailed, "Cherwell returned error: '#{self.last_error}'"
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login\n username = find_username\n password = find_password\n\n Log.info(\"Logging in as #{username}... \", newline: false)\n\n conn = Faraday.new(url: \"https://redacted.ch/\")\n response = conn.post do |request|\n request.url \"login.php\"\n request.headers[\"User-Agent\"] = Redacted... | [
"0.69659966",
"0.6943631",
"0.68029386",
"0.6529158",
"0.65098614",
"0.6448102",
"0.6405253",
"0.6319349",
"0.63108695",
"0.6307422",
"0.6305286",
"0.6197721",
"0.61966246",
"0.61807466",
"0.61802006",
"0.6169368",
"0.6163685",
"0.6154385",
"0.6147033",
"0.61369807",
"0.61300... | 0.7541474 | 0 |
Log out of Cherwell. | def logout
return @client.logout
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_out\n reset_session\n @current_baby = nil\n end",
"def log_out\n forget(current_baby)\n reset_session\n @current_baby = nil\n end",
"def logout\n validate_arguments!\n\n Turbot::Auth.logout\n display \"Local credentials cleared.\"\n end",
"def log_out\n\t\tsession.delete(:g... | [
"0.7800335",
"0.76600605",
"0.76157767",
"0.7568101",
"0.7521433",
"0.7515926",
"0.74795145",
"0.7462159",
"0.743068",
"0.7399095",
"0.7354413",
"0.73315316",
"0.73011285",
"0.72919923",
"0.72919923",
"0.72919923",
"0.7273882",
"0.7273882",
"0.7273882",
"0.7273882",
"0.727297... | 0.0 | -1 |
Get the Cherwell incident with the given public ID, and return an Incident object. | def incident(id)
incident_xml = get_object_xml('Incident', id)
error = self.last_error
if error
raise Cherby::NotFound.new("Cannot find Incident '#{id}': #{error}")
else
return Incident.new(incident_xml.to_s)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_incident(data)\n incident = Incident.create(data)\n result = @client.create_business_object({\n :busObNameOrId => 'Incident',\n :creationXml => incident.to_xml\n })\n\n # Result contains the public ID of the new incident, or nil if the\n # incident-creation failed.... | [
"0.6230577",
"0.6167987",
"0.56428635",
"0.55607504",
"0.55577266",
"0.5505253",
"0.54623157",
"0.5422608",
"0.5352587",
"0.53493416",
"0.53493416",
"0.533292",
"0.5316828",
"0.52880484",
"0.52880484",
"0.52880484",
"0.52880484",
"0.52880484",
"0.52880484",
"0.52880484",
"0.5... | 0.7662541 | 0 |
Get the Cherwell task with the given public ID, and return a Task object. | def task(id)
task_xml = get_object_xml('Task', id)
error = self.last_error
if error
raise Cherby::NotFound.new("Cannot find Task '#{id}': #{error}")
else
return Task.new(task_xml.to_s)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task id\n Task.new(self, JSON.parse(request :get, \"tasks/#{id}\"))\n end",
"def getTaskByID(id) \n ret = nil \n\n @Tasks.each do |task| \n ret = task if task.ID == id\n end \n end",
"def task(task_id)\n task = self.class.get(\"/tasks/%s\" % task_id).parsed_response\n\n ret... | [
"0.7402685",
"0.69623286",
"0.6862189",
"0.6759626",
"0.66513723",
"0.6555171",
"0.65374213",
"0.64835805",
"0.64676446",
"0.64466",
"0.638712",
"0.6369276",
"0.63113207",
"0.63113207",
"0.6270845",
"0.6267655",
"0.61952704",
"0.61718273",
"0.6155113",
"0.6153831",
"0.6107212... | 0.7864912 | 0 |
Get a BusinessObject instance | def get_business_object(object_type, id)
xml = self.get_object_xml(object_type, id)
return BusinessObject.new(xml)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def business\n @business ||= @session.business\n end",
"def business(business_id)\n begin\n get_hash_by_object(@client.business(business_id))\n rescue Exception => e\n {:application_code => 400}\n end\n end",
"def get(obj)\n collection, query = get_type_info(obj)\n\n r... | [
"0.64524025",
"0.6060337",
"0.5957739",
"0.5940631",
"0.59086174",
"0.5883946",
"0.58594644",
"0.5848227",
"0.5794602",
"0.5794602",
"0.5790286",
"0.5790286",
"0.5790286",
"0.5790286",
"0.5790286",
"0.5790286",
"0.5790286",
"0.5790286",
"0.5790286",
"0.5772834",
"0.57710195",... | 0.8126258 | 0 |
Update a given Cherwell object by submitting its XML to the SOAP interface. | def update_object_xml(object_type, id, xml)
@client.update_business_object_by_public_id({
:busObNameOrId => object_type,
:busObPublicId => id,
:updateXml => xml
})
return last_error
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n connection.put(element_path, to_xml)\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n # returning connection.put(element_path(prefix_options), to_xml, self.class.headers) d... | [
"0.6479917",
"0.63149154",
"0.623946",
"0.5823542",
"0.58115184",
"0.57926804",
"0.57878566",
"0.5706624",
"0.5703181",
"0.5698466",
"0.56553006",
"0.56543136",
"0.5635792",
"0.56115854",
"0.55983585",
"0.55750173",
"0.55648303",
"0.55632895",
"0.5557411",
"0.55290174",
"0.55... | 0.66331226 | 0 |
Save the given Cherwell incident | def save_incident(incident)
update_object_xml('Incident', incident.id, incident.to_xml)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @incident = Incident.new(incident_params)\n @incident.happened_at = Time.now\n @incident.state = :open\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incident was successfully created.' }\n format.json { render :show, statu... | [
"0.6133752",
"0.59281516",
"0.58280176",
"0.5819363",
"0.58001083",
"0.57861286",
"0.57861286",
"0.5772887",
"0.5714373",
"0.5701688",
"0.5701688",
"0.5682269",
"0.5666079",
"0.5666079",
"0.5663588",
"0.56451356",
"0.56451356",
"0.56451356",
"0.56451356",
"0.56451356",
"0.564... | 0.7536809 | 0 |
Save the given Cherwell task | def save_task(task)
update_object_xml('Task', task.id, task.to_xml)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(task)\n serialize Task.create(description: task.description, done: task.done)\n end",
"def save\n MoxiworksPlatform::Task.update(self.to_hash)\n end",
"def save(task)\n task.id = @redis.incr('id_counter') if task.id.nil?\n @redis.lpush('unstarted', Marshal.dump(task)) if task.state =... | [
"0.75393707",
"0.750791",
"0.7185318",
"0.69940114",
"0.67947197",
"0.664525",
"0.66307604",
"0.6410636",
"0.6298683",
"0.6131508",
"0.60617095",
"0.60113007",
"0.594752",
"0.5937259",
"0.59196144",
"0.58929706",
"0.58928627",
"0.58301264",
"0.5826117",
"0.5778159",
"0.573348... | 0.71331966 | 3 |
Create a new Cherwell incident with the given data. If creation succeeds, return the Incident instance; otherwise, return `nil`. | def create_incident(data)
incident = Incident.create(data)
result = @client.create_business_object({
:busObNameOrId => 'Incident',
:creationXml => incident.to_xml
})
# Result contains the public ID of the new incident, or nil if the
# incident-creation failed.
if !result.nil?
incident['IncidentID'] = result
return incident
else
return nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @incident = Incident.new(incident_params)\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incident was successfully created.' }\n format.json { render :show, status: :created, location: @incident }\n else\n format.html... | [
"0.63564336",
"0.6304077",
"0.6295956",
"0.6295956",
"0.62588406",
"0.62181264",
"0.6210553",
"0.61930954",
"0.61212116",
"0.6118432",
"0.5821759",
"0.57834375",
"0.5702393",
"0.5701018",
"0.5651847",
"0.56334335",
"0.5605624",
"0.55650544",
"0.5534656",
"0.55182076",
"0.5491... | 0.839599 | 0 |
Get the last error reported by Cherwell. | def last_error
return @client.get_last_error
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_error()\n return @last_error\n end",
"def last_err\n api(\"LastErr\")\n end",
"def last_error\n @error.respond_to?(:message) ? @error.message : @error\n end",
"def get_last_error\r\n CALLS[\"kernel32!GetLastError:=L\"].call\r\n end",
"def last_exception\n nil... | [
"0.83008265",
"0.8084219",
"0.7802622",
"0.73222286",
"0.71150285",
"0.70043015",
"0.6963514",
"0.6957523",
"0.69565976",
"0.67425543",
"0.6698989",
"0.66716313",
"0.6657931",
"0.6657931",
"0.66383135",
"0.6422763",
"0.63544244",
"0.63339853",
"0.63336486",
"0.63219017",
"0.6... | 0.79901206 | 2 |
Get a business object definition as a hash ex. get_object_definition('Incident') TODO: Use this as the basis for building templates? | def get_object_definition(object_type)
result = {}
definition = @client.get_business_object_definition(object_type)
selector = 'BusinessObjectDef > FieldList > Field'
Nokogiri::XML(definition).css(selector).map do |field|
result[field['Name']] = field.css('Description').inner_html
end
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_definition\n\n end",
"def hash\n [class_id, object_type, description, name, type, system].hash\n end",
"def getEmploymentBusinessDetailObjName\r\n\t\t\treturn \"mfiforce__Employment_Business_Detail__c\"\r\n\t\tend",
"def get_schema(object_name)\n s = @client.describe(object_name)\n ... | [
"0.5812334",
"0.57990557",
"0.5618393",
"0.55305177",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.54875606",
"0.54716027",
"0.5463971",... | 0.7137704 | 0 |
Let's see how much you've got now... | def calculate_balance(month)
plus = month[:income].sum
minus = month[:expenses].sum
plus - minus
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def measure; end",
"def stats; end",
"def stats; end",
"def percent_passes; end",
"def percent_passes; end",
"def total; end",
"def num_known\n @num_known ||= worth_counting { count_known }\nend",
"def measure\n\t\t1\n\tend",
"def total_time; end",
"def counting\n puts \"hard to do right\"\n... | [
"0.67176074",
"0.67021394",
"0.67021394",
"0.6513376",
"0.6513376",
"0.6486386",
"0.6422887",
"0.6411202",
"0.6350286",
"0.62915546",
"0.6273256",
"0.62529564",
"0.6210636",
"0.6204597",
"0.61850905",
"0.6179464",
"0.6156877",
"0.6152296",
"0.6144652",
"0.6136861",
"0.6132980... | 0.0 | -1 |
Use this method to convert roman numbers to arabic Don't you dare cheat on spec!!! | def to_i
value = 0
@roman.split(//).each.with_index do |char, i|
char_val = INT_VAL[char]
next_char = (i + 1 < @roman.length) ? @roman[i + 1] : false
if next_char && INT_VAL[next_char] > char_val
value -= char_val
else
value += char_val
end
end
value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_arabic_numeral(roman)\n number = sum = 0\n roman.bytes do |char| \n sum += number - 2 * number % number = 10 ** (205558 % char % 7) % 9995\n end\n sum + number\n end",
"def convert_roman_numerals_into_arabic string\n\n sumM = string.scan(/(?=M)/).length * 1000\n ... | [
"0.80962443",
"0.79989904",
"0.7661343",
"0.7517114",
"0.7517114",
"0.73418474",
"0.7328175",
"0.73075575",
"0.73014975",
"0.7181064",
"0.7180057",
"0.7153044",
"0.71414876",
"0.71105665",
"0.7097231",
"0.70902216",
"0.70646083",
"0.7039619",
"0.701626",
"0.701268",
"0.699352... | 0.0 | -1 |
Renders a single constituency given a constituency id. | def show
@postcode = flash[:postcode]
@constituency, @seat_incumbencies, @party = Parliament::Utils::Helpers::FilterHelper.filter(@request, 'ConstituencyGroup', 'SeatIncumbency', 'Party')
# Instance variable for single MP pages
@single_mp = true
@constituency = @constituency.first
@seat_incumbencies = @seat_incumbencies.reverse_sort_by(:start_date)
@current_incumbency = @seat_incumbencies.shift if !@seat_incumbencies.empty? && @seat_incumbencies.first.current?
@json_location = constituency_map_path(@constituency.graph_id, format: 'json')
@current_party = @current_incumbency.member.current_party if @current_incumbency
@party = @current_party ? @current_party : @party.first
return if @postcode.nil?
begin
response = Parliament::Utils::Helpers::PostcodeHelper.lookup(@postcode)
@postcode_constituency = response.filter(Parliament::Utils::Helpers::RequestHelper.namespace_uri_schema_path('ConstituencyGroup')).first
postcode_correct = @postcode_constituency.graph_id == @constituency.graph_id
@postcode_constituency.correct = postcode_correct
rescue Parliament::Utils::Helpers::PostcodeHelper::PostcodeError => error
flash[:error] = error.message
@postcode = nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @constituency = Constituency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @constituency }\n end\n end",
"def update\n @constituency = Constituency.find(params[:id])\n\n respond_to do |format|\n if @constituency... | [
"0.6452249",
"0.59990525",
"0.5967143",
"0.5638046",
"0.5525501",
"0.5417787",
"0.53766227",
"0.53503054",
"0.5349137",
"0.53155196",
"0.53111017",
"0.52863073",
"0.52705383",
"0.5250323",
"0.52046597",
"0.5200666",
"0.51653415",
"0.51653415",
"0.516513",
"0.5141347",
"0.5125... | 0.0 | -1 |
Redirects to a single constituency given an external source and an id that identifies this constituency in that source. | def lookup
@constituency = @request.get.first
redirect_to constituency_path(@constituency.graph_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirected\n @url = Url.where(short_url: params[:id]).first\n if @url.present?\n @url.increase_hit\n redirect_to \"#{'http://' unless @url.url.include?('http://') || @url.url.include?('https://')}#{@url.url}\"\n else\n redirect_to urls_path, alert: \"URL not present. Please create new U... | [
"0.6356379",
"0.6323642",
"0.6301863",
"0.62697154",
"0.62367415",
"0.6148157",
"0.6147223",
"0.6096034",
"0.60953665",
"0.6094001",
"0.60492134",
"0.60352594",
"0.5989146",
"0.595721",
"0.5942591",
"0.59392685",
"0.582971",
"0.5796933",
"0.5782548",
"0.5750796",
"0.5746887",... | 0.63747656 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.